| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_BASE_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_BASE_H_ |
| 6 #define UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_BASE_H_ | 6 #define UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_BASE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h" | 11 #include "ui/ozone/platform/drm/gpu/scanout_buffer.h" |
| 12 | 12 |
| 13 struct gbm_bo; | 13 struct gbm_bo; |
| 14 | 14 |
| 15 namespace ui { | 15 namespace ui { |
| 16 | 16 |
| 17 class GbmDevice; | 17 class GbmDevice; |
| 18 | 18 |
| 19 // Wrapper for a GBM buffer. The base class provides common functionality | 19 // Wrapper for a GBM buffer. The base class provides common functionality |
| 20 // required to prepare the buffer for scanout. It does not provide any ownership | 20 // required to prepare the buffer for scanout. It does not provide any ownership |
| 21 // of the buffer. Implementations of this base class should deal with buffer | 21 // of the buffer. Implementations of this base class should deal with buffer |
| 22 // ownership. | 22 // ownership. |
| 23 class GbmBufferBase : public ScanoutBuffer { | 23 class GbmBufferBase : public ScanoutBuffer { |
| 24 public: | 24 public: |
| 25 gbm_bo* bo() const { return bo_; } | 25 gbm_bo* bo() const { return bo_; } |
| 26 const scoped_refptr<GbmDevice>& drm() const { return drm_; } | 26 const scoped_refptr<GbmDevice>& drm() const { return drm_; } |
| 27 | 27 |
| 28 // ScanoutBuffer: | 28 // ScanoutBuffer: |
| 29 uint32_t GetFramebufferId() const override; | 29 uint32_t GetFramebufferId() const override; |
| 30 uint32_t GetOpaqueFramebufferId() const override; |
| 30 uint32_t GetHandle() const override; | 31 uint32_t GetHandle() const override; |
| 31 gfx::Size GetSize() const override; | 32 gfx::Size GetSize() const override; |
| 32 uint32_t GetFramebufferPixelFormat() const override; | 33 uint32_t GetFramebufferPixelFormat() const override; |
| 34 uint32_t GetOpaqueFramebufferPixelFormat() const override; |
| 33 const DrmDevice* GetDrmDevice() const override; | 35 const DrmDevice* GetDrmDevice() const override; |
| 34 bool RequiresGlFinish() const override; | 36 bool RequiresGlFinish() const override; |
| 35 | 37 |
| 36 protected: | 38 protected: |
| 37 GbmBufferBase(const scoped_refptr<GbmDevice>& drm, | 39 GbmBufferBase(const scoped_refptr<GbmDevice>& drm, |
| 38 gbm_bo* bo, | 40 gbm_bo* bo, |
| 39 uint32_t format, | 41 uint32_t format, |
| 40 uint32_t flags, | 42 uint32_t flags, |
| 41 uint64_t modifier, | 43 uint64_t modifier, |
| 42 uint32_t addfb_flags); | 44 uint32_t addfb_flags); |
| 43 ~GbmBufferBase() override; | 45 ~GbmBufferBase() override; |
| 44 | 46 |
| 45 private: | 47 private: |
| 46 scoped_refptr<GbmDevice> drm_; | 48 scoped_refptr<GbmDevice> drm_; |
| 47 gbm_bo* bo_; | 49 gbm_bo* bo_; |
| 48 uint32_t framebuffer_ = 0; | 50 uint32_t framebuffer_ = 0; |
| 49 uint32_t framebuffer_pixel_format_ = 0; | 51 uint32_t framebuffer_pixel_format_ = 0; |
| 52 // If |opaque_framebuffer_pixel_format_| differs from |
| 53 // |framebuffer_pixel_format_| the following member is set to a valid fb, |
| 54 // otherwise it is set to 0. |
| 55 uint32_t opaque_framebuffer_ = 0; |
| 56 uint32_t opaque_framebuffer_pixel_format_ = 0; |
| 50 | 57 |
| 51 DISALLOW_COPY_AND_ASSIGN(GbmBufferBase); | 58 DISALLOW_COPY_AND_ASSIGN(GbmBufferBase); |
| 52 }; | 59 }; |
| 53 | 60 |
| 54 } // namespace ui | 61 } // namespace ui |
| 55 | 62 |
| 56 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_BASE_H_ | 63 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_BASE_H_ |
| OLD | NEW |