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

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

Issue 1314553002: Move Format checks to HardwareDisplayPlane (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: InitTest Created 5 years, 4 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/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 e4b125f5695bac0425b52d797e7d5acf8467ab07..fc04238a91a3bdff3958ca8045a9bdbd80cb335f 100644
--- a/ui/ozone/platform/drm/gpu/gbm_buffer_base.cc
+++ b/ui/ozone/platform/drm/gpu/gbm_buffer_base.cc
@@ -25,11 +25,22 @@ GbmBufferBase::GbmBufferBase(const scoped_refptr<DrmDevice>& drm,
gbm_bo* bo,
bool scanout)
: drm_(drm), bo_(bo) {
- if (scanout &&
- !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";
+ 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);
+ }
}
GbmBufferBase::~GbmBufferBase() {
@@ -49,8 +60,8 @@ gfx::Size GbmBufferBase::GetSize() const {
return gfx::Size(gbm_bo_get_width(bo_), gbm_bo_get_height(bo_));
}
-uint32_t GbmBufferBase::GetFormat() const {
- return gbm_bo_get_format(bo_);
+uint32_t GbmBufferBase::GetFramebufferPixelFormat() const {
+ return fb_pixel_format_;
}
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698