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

Unified Diff: ui/ozone/platform/drm/gpu/gbm_buffer_base.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/gbm_buffer_base.cc
diff --git a/ui/ozone/platform/drm/gpu/gbm_buffer_base.cc b/ui/ozone/platform/drm/gpu/gbm_buffer_base.cc
index 355b0afdc665c17f567182eb3b9859e94080a32f..5f27c51e7e9f04c1625622f7384e6f4765448932 100644
--- a/ui/ozone/platform/drm/gpu/gbm_buffer_base.cc
+++ b/ui/ozone/platform/drm/gpu/gbm_buffer_base.cc
@@ -11,35 +11,31 @@
namespace ui {
-namespace {
-
-// Pixel configuration for the current buffer format.
-// TODO(dnicoara) These will need to change once we query the hardware for
-// supported configurations.
-const uint8_t kColorDepth = 24;
-const uint8_t kPixelDepth = 32;
-
-} // namespace
-
GbmBufferBase::GbmBufferBase(const scoped_refptr<DrmDevice>& drm,
gbm_bo* bo,
bool scanout)
: drm_(drm), bo_(bo) {
if (scanout) {
- if (!drm_->AddFramebuffer(gbm_bo_get_width(bo), gbm_bo_get_height(bo),
- kColorDepth, kPixelDepth, gbm_bo_get_stride(bo),
- gbm_bo_get_handle(bo).u32, &framebuffer_)) {
- PLOG(ERROR) << "Failed to register buffer";
- return;
- }
-
fb_pixel_format_ = gbm_bo_get_format(bo);
if (fb_pixel_format_ == GBM_FORMAT_ARGB8888)
fb_pixel_format_ = GBM_FORMAT_XRGB8888;
- // For now, we always create a frame buffer of 24 bit color depth and
- // support only XRGB format.
- DCHECK(fb_pixel_format_ == GBM_FORMAT_XRGB8888);
+ // For now, we only support XRGB and UYVY format.
+ DCHECK(fb_pixel_format_ == GBM_FORMAT_XRGB8888 ||
+ fb_pixel_format_ == GBM_FORMAT_UYVY);
+
+ uint32_t handles[4] = {0};
+ handles[0] = gbm_bo_get_handle(bo).u32;
+ uint32_t strides[4] = {0};
+ strides[0] = gbm_bo_get_stride(bo);
+ uint32_t offsets[4] = {0};
+
+ if (!drm_->AddFramebuffer2(gbm_bo_get_width(bo), gbm_bo_get_height(bo),
+ fb_pixel_format_, handles, strides, offsets,
+ &framebuffer_, 0)) {
+ PLOG(ERROR) << "Failed to register buffer";
+ return;
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698