1 // Copyright 2014 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_OZONE_PLATFORM_DRI_DRI_SURFACE_FACTORY_H_
6 #define UI_OZONE_PLATFORM_DRI_DRI_SURFACE_FACTORY_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "third_party/skia/include/core/SkBitmap.h"
12 #include "ui/ozone/ozone_export.h"
13 #include "ui/ozone/public/surface_factory_ozone.h"
15 typedef struct _drmModeModeInfo drmModeModeInfo;
18 class SurfaceOzoneCanvas;
25 class HardwareDisplayController;
28 // SurfaceFactoryOzone implementation on top of DRM/KMS using dumb buffers.
29 // This implementation is used in conjunction with the software rendering
31 class OZONE_EXPORT DriSurfaceFactory : public ui::SurfaceFactoryOzone {
33 static const gfx::AcceleratedWidget kDefaultWidgetHandle;
35 DriSurfaceFactory(DriWrapper* drm, ScreenManager* screen_manager);
36 virtual ~DriSurfaceFactory();
38 // SurfaceFactoryOzone overrides:
39 virtual HardwareState InitializeHardware() OVERRIDE;
40 virtual void ShutdownHardware() OVERRIDE;
42 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
44 virtual scoped_ptr<ui::SurfaceOzoneCanvas> CreateCanvasForWidget(
45 gfx::AcceleratedWidget w) OVERRIDE;
47 virtual bool LoadEGLGLES2Bindings(
48 AddGLLibraryCallback add_gl_library,
49 SetGLGetProcAddressProcCallback set_gl_get_proc_address) OVERRIDE;
51 gfx::Size GetWidgetSize(gfx::AcceleratedWidget w);
53 void SetHardwareCursor(gfx::AcceleratedWidget window,
54 const SkBitmap& image,
55 const gfx::Point& location);
57 void MoveHardwareCursor(gfx::AcceleratedWidget window,
58 const gfx::Point& location);
60 void UnsetHardwareCursor(gfx::AcceleratedWidget window);
63 // Draw the last set cursor & update the cursor plane.
64 void ResetCursor(gfx::AcceleratedWidget w);
66 virtual DriSurface* CreateSurface(const gfx::Size& size);
68 DriWrapper* drm_; // Not owned.
69 ScreenManager* screen_manager_; // Not owned.
73 int allocated_widgets_;
75 scoped_ptr<DriSurface> cursor_surface_;
77 SkBitmap cursor_bitmap_;
78 gfx::Point cursor_location_;
80 DISALLOW_COPY_AND_ASSIGN(DriSurfaceFactory);
85 #endif // UI_OZONE_PLATFORM_DRI_DRI_SURFACE_FACTORY_H_