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

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, 1 month 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 4a2db96b7f5be9ae38939256c3ff56211b8eb249..bd2e9a9367197412a12a3dead76d452ffc0e1ffa 100644
--- a/ui/ozone/platform/drm/gpu/drm_buffer.cc
+++ b/ui/ozone/platform/drm/gpu/drm_buffer.cc
@@ -13,25 +13,6 @@ namespace ui {
namespace {
-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 16;
- case kN32_SkColorType:
- return 32;
- default:
- NOTREACHED();
- return 0;
- }
-}
-
uint32_t GetFourCCCodeForSkColorType(SkColorType type) {
switch (type) {
case kUnknown_SkColorType:
@@ -84,14 +65,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