| Index: ui/ozone/platform/drm/gpu/gbm_buffer.cc
|
| diff --git a/ui/ozone/platform/drm/gpu/gbm_buffer.cc b/ui/ozone/platform/drm/gpu/gbm_buffer.cc
|
| index 67238740d5b97af29265dfde111d09a6d9807017..40f570a60185ea323e2b7f23927b3e006fa8c391 100644
|
| --- a/ui/ozone/platform/drm/gpu/gbm_buffer.cc
|
| +++ b/ui/ozone/platform/drm/gpu/gbm_buffer.cc
|
| @@ -15,7 +15,6 @@
|
| #include "base/trace_event/trace_event.h"
|
| #include "ui/gfx/buffer_format_util.h"
|
| #include "ui/gfx/geometry/size_conversions.h"
|
| -#include "ui/gfx/native_pixmap_handle.h"
|
| #include "ui/ozone/platform/drm/common/drm_util.h"
|
| #include "ui/ozone/platform/drm/gpu/drm_window.h"
|
| #include "ui/ozone/platform/drm/gpu/gbm_device.h"
|
| @@ -34,14 +33,13 @@ GbmBuffer::GbmBuffer(const scoped_refptr<GbmDevice>& gbm,
|
| uint32_t addfb_flags,
|
| std::vector<base::ScopedFD>&& fds,
|
| const gfx::Size& size,
|
| -
|
| const std::vector<gfx::NativePixmapPlane>&& planes)
|
| : GbmBufferBase(gbm, bo, format, flags, modifier, addfb_flags),
|
| format_(format),
|
| flags_(flags),
|
| - fds_(std::move(fds)),
|
| size_(size),
|
| - planes_(std::move(planes)) {}
|
| + helper_(new gfx::NativePixmapDmabufHelper(std::move(fds),
|
| + std::move(planes))) {}
|
|
|
| GbmBuffer::~GbmBuffer() {
|
| if (bo())
|
| @@ -49,38 +47,27 @@ GbmBuffer::~GbmBuffer() {
|
| }
|
|
|
| bool GbmBuffer::AreFdsValid() const {
|
| - if (fds_.empty())
|
| - return false;
|
| -
|
| - for (const auto& fd : fds_) {
|
| - if (fd.get() == -1)
|
| - return false;
|
| - }
|
| - return true;
|
| + return helper_->AreFdsValid();
|
| }
|
|
|
| size_t GbmBuffer::GetFdCount() const {
|
| - return fds_.size();
|
| + return helper_->GetFdCount();
|
| }
|
|
|
| int GbmBuffer::GetFd(size_t index) const {
|
| - DCHECK_LT(index, fds_.size());
|
| - return fds_[index].get();
|
| + return helper_->GetFd(index);
|
| }
|
|
|
| int GbmBuffer::GetStride(size_t index) const {
|
| - DCHECK_LT(index, planes_.size());
|
| - return planes_[index].stride;
|
| + return helper_->GetStride(index);
|
| }
|
|
|
| int GbmBuffer::GetOffset(size_t index) const {
|
| - DCHECK_LT(index, planes_.size());
|
| - return planes_[index].offset;
|
| + return helper_->GetOffset(index);
|
| }
|
|
|
| size_t GbmBuffer::GetSize(size_t index) const {
|
| - DCHECK_LT(index, planes_.size());
|
| - return planes_[index].size;
|
| + return helper_->GetSize(index);
|
| }
|
|
|
| // TODO(reveman): This should not be needed once crbug.com/597932 is fixed,
|
| @@ -218,7 +205,35 @@ scoped_refptr<GbmBuffer> GbmBuffer::CreateBufferFromFds(
|
|
|
| GbmPixmap::GbmPixmap(GbmSurfaceFactory* surface_manager,
|
| const scoped_refptr<GbmBuffer>& buffer)
|
| - : surface_manager_(surface_manager), buffer_(buffer) {}
|
| + : NativePixmapDmaBuf(
|
| + buffer->GetSize(),
|
| + ui::GetBufferFormatFromFourCCFormat(buffer->GetFormat()),
|
| + buffer->helper()),
|
| + surface_manager_(surface_manager),
|
| + buffer_(buffer) {}
|
| +
|
| +GbmPixmap::~GbmPixmap() {}
|
| +
|
| +uint64_t GbmPixmap::GetDmaBufModifier(size_t plane) const {
|
| + return buffer_->GetFormatModifier();
|
| +}
|
| +
|
| +bool GbmPixmap::ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
|
| + int plane_z_order,
|
| + gfx::OverlayTransform plane_transform,
|
| + const gfx::Rect& display_bounds,
|
| + const gfx::RectF& crop_rect) {
|
| + DCHECK(buffer_->GetFlags() & GBM_BO_USE_SCANOUT);
|
| + OverlayPlane::ProcessBufferCallback processing_callback;
|
| + if (!processing_callback_.is_null())
|
| + processing_callback = base::Bind(&GbmPixmap::ProcessBuffer, this);
|
| +
|
| + surface_manager_->GetSurface(widget)->QueueOverlayPlane(
|
| + OverlayPlane(buffer_, plane_z_order, plane_transform, display_bounds,
|
| + crop_rect, processing_callback));
|
| +
|
| + return true;
|
| +}
|
|
|
| void GbmPixmap::SetProcessingCallback(
|
| const ProcessingCallback& processing_callback) {
|
| @@ -250,62 +265,6 @@ gfx::NativePixmapHandle GbmPixmap::ExportHandle() {
|
| return handle;
|
| }
|
|
|
| -GbmPixmap::~GbmPixmap() {
|
| -}
|
| -
|
| -void* GbmPixmap::GetEGLClientBuffer() const {
|
| - return nullptr;
|
| -}
|
| -
|
| -bool GbmPixmap::AreDmaBufFdsValid() const {
|
| - return buffer_->AreFdsValid();
|
| -}
|
| -
|
| -size_t GbmPixmap::GetDmaBufFdCount() const {
|
| - return buffer_->GetFdCount();
|
| -}
|
| -
|
| -int GbmPixmap::GetDmaBufFd(size_t plane) const {
|
| - return buffer_->GetFd(plane);
|
| -}
|
| -
|
| -int GbmPixmap::GetDmaBufPitch(size_t plane) const {
|
| - return buffer_->GetStride(plane);
|
| -}
|
| -
|
| -int GbmPixmap::GetDmaBufOffset(size_t plane) const {
|
| - return buffer_->GetOffset(plane);
|
| -}
|
| -
|
| -uint64_t GbmPixmap::GetDmaBufModifier(size_t plane) const {
|
| - return buffer_->GetFormatModifier();
|
| -}
|
| -
|
| -gfx::BufferFormat GbmPixmap::GetBufferFormat() const {
|
| - return ui::GetBufferFormatFromFourCCFormat(buffer_->GetFormat());
|
| -}
|
| -
|
| -gfx::Size GbmPixmap::GetBufferSize() const {
|
| - return buffer_->GetSize();
|
| -}
|
| -
|
| -bool GbmPixmap::ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
|
| - int plane_z_order,
|
| - gfx::OverlayTransform plane_transform,
|
| - const gfx::Rect& display_bounds,
|
| - const gfx::RectF& crop_rect) {
|
| - DCHECK(buffer_->GetFlags() & GBM_BO_USE_SCANOUT);
|
| - OverlayPlane::ProcessBufferCallback processing_callback;
|
| - if (!processing_callback_.is_null())
|
| - processing_callback = base::Bind(&GbmPixmap::ProcessBuffer, this);
|
| -
|
| - surface_manager_->GetSurface(widget)->QueueOverlayPlane(
|
| - OverlayPlane(buffer_, plane_z_order, plane_transform, display_bounds,
|
| - crop_rect, processing_callback));
|
| -
|
| - return true;
|
| -}
|
| -
|
| scoped_refptr<ScanoutBuffer> GbmPixmap::ProcessBuffer(const gfx::Size& size,
|
| uint32_t format) {
|
| DCHECK(GetBufferSize() != size ||
|
|
|