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

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

Issue 403043004: [Ozone-DRI] Remove unneeded wrappers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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
« no previous file with comments | « ui/ozone/platform/dri/gbm_surface.cc ('k') | ui/ozone/platform/dri/gbm_surfaceless.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/dri/gbm_surface_factory.cc
diff --git a/ui/ozone/platform/dri/gbm_surface_factory.cc b/ui/ozone/platform/dri/gbm_surface_factory.cc
index 69f7af88ae5d6eba360c3d179efdabcfe17625c0..67508ae7e5053d5c8bea59dd2ad4378339a9f641 100644
--- a/ui/ozone/platform/dri/gbm_surface_factory.cc
+++ b/ui/ozone/platform/dri/gbm_surface_factory.cc
@@ -8,127 +8,15 @@
#include <gbm.h>
#include "base/files/file_path.h"
-#include "ui/ozone/platform/dri/dri_vsync_provider.h"
#include "ui/ozone/platform/dri/gbm_buffer.h"
#include "ui/ozone/platform/dri/gbm_surface.h"
-#include "ui/ozone/platform/dri/hardware_display_controller.h"
-#include "ui/ozone/platform/dri/scanout_surface.h"
+#include "ui/ozone/platform/dri/gbm_surfaceless.h"
#include "ui/ozone/platform/dri/screen_manager.h"
#include "ui/ozone/public/native_pixmap.h"
#include "ui/ozone/public/surface_ozone_egl.h"
namespace ui {
-namespace {
-
-class GbmSurfaceAdapter : public ui::SurfaceOzoneEGL {
- public:
- GbmSurfaceAdapter(
- gbm_device* device,
- DriWrapper* dri,
- const base::WeakPtr<HardwareDisplayController>& controller);
- virtual ~GbmSurfaceAdapter();
-
- bool Initialize();
-
- // SurfaceOzoneEGL:
- virtual intptr_t GetNativeWindow() OVERRIDE;
- virtual bool ResizeNativeWindow(const gfx::Size& viewport_size) OVERRIDE;
- virtual bool OnSwapBuffers() OVERRIDE;
- virtual scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() OVERRIDE;
- virtual bool ScheduleOverlayPlane(int plane_z_order,
- gfx::OverlayTransform plane_transform,
- scoped_refptr<ui::NativePixmap> buffer,
- const gfx::Rect& display_bounds,
- const gfx::RectF& crop_rect) OVERRIDE;
-
- private:
- gbm_device* device_;
- DriWrapper* dri_;
- scoped_ptr<GbmSurface> surface_;
- base::WeakPtr<HardwareDisplayController> controller_;
- OverlayPlaneList overlays_;
-
- DISALLOW_COPY_AND_ASSIGN(GbmSurfaceAdapter);
-};
-
-GbmSurfaceAdapter::GbmSurfaceAdapter(
- gbm_device* device,
- DriWrapper* dri,
- const base::WeakPtr<HardwareDisplayController>& controller)
- : device_(device), dri_(dri), controller_(controller) {}
-
-GbmSurfaceAdapter::~GbmSurfaceAdapter() {}
-
-bool GbmSurfaceAdapter::Initialize() {
- if (controller_) {
- surface_.reset(
- new GbmSurface(device_,
- dri_,
- gfx::Size(controller_->get_mode().hdisplay,
- controller_->get_mode().vdisplay)));
- return surface_->Initialize();
- }
-
- return false;
-}
-
-intptr_t GbmSurfaceAdapter::GetNativeWindow() {
- if (!controller_)
- return 0;
-
- return reinterpret_cast<intptr_t>(surface_->native_surface());
-}
-
-bool GbmSurfaceAdapter::ResizeNativeWindow(const gfx::Size& viewport_size) {
-
- return true;
-}
-
-bool GbmSurfaceAdapter::OnSwapBuffers() {
- if (!controller_)
- return false;
- if (surface_) {
- surface_->PreSwapBuffers();
- overlays_.push_back(OverlayPlane(surface_->backbuffer()));
- }
-
- bool flip_succeeded = controller_->SchedulePageFlip(overlays_);
- overlays_.clear();
- if (flip_succeeded)
- controller_->WaitForPageFlipEvent();
-
- if (surface_)
- surface_->SwapBuffers();
-
- return flip_succeeded;
-}
-
-bool GbmSurfaceAdapter::ScheduleOverlayPlane(
- int plane_z_order,
- gfx::OverlayTransform plane_transform,
- scoped_refptr<NativePixmap> buffer,
- const gfx::Rect& display_bounds,
- const gfx::RectF& crop_rect) {
- GbmPixmap* pixmap = static_cast<GbmPixmap*>(buffer.get());
- if (!pixmap) {
- LOG(ERROR) << "ScheduleOverlayPlane passed NULL buffer";
- return false;
- }
- overlays_.push_back(OverlayPlane(pixmap->buffer(),
- plane_z_order,
- plane_transform,
- display_bounds,
- crop_rect));
- return true;
-}
-
-scoped_ptr<gfx::VSyncProvider> GbmSurfaceAdapter::CreateVSyncProvider() {
- return scoped_ptr<gfx::VSyncProvider>(new DriVSyncProvider(controller_));
-}
-
-} // namespace
-
GbmSurfaceFactory::GbmSurfaceFactory(bool allow_surfaceless)
: DriSurfaceFactory(NULL, NULL),
device_(NULL),
@@ -204,19 +92,24 @@ bool GbmSurfaceFactory::LoadEGLGLES2Bindings(
return true;
}
-scoped_ptr<ui::SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget(
- gfx::AcceleratedWidget w) {
+scoped_ptr<SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget(
+ gfx::AcceleratedWidget widget) {
CHECK(state_ == INITIALIZED);
- ResetCursor(w);
-
- scoped_ptr<GbmSurfaceAdapter> surface(
- new GbmSurfaceAdapter(device_,
- drm_,
- screen_manager_->GetDisplayController(w)));
- if (!allow_surfaceless_ && !surface->Initialize())
- return scoped_ptr<SurfaceOzoneEGL>();
-
- return surface.PassAs<SurfaceOzoneEGL>();
+ ResetCursor(widget);
+
+ if (allow_surfaceless_) {
+ return scoped_ptr<SurfaceOzoneEGL>(
+ new GbmSurfaceless(screen_manager_->GetDisplayController(widget)));
+ } else {
+ scoped_ptr<GbmSurface> surface(
+ new GbmSurface(screen_manager_->GetDisplayController(widget),
+ device_,
+ drm_));
+ if (!surface->Initialize())
+ return scoped_ptr<SurfaceOzoneEGL>();
+
+ return surface.PassAs<SurfaceOzoneEGL>();
+ }
}
scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap(
« no previous file with comments | « ui/ozone/platform/dri/gbm_surface.cc ('k') | ui/ozone/platform/dri/gbm_surfaceless.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698