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 dff2d96b234c136d4bca99760c71942f79a5c67c..e22aef603c999aa0c017709bc7f83416acdd31bd 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,66 +33,28 @@ 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), |
+ NativePixmapDmabufHelper(std::move(fds), std::move(planes)), |
format_(format), |
flags_(flags), |
- fds_(std::move(fds)), |
- size_(size), |
- planes_(std::move(planes)) {} |
+ size_(size) {} |
GbmBuffer::~GbmBuffer() { |
if (bo()) |
gbm_bo_destroy(bo()); |
} |
-bool GbmBuffer::AreFdsValid() const { |
- if (fds_.empty()) |
- return false; |
- |
- for (const auto& fd : fds_) { |
- if (fd.get() == -1) |
- return false; |
- } |
- return true; |
-} |
- |
-size_t GbmBuffer::GetFdCount() const { |
- return fds_.size(); |
-} |
- |
-int GbmBuffer::GetFd(size_t index) const { |
- DCHECK_LT(index, fds_.size()); |
- return fds_[index].get(); |
-} |
- |
-int GbmBuffer::GetStride(size_t index) const { |
- DCHECK_LT(index, planes_.size()); |
- return planes_[index].stride; |
-} |
- |
-int GbmBuffer::GetOffset(size_t index) const { |
- DCHECK_LT(index, planes_.size()); |
- return planes_[index].offset; |
-} |
- |
-size_t GbmBuffer::GetSize(size_t index) const { |
- DCHECK_LT(index, planes_.size()); |
- return planes_[index].size; |
-} |
- |
-uint64_t GbmBuffer::GetFormatModifier(size_t index) const { |
- DCHECK_LT(index, planes_.size()); |
- return planes_[index].modifier; |
-} |
- |
// TODO(reveman): This should not be needed once crbug.com/597932 is fixed, |
// as the size would be queried directly from the underlying bo. |
gfx::Size GbmBuffer::GetSize() const { |
return size_; |
} |
+size_t GbmBuffer::GetSize(size_t plane) const { |
+ return gfx::NativePixmapDmabufHelper::GetSize(plane); |
+} |
+ |
scoped_refptr<GbmBuffer> GbmBuffer::CreateBufferForBO( |
const scoped_refptr<GbmDevice>& gbm, |
gbm_bo* bo, |
@@ -223,7 +184,12 @@ 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), |
+ surface_manager_(surface_manager), |
+ buffer_(buffer) {} |
void GbmPixmap::SetProcessingCallback( |
const ProcessingCallback& processing_callback) { |
@@ -258,42 +224,6 @@ gfx::NativePixmapHandle GbmPixmap::ExportHandle() { |
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(plane); |
-} |
- |
-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, |