| 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 eb0b9009349fef71bfba41624f5deacaa660bd94..d36ec22e2424be49593ada0ea3225ba22e6118b8 100644
|
| --- a/ui/ozone/platform/drm/gpu/gbm_buffer_base.cc
|
| +++ b/ui/ozone/platform/drm/gpu/gbm_buffer_base.cc
|
| @@ -21,11 +21,9 @@ GbmBufferBase::GbmBufferBase(const scoped_refptr<GbmDevice>& drm,
|
| : drm_(drm), bo_(bo) {
|
| if (flags & GBM_BO_USE_SCANOUT) {
|
| DCHECK(bo_);
|
| - // The framebuffer format might be different than the format:
|
| - // drm supports 24 bit color depth and formats with alpha will
|
| - // be converted to one without it.
|
| - framebuffer_pixel_format_ =
|
| - GetFourCCFormatForFramebuffer(GetBufferFormatFromFourCCFormat(format));
|
| + framebuffer_pixel_format_ = format;
|
| + opaque_framebuffer_pixel_format_ = GetFourCCFormatForOpaqueFramebuffer(
|
| + GetBufferFormatFromFourCCFormat(format));
|
|
|
| // TODO(dcastagna): Add multi-planar support.
|
| uint32_t handles[4] = {0};
|
| @@ -43,6 +41,12 @@ GbmBufferBase::GbmBufferBase(const scoped_refptr<GbmDevice>& drm,
|
| drm_->AddFramebuffer2(gbm_bo_get_width(bo), gbm_bo_get_height(bo),
|
| framebuffer_pixel_format_, handles, strides, offsets,
|
| modifiers, &framebuffer_, addfb_flags);
|
| + if (opaque_framebuffer_pixel_format_ != framebuffer_pixel_format_) {
|
| + drm_->AddFramebuffer2(gbm_bo_get_width(bo), gbm_bo_get_height(bo),
|
| + opaque_framebuffer_pixel_format_, handles, strides,
|
| + offsets, modifiers, &opaque_framebuffer_,
|
| + addfb_flags);
|
| + }
|
| }
|
| }
|
|
|
| @@ -55,6 +59,10 @@ uint32_t GbmBufferBase::GetFramebufferId() const {
|
| return framebuffer_;
|
| }
|
|
|
| +uint32_t GbmBufferBase::GetOpaqueFramebufferId() const {
|
| + return opaque_framebuffer_ ? opaque_framebuffer_ : framebuffer_;
|
| +}
|
| +
|
| uint32_t GbmBufferBase::GetHandle() const {
|
| return gbm_bo_get_handle(bo_).u32;
|
| }
|
| @@ -68,6 +76,11 @@ uint32_t GbmBufferBase::GetFramebufferPixelFormat() const {
|
| return framebuffer_pixel_format_;
|
| }
|
|
|
| +uint32_t GbmBufferBase::GetOpaqueFramebufferPixelFormat() const {
|
| + DCHECK(framebuffer_);
|
| + return opaque_framebuffer_pixel_format_;
|
| +}
|
| +
|
| const DrmDevice* GbmBufferBase::GetDrmDevice() const {
|
| return drm_.get();
|
| }
|
|
|