Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(579)

Unified Diff: ui/ozone/platform/drm/gpu/drm_buffer.cc

Issue 1422563002: [Ozone] Enables overlay render format setting path and by default use UYVY (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/ozone/platform/drm/gpu/drm_buffer.cc
diff --git a/ui/ozone/platform/drm/gpu/drm_buffer.cc b/ui/ozone/platform/drm/gpu/drm_buffer.cc
index 7f9e5ea0600308e5e68cc58f5a68c92397fd6b98..21647e3765e2456775aa2e82715abfa2f6f4723b 100644
--- a/ui/ozone/platform/drm/gpu/drm_buffer.cc
+++ b/ui/ozone/platform/drm/gpu/drm_buffer.cc
@@ -13,27 +13,6 @@ namespace ui {
namespace {
-// Modesetting cannot happen from a buffer with transparencies. Return the size
-// of a pixel without alpha.
-uint8_t GetColorDepth(SkColorType type) {
- switch (type) {
- case kUnknown_SkColorType:
- case kAlpha_8_SkColorType:
- return 0;
- case kIndex_8_SkColorType:
- return 8;
- case kRGB_565_SkColorType:
- return 16;
- case kARGB_4444_SkColorType:
- return 12;
- case kN32_SkColorType:
- return 24;
- default:
- NOTREACHED();
- return 0;
- }
-}
-
// We always ignore Alpha.
uint32_t GetFourCCCodeForSkColorType(SkColorType type) {
switch (type) {
@@ -87,14 +66,17 @@ bool DrmBuffer::Initialize(const SkImageInfo& info,
}
if (should_register_framebuffer) {
- if (!drm_->AddFramebuffer(
- info.width(), info.height(), GetColorDepth(info.colorType()),
- info.bytesPerPixel() << 3, stride_, handle_, &framebuffer_)) {
- PLOG(ERROR) << "DrmBuffer: AddFramebuffer: handle " << handle_;
+ uint32_t handles[4] = {0};
+ handles[0] = handle_;
+ uint32_t strides[4] = {0};
+ strides[0] = stride_;
+ uint32_t offsets[4] = {0};
+ fb_pixel_format_ = GetFourCCCodeForSkColorType(info.colorType());
+ if (!drm_->AddFramebuffer2(info.width(), info.height(), fb_pixel_format_,
+ handles, strides, offsets, &framebuffer_, 0)) {
+ PLOG(ERROR) << "DrmBuffer: AddFramebuffer2: handle " << handle_;
return false;
}
-
- fb_pixel_format_ = GetFourCCCodeForSkColorType(info.colorType());
}
surface_ =

Powered by Google App Engine
This is Rietveld 408576698