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

Unified Diff: ui/ozone/platform/dri/ozone_platform_gbm.cc

Issue 371813004: ozone: gbm: Add overlay support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test build Created 6 years, 5 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/dri/ozone_platform_gbm.cc
diff --git a/ui/ozone/platform/dri/ozone_platform_gbm.cc b/ui/ozone/platform/dri/ozone_platform_gbm.cc
index 1ffd179820fd6340ec52574a7985e77189949255..a111a340a612d805890a092415fa4f0a2d6abef1 100644
--- a/ui/ozone/platform/dri/ozone_platform_gbm.cc
+++ b/ui/ozone/platform/dri/ozone_platform_gbm.cc
@@ -14,6 +14,7 @@
#include "ui/ozone/ozone_platform.h"
#include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h"
#include "ui/ozone/platform/dri/dri_wrapper.h"
+#include "ui/ozone/platform/dri/gbm_buffer.h"
#include "ui/ozone/platform/dri/gbm_surface.h"
#include "ui/ozone/platform/dri/gbm_surface_factory.h"
#include "ui/ozone/platform/dri/gpu_platform_support_gbm.h"
@@ -54,7 +55,7 @@ class GbmSurfaceGenerator : public ScanoutSurfaceGenerator {
return new GbmSurface(device_, dri_, size);
}
- private:
+ protected:
DriWrapper* dri_; // Not owned.
// HACK: gbm drivers have broken linkage
@@ -65,9 +66,24 @@ class GbmSurfaceGenerator : public ScanoutSurfaceGenerator {
DISALLOW_COPY_AND_ASSIGN(GbmSurfaceGenerator);
};
+class GbmEglImageSurfaceGenerator : public GbmSurfaceGenerator {
+ public:
+ GbmEglImageSurfaceGenerator(DriWrapper* dri) : GbmSurfaceGenerator(dri) {}
+ virtual ~GbmEglImageSurfaceGenerator() {}
+
+ virtual ScanoutSurface* Create(const gfx::Size& size) OVERRIDE {
+ scoped_ptr<GbmBuffer> buffer =
+ scoped_ptr<GbmBuffer>(new GbmBuffer(device_, dri_, size));
+ if (!buffer->InitializeBuffer(SurfaceFactoryOzone::RGBA_8888, true)) {
+ return NULL;
+ }
+ return buffer.release();
+ }
+};
+
class OzonePlatformGbm : public OzonePlatform {
public:
- OzonePlatformGbm() {
+ OzonePlatformGbm(bool use_surfaceless) : use_surfaceless_(use_surfaceless) {
base::AtExitManager::RegisterTask(
base::Bind(&base::DeletePointer<OzonePlatformGbm>, this));
}
@@ -104,7 +120,7 @@ class OzonePlatformGbm : public OzonePlatform {
vt_manager_.reset(new VirtualTerminalManager());
// Needed since the browser process creates the accelerated widgets and that
// happens through SFO.
- surface_factory_ozone_.reset(new GbmSurfaceFactory());
+ surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_));
device_manager_ = CreateDeviceManager();
gpu_platform_support_host_.reset(new GpuPlatformSupportHostGbm());
@@ -116,11 +132,14 @@ class OzonePlatformGbm : public OzonePlatform {
virtual void InitializeGPU() OVERRIDE {
dri_.reset(new DriWrapper(kDefaultGraphicsCardPath));
- surface_generator_.reset(new GbmSurfaceGenerator(dri_.get()));
+ if (use_surfaceless_)
+ surface_generator_.reset(new GbmEglImageSurfaceGenerator(dri_.get()));
+ else
+ surface_generator_.reset(new GbmSurfaceGenerator(dri_.get()));
screen_manager_.reset(new ScreenManager(dri_.get(),
surface_generator_.get()));
if (!surface_factory_ozone_)
- surface_factory_ozone_.reset(new GbmSurfaceFactory());
+ surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_));
surface_factory_ozone_->InitializeGpu(dri_.get(),
surface_generator_->device(),
@@ -131,6 +150,7 @@ class OzonePlatformGbm : public OzonePlatform {
}
private:
+ bool use_surfaceless_;
scoped_ptr<VirtualTerminalManager> vt_manager_;
scoped_ptr<DriWrapper> dri_;
scoped_ptr<GbmSurfaceGenerator> surface_generator_;
@@ -149,6 +169,11 @@ class OzonePlatformGbm : public OzonePlatform {
} // namespace
-OzonePlatform* CreateOzonePlatformGbm() { return new OzonePlatformGbm; }
+OzonePlatform* CreateOzonePlatformGbm() {
+ return new OzonePlatformGbm(false);
+}
+OzonePlatform* CreateOzonePlatformGbmEglImage() {
+ return new OzonePlatformGbm(true);
+}
} // namespace ui
« no previous file with comments | « ui/ozone/platform/dri/hardware_display_controller_unittest.cc ('k') | ui/ozone/platform/dri/scanout_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698