1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_GFX_OZONE_IMPL_SOFTWARE_SURFACE_FACTORY_OZONE_H_
6 #define UI_GFX_OZONE_IMPL_SOFTWARE_SURFACE_FACTORY_OZONE_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "ui/gfx/ozone/surface_factory_ozone.h"
13 class DrmWrapperOzone;
14 class HardwareDisplayControllerOzone;
15 class SoftwareSurfaceOzone;
17 // SurfaceFactoryOzone implementation on top of DRM/KMS using dumb buffers.
18 // This implementation is used in conjunction with the software rendering
20 class GFX_EXPORT SoftwareSurfaceFactoryOzone : public SurfaceFactoryOzone {
22 SoftwareSurfaceFactoryOzone();
23 virtual ~SoftwareSurfaceFactoryOzone();
25 virtual HardwareState InitializeHardware() OVERRIDE;
26 virtual void ShutdownHardware() OVERRIDE;
28 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
29 virtual gfx::AcceleratedWidget RealizeAcceleratedWidget(
30 gfx::AcceleratedWidget w) OVERRIDE;
32 virtual bool LoadEGLGLES2Bindings(
33 AddGLLibraryCallback add_gl_library,
34 SetGLGetProcAddressProcCallback set_gl_get_proc_address) OVERRIDE;
36 virtual bool AttemptToResizeAcceleratedWidget(
37 gfx::AcceleratedWidget w,
38 const gfx::Rect& bounds) OVERRIDE;
40 virtual bool SchedulePageFlip(gfx::AcceleratedWidget w) OVERRIDE;
42 virtual SkCanvas* GetCanvasForWidget(gfx::AcceleratedWidget w) OVERRIDE;
44 virtual gfx::VSyncProvider* GetVSyncProvider(
45 gfx::AcceleratedWidget w) OVERRIDE;
48 virtual SoftwareSurfaceOzone* CreateSurface(
49 HardwareDisplayControllerOzone* controller);
51 virtual DrmWrapperOzone* CreateWrapper();
53 virtual bool InitializeControllerForPrimaryDisplay(
55 HardwareDisplayControllerOzone* controller);
57 // Blocks until a DRM event is read.
58 // TODO(dnicoara) Remove once we can safely move DRM event processing in the
59 // message loop while correctly signaling when we're done displaying the
61 virtual void WaitForPageFlipEvent(int fd);
63 scoped_ptr<DrmWrapperOzone> drm_;
68 scoped_ptr<HardwareDisplayControllerOzone> controller_;
71 DISALLOW_COPY_AND_ASSIGN(SoftwareSurfaceFactoryOzone);
76 #endif // UI_GFX_OZONE_IMPL_SOFTWARE_SURFACE_FACTORY_OZONE_H_