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_GBM_SURFACE_H_
6 #define UI_OZONE_PLATFORM_DRI_GBM_SURFACE_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "ui/gfx/geometry/size.h"
11 #include "ui/ozone/platform/dri/gbm_surfaceless.h"
12 #include "ui/ozone/public/surface_ozone_egl.h"
23 // Extends the GBM surfaceless functionality and adds an implicit surface for
24 // the primary plane. Arbitrary buffers can still be allocated and displayed as
25 // overlay planes, however the primary plane is associated with the native
26 // surface and is updated via an EGLSurface.
27 class GbmSurface : public GbmSurfaceless {
29 GbmSurface(const base::WeakPtr<HardwareDisplayController>& controller,
32 virtual ~GbmSurface();
37 virtual intptr_t GetNativeWindow() OVERRIDE;
38 virtual bool ResizeNativeWindow(const gfx::Size& viewport_size) OVERRIDE;
39 virtual bool OnSwapBuffers() OVERRIDE;
42 gbm_device* gbm_device_;
46 // The native GBM surface. In EGL this represents the EGLNativeWindowType.
47 gbm_surface* native_surface_;
49 // Buffer currently used for scanout.
50 gbm_bo* current_buffer_;
54 DISALLOW_COPY_AND_ASSIGN(GbmSurface);
59 #endif // UI_OZONE_PLATFORM_DRI_GBM_SURFACE_H_