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

Unified Diff: ui/ozone/platform/drm/gbm_surface_factory.cc

Issue 1071273002: NotForReview: Implement zero/one-copy texture for ozone freon using Intel DRM Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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/gbm_surface_factory.cc
diff --git a/ui/ozone/platform/drm/gbm_surface_factory.cc b/ui/ozone/platform/drm/gbm_surface_factory.cc
index 290073bc3ba8166e13eccb1bd382565d013df1ec..4685900279d91eb0330d3850374a0913565fc612 100644
--- a/ui/ozone/platform/drm/gbm_surface_factory.cc
+++ b/ui/ozone/platform/drm/gbm_surface_factory.cc
@@ -24,6 +24,10 @@
#include "ui/ozone/public/surface_ozone_canvas.h"
#include "ui/ozone/public/surface_ozone_egl.h"
+#if defined(ARCH_CPU_X86_FAMILY)
+#include "ui/ozone/platform/drm/gpu/gbm_map_pixmap_intel.h"
+#endif
+
namespace ui {
namespace {
@@ -158,15 +162,23 @@ scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap(
gfx::AcceleratedWidget widget,
gfx::Size size,
BufferFormat format,
- BufferUsage usage) {
- if (usage == MAP)
- return nullptr;
-
+ BufferUsage usage,
+ gfx::GpuMemoryBufferHandle* handle) {
+ DCHECK(handle || usage == SCANOUT);
scoped_refptr<GbmDevice> gbm = GetGbmDevice(widget);
DCHECK(gbm);
- scoped_refptr<GbmBuffer> buffer =
- GbmBuffer::CreateBuffer(gbm, format, size, true);
+#if defined(ARCH_CPU_X86_FAMILY)
+ if (usage == MAP) {
+ scoped_refptr<GbmMapPixmapIntel> pixmap =
+ GbmMapPixmapIntel::CreatePixmap(gbm, format, size, handle);
+ if (!pixmap.get())
+ return nullptr;
+ return pixmap;
+ }
+#endif
+
+ scoped_refptr<GbmBuffer> buffer = GbmBuffer::CreateBuffer(gbm, format, size);
if (!buffer.get())
return nullptr;
@@ -215,7 +227,6 @@ bool GbmSurfaceFactory::CanShowPrimaryPlaneAsOverlay() {
bool GbmSurfaceFactory::CanCreateNativePixmap(BufferUsage usage) {
switch (usage) {
case MAP:
- return false;
case SCANOUT:
return true;
}

Powered by Google App Engine
This is Rietveld 408576698