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_DRM_GBM_SURFACE_FACTORY_H_
6 #define UI_OZONE_PLATFORM_DRM_GBM_SURFACE_FACTORY_H_
8 #include "ui/ozone/platform/drm/drm_surface_factory.h"
12 class DrmDeviceManager
;
17 class GbmSurfaceFactory
: public DrmSurfaceFactory
{
19 GbmSurfaceFactory(bool allow_surfaceless
);
20 ~GbmSurfaceFactory() override
;
22 void InitializeGpu(DrmDeviceManager
* drm_device_manager
,
23 ScreenManager
* screen_manager
);
26 intptr_t GetNativeDisplay() override
;
27 int GetDrmFd() override
;
28 const int32_t* GetEGLSurfaceProperties(const int32_t* desired_list
) override
;
29 bool LoadEGLGLES2Bindings(
30 AddGLLibraryCallback add_gl_library
,
31 SetGLGetProcAddressProcCallback set_gl_get_proc_address
) override
;
32 scoped_ptr
<SurfaceOzoneCanvas
> CreateCanvasForWidget(
33 gfx::AcceleratedWidget widget
) override
;
34 scoped_ptr
<ui::SurfaceOzoneEGL
> CreateEGLSurfaceForWidget(
35 gfx::AcceleratedWidget w
) override
;
36 scoped_ptr
<SurfaceOzoneEGL
> CreateSurfacelessEGLSurfaceForWidget(
37 gfx::AcceleratedWidget widget
) override
;
38 scoped_refptr
<ui::NativePixmap
> CreateNativePixmap(
39 gfx::AcceleratedWidget widget
,
42 BufferUsage usage
) override
;
43 OverlayCandidatesOzone
* GetOverlayCandidates(
44 gfx::AcceleratedWidget w
) override
;
45 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget
,
47 gfx::OverlayTransform plane_transform
,
48 scoped_refptr
<NativePixmap
> buffer
,
49 const gfx::Rect
& display_bounds
,
50 const gfx::RectF
& crop_rect
) override
;
51 bool CanShowPrimaryPlaneAsOverlay() override
;
52 bool CanCreateNativePixmap(BufferUsage usage
) override
;
55 scoped_refptr
<GbmDevice
> GetGbmDevice(gfx::AcceleratedWidget widget
);
57 bool allow_surfaceless_
;
59 DrmDeviceManager
* drm_device_manager_
; // Not owned.
61 DISALLOW_COPY_AND_ASSIGN(GbmSurfaceFactory
);
66 #endif // UI_OZONE_PLATFORM_DRM_GBM_SURFACE_FACTORY_H_