Fix search results being clipped in app list.
[chromium-blink-merge.git] / ui / ozone / platform / drm / gpu / gbm_surface.h
blob65ec8c7852a46b55bacbe7f25ae3ce0765f1b5e8
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_GPU_GBM_SURFACE_H_
6 #define UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACE_H_
8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h"
10 #include "ui/gfx/geometry/size.h"
11 #include "ui/ozone/platform/drm/gpu/gbm_surfaceless.h"
12 #include "ui/ozone/public/surface_ozone_egl.h"
14 struct gbm_bo;
15 struct gbm_surface;
17 namespace ui {
19 class DrmBuffer;
20 class DrmWindow;
21 class GbmDevice;
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 {
28 public:
29 GbmSurface(DrmWindow* window_delegate, const scoped_refptr<GbmDevice>& gbm);
30 ~GbmSurface() override;
32 bool Initialize();
34 // GbmSurfaceless:
35 intptr_t GetNativeWindow() override;
36 bool ResizeNativeWindow(const gfx::Size& viewport_size) override;
37 bool OnSwapBuffers() override;
38 bool OnSwapBuffersAsync(const SwapCompletionCallback& callback) override;
40 private:
41 void OnSwapBuffersCallback(const SwapCompletionCallback& callback,
42 gbm_bo* pending_buffer);
44 scoped_refptr<GbmDevice> gbm_;
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_;
52 gfx::Size size_;
54 base::WeakPtrFactory<GbmSurface> weak_factory_;
56 DISALLOW_COPY_AND_ASSIGN(GbmSurface);
59 } // namespace ui
61 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_SURFACE_H_