Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / ozone / platform / drm / gpu / gbm_buffer_base.h
blob1690940a252bb6c43ddb6372ed8c974157ac1d65
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_BUFFER_BASE_H_
6 #define UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_BASE_H_
8 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h"
10 struct gbm_bo;
12 namespace ui {
14 class DrmDevice;
16 // Wrapper for a GBM buffer. The base class provides common functionality
17 // required to prepare the buffer for scanout. It does not provide any ownership
18 // of the buffer. Implementations of this base class should deal with buffer
19 // ownership.
20 class GbmBufferBase : public ScanoutBuffer {
21 public:
22 gbm_bo* bo() const { return bo_; }
24 // ScanoutBuffer:
25 uint32_t GetFramebufferId() const override;
26 uint32_t GetHandle() const override;
27 gfx::Size GetSize() const override;
28 uint32_t GetFramebufferPixelFormat() const override;
30 protected:
31 GbmBufferBase(const scoped_refptr<DrmDevice>& drm, gbm_bo* bo, bool scanout);
32 ~GbmBufferBase() override;
34 private:
35 scoped_refptr<DrmDevice> drm_;
36 gbm_bo* bo_;
37 uint32_t framebuffer_ = 0;
38 uint32_t fb_pixel_format_ = 0;
40 DISALLOW_COPY_AND_ASSIGN(GbmBufferBase);
43 } // namespace ui
45 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_BASE_H_