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

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

Issue 1483633002: ozone: support gfx::BufferFormat::RGBX_8888 as a native pixmap format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix gl_image_ozone_native_pixmap also, which gl_unittests check Created 5 years 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
« no previous file with comments | « ui/ozone/platform/drm/gpu/gbm_buffer_base.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5f27c51e7e9f04c1625622f7384e6f4765448932..09c102da747dbd4e6be795de459d09426aa21a66 100644
--- a/ui/ozone/platform/drm/gpu/gbm_buffer_base.cc
+++ b/ui/ozone/platform/drm/gpu/gbm_buffer_base.cc
@@ -7,22 +7,18 @@
#include <gbm.h>
#include "base/logging.h"
+#include "ui/ozone/platform/drm/common/drm_util.h"
#include "ui/ozone/platform/drm/gpu/drm_device.h"
namespace ui {
GbmBufferBase::GbmBufferBase(const scoped_refptr<DrmDevice>& drm,
gbm_bo* bo,
- bool scanout)
+ gfx::BufferFormat format,
+ gfx::BufferUsage usage)
: drm_(drm), bo_(bo) {
- if (scanout) {
- fb_pixel_format_ = gbm_bo_get_format(bo);
- if (fb_pixel_format_ == GBM_FORMAT_ARGB8888)
- 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);
+ if (usage == gfx::BufferUsage::SCANOUT) {
+ framebuffer_pixel_format_ = GetFourCCFormatForFramebuffer(format);
uint32_t handles[4] = {0};
handles[0] = gbm_bo_get_handle(bo).u32;
@@ -31,8 +27,8 @@ GbmBufferBase::GbmBufferBase(const scoped_refptr<DrmDevice>& drm,
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)) {
+ framebuffer_pixel_format_, handles, strides,
+ offsets, &framebuffer_, 0)) {
PLOG(ERROR) << "Failed to register buffer";
return;
}
@@ -57,7 +53,8 @@ gfx::Size GbmBufferBase::GetSize() const {
}
uint32_t GbmBufferBase::GetFramebufferPixelFormat() const {
- return fb_pixel_format_;
+ DCHECK(framebuffer_);
+ return framebuffer_pixel_format_;
}
bool GbmBufferBase::RequiresGlFinish() const {
« no previous file with comments | « ui/ozone/platform/drm/gpu/gbm_buffer_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698