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

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

Issue 2705213005: Add NativePixmapDmabufStub to finalize glCreateImageCHROMIUM on Linux. (Closed)
Patch Set: Forgot friend class base::RefCountedThreadSafe Created 3 years, 6 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.cc
diff --git a/ui/ozone/platform/drm/gpu/gbm_buffer.cc b/ui/ozone/platform/drm/gpu/gbm_buffer.cc
index dff2d96b234c136d4bca99760c71942f79a5c67c..220b0cc158e6cfc3e1bb5763d173e4e547989cf1 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,43 +47,31 @@ 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);
}
uint64_t GbmBuffer::GetFormatModifier(size_t index) const {
- DCHECK_LT(index, planes_.size());
- return planes_[index].modifier;
+ return helper_->GetFormatModifier(index);
}
// TODO(reveman): This should not be needed once crbug.com/597932 is fixed,
@@ -223,7 +209,31 @@ 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() {}
+
+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) {
@@ -255,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(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,
- 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 ||
« ui/gfx/linux/native_pixmap_dmabuf.h ('K') | « ui/ozone/platform/drm/gpu/gbm_buffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698