Chromium Code Reviews| 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 DrmDevice; | 17 class DrmDevice; |
| 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<DrmDevice>& drm() const { return drm_; } | |
| 26 | 27 |
| 27 // ScanoutBuffer: | 28 // ScanoutBuffer: |
| 28 uint32_t GetFramebufferId() const override; | 29 uint32_t GetFramebufferId() const override; |
| 29 uint32_t GetHandle() const override; | 30 uint32_t GetHandle() const override; |
| 30 gfx::Size GetSize() const override; | 31 gfx::Size GetSize() const override; |
| 31 uint32_t GetFramebufferPixelFormat() const override; | 32 uint32_t GetFramebufferPixelFormat() const override; |
| 32 bool RequiresGlFinish() const override; | 33 bool RequiresGlFinish() const override; |
| 33 | 34 |
| 34 protected: | 35 protected: |
| 35 GbmBufferBase(const scoped_refptr<DrmDevice>& drm, | 36 GbmBufferBase(const scoped_refptr<DrmDevice>& drm, |
| 36 gbm_bo* bo, | 37 gbm_bo* bo, |
| 37 gfx::BufferFormat format, | 38 gfx::BufferFormat format, |
| 38 gfx::BufferUsage usage); | 39 gfx::BufferUsage usage); |
| 39 ~GbmBufferBase() override; | 40 ~GbmBufferBase() override; |
| 40 | 41 |
| 41 private: | 42 private: |
| 42 scoped_refptr<DrmDevice> drm_; | 43 scoped_refptr<DrmDevice> drm_; |
|
dnicoara
2016/01/14 19:30:02
This could be updated to GbmDevice. That'd help wi
kalyank
2016/01/14 20:36:54
Done.
| |
| 43 gbm_bo* bo_; | 44 gbm_bo* bo_; |
| 44 uint32_t framebuffer_ = 0; | 45 uint32_t framebuffer_ = 0; |
| 45 uint32_t framebuffer_pixel_format_ = 0; | 46 uint32_t framebuffer_pixel_format_ = 0; |
| 46 | 47 |
| 47 DISALLOW_COPY_AND_ASSIGN(GbmBufferBase); | 48 DISALLOW_COPY_AND_ASSIGN(GbmBufferBase); |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 } // namespace ui | 51 } // namespace ui |
| 51 | 52 |
| 52 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_BASE_H_ | 53 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_BASE_H_ |
| OLD | NEW |