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

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

Issue 1311043016: Switch DRM platform to using a separate thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mv-drm-calls-on-thread2
Patch Set: . Created 5 years, 3 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/ozone_platform_gbm.cc
diff --git a/ui/ozone/platform/drm/ozone_platform_gbm.cc b/ui/ozone/platform/drm/ozone_platform_gbm.cc
index 0a6e08cf5dd99776c60d077d60f09904c429c4dc..b3b8c79222caa724602d717eb252f9c4da2be20b 100644
--- a/ui/ozone/platform/drm/ozone_platform_gbm.cc
+++ b/ui/ozone/platform/drm/ozone_platform_gbm.cc
@@ -18,9 +18,9 @@
#include "ui/ozone/platform/drm/gpu/drm_device_manager.h"
#include "ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h"
#include "ui/ozone/platform/drm/gpu/drm_gpu_platform_support.h"
-#include "ui/ozone/platform/drm/gpu/gbm_buffer.h"
-#include "ui/ozone/platform/drm/gpu/gbm_device.h"
+#include "ui/ozone/platform/drm/gpu/drm_thread.h"
#include "ui/ozone/platform/drm/gpu/gbm_surface_factory.h"
+#include "ui/ozone/platform/drm/gpu/proxy_helpers.h"
#include "ui/ozone/platform/drm/gpu/scanout_buffer.h"
#include "ui/ozone/platform/drm/gpu/screen_manager.h"
#include "ui/ozone/platform/drm/host/drm_cursor.h"
@@ -71,45 +71,6 @@ class GlApiLoader {
DISALLOW_COPY_AND_ASSIGN(GlApiLoader);
};
-class GbmBufferGenerator : public ScanoutBufferGenerator {
- public:
- GbmBufferGenerator() {}
- ~GbmBufferGenerator() override {}
-
- // ScanoutBufferGenerator:
- scoped_refptr<ScanoutBuffer> Create(const scoped_refptr<DrmDevice>& drm,
- gfx::BufferFormat format,
- const gfx::Size& size) override {
- scoped_refptr<GbmDevice> gbm(static_cast<GbmDevice*>(drm.get()));
- return GbmBuffer::CreateBuffer(gbm, format, size,
- gfx::BufferUsage::SCANOUT);
- }
-
- protected:
- DISALLOW_COPY_AND_ASSIGN(GbmBufferGenerator);
-};
-
-class GbmDeviceGenerator : public DrmDeviceGenerator {
- public:
- GbmDeviceGenerator(bool use_atomic) : use_atomic_(use_atomic) {}
- ~GbmDeviceGenerator() override {}
-
- // DrmDeviceGenerator:
- scoped_refptr<DrmDevice> CreateDevice(const base::FilePath& path,
- base::File file) override {
- scoped_refptr<DrmDevice> drm = new GbmDevice(path, file.Pass());
- if (drm->Initialize(use_atomic_))
- return drm;
-
- return nullptr;
- }
-
- private:
- bool use_atomic_;
-
- DISALLOW_COPY_AND_ASSIGN(GbmDeviceGenerator);
-};
-
class OzonePlatformGbm : public OzonePlatform {
public:
OzonePlatformGbm() {}
@@ -117,7 +78,7 @@ class OzonePlatformGbm : public OzonePlatform {
// OzonePlatform:
ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override {
- return surface_factory_ozone_.get();
+ return surface_factory_.get();
}
OverlayManagerOzone* GetOverlayManager() override {
return overlay_manager_.get();
@@ -185,32 +146,20 @@ class OzonePlatformGbm : public OzonePlatform {
}
void InitializeGPU() override {
- bool use_atomic = false;
-#if defined(USE_DRM_ATOMIC)
- use_atomic = true;
-#endif
gl_api_loader_.reset(new GlApiLoader());
- drm_device_manager_.reset(new DrmDeviceManager(
- scoped_ptr<DrmDeviceGenerator>(new GbmDeviceGenerator(use_atomic))));
- buffer_generator_.reset(new GbmBufferGenerator());
- screen_manager_.reset(new ScreenManager(buffer_generator_.get()));
- surface_factory_ozone_.reset(new GbmSurfaceFactory());
- surface_factory_ozone_->InitializeGpu(drm_device_manager_.get(),
- screen_manager_.get());
- scoped_ptr<DrmGpuDisplayManager> display_manager(new DrmGpuDisplayManager(
- screen_manager_.get(), drm_device_manager_.get()));
- gpu_platform_support_.reset(new DrmGpuPlatformSupport(
- drm_device_manager_.get(), screen_manager_.get(),
- buffer_generator_.get(), display_manager.Pass()));
+ // NOTE: Can't start the thread here since this is called before sandbox
+ // initialization.
+ drm_thread_.reset(new DrmThread());
+
+ surface_factory_.reset(new GbmSurfaceFactory(drm_thread_.get()));
+ gpu_platform_support_.reset(new DrmGpuPlatformSupport(drm_thread_.get()));
}
private:
// Objects in the GPU process.
- scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_;
+ scoped_ptr<DrmThread> drm_thread_;
scoped_ptr<GlApiLoader> gl_api_loader_;
- scoped_ptr<DrmDeviceManager> drm_device_manager_;
- scoped_ptr<GbmBufferGenerator> buffer_generator_;
- scoped_ptr<ScreenManager> screen_manager_;
+ scoped_ptr<GbmSurfaceFactory> surface_factory_;
scoped_ptr<DrmGpuPlatformSupport> gpu_platform_support_;
// Objects in the Browser process.
« ui/ozone/platform/drm/gpu/drm_thread.cc ('K') | « ui/ozone/platform/drm/gpu/screen_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698