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_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ |
| 6 #define UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ | 6 #define UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/gfx/buffer_types.h" | 10 #include "ui/gfx/buffer_types.h" |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 gfx::BufferUsage usage); | 34 gfx::BufferUsage usage); |
| 35 ~GbmBuffer() override; | 35 ~GbmBuffer() override; |
| 36 | 36 |
| 37 gfx::BufferUsage usage_; | 37 gfx::BufferUsage usage_; |
| 38 | 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(GbmBuffer); | 39 DISALLOW_COPY_AND_ASSIGN(GbmBuffer); |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 class GbmPixmap : public NativePixmap { | 42 class GbmPixmap : public NativePixmap { |
| 43 public: | 43 public: |
| 44 GbmPixmap(const scoped_refptr<GbmBuffer>& buffer, | 44 explicit GbmPixmap(GbmSurfaceFactory* surface_manager); |
| 45 GbmSurfaceFactory* surface_manager); | 45 void Initialize(int dma_buf, int dma_buf_pitch); |
|
spang
2015/10/09 17:29:21
I think we should use ScopedFD instead of int here
reveman
2015/10/09 18:45:32
Done. I also included the GbmPixmap::dma_buf_ chan
| |
| 46 bool Initialize(); | 46 bool InitializeFromBuffer(const scoped_refptr<GbmBuffer>& buffer); |
| 47 void SetScalingCallback(const ScalingCallback& scaling_callback) override; | 47 void SetScalingCallback(const ScalingCallback& scaling_callback) override; |
| 48 scoped_refptr<NativePixmap> GetScaledPixmap(gfx::Size new_size) override; | 48 scoped_refptr<NativePixmap> GetScaledPixmap(gfx::Size new_size) override; |
| 49 | 49 |
| 50 // NativePixmap: | 50 // NativePixmap: |
| 51 void* GetEGLClientBuffer() override; | 51 void* GetEGLClientBuffer() override; |
| 52 int GetDmaBufFd() override; | 52 int GetDmaBufFd() override; |
| 53 int GetDmaBufPitch() override; | 53 int GetDmaBufPitch() override; |
| 54 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | 54 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
| 55 int plane_z_order, | 55 int plane_z_order, |
| 56 gfx::OverlayTransform plane_transform, | 56 gfx::OverlayTransform plane_transform, |
| 57 const gfx::Rect& display_bounds, | 57 const gfx::Rect& display_bounds, |
| 58 const gfx::RectF& crop_rect) override; | 58 const gfx::RectF& crop_rect) override; |
| 59 gfx::NativePixmapHandle ExportHandle() override; | 59 gfx::NativePixmapHandle ExportHandle() override; |
| 60 | 60 |
| 61 scoped_refptr<GbmBuffer> buffer() { return buffer_; } | 61 scoped_refptr<GbmBuffer> buffer() { return buffer_; } |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 ~GbmPixmap() override; | 64 ~GbmPixmap() override; |
| 65 bool ShouldApplyScaling(const gfx::Rect& display_bounds, | 65 bool ShouldApplyScaling(const gfx::Rect& display_bounds, |
| 66 const gfx::RectF& crop_rect, | 66 const gfx::RectF& crop_rect, |
| 67 gfx::Size* required_size); | 67 gfx::Size* required_size); |
| 68 | 68 |
| 69 scoped_refptr<GbmBuffer> buffer_; | 69 scoped_refptr<GbmBuffer> buffer_; |
| 70 int dma_buf_ = -1; | 70 int dma_buf_ = -1; |
| 71 int dma_buf_pitch_ = -1; | |
| 71 | 72 |
| 72 GbmSurfaceFactory* surface_manager_; | 73 GbmSurfaceFactory* surface_manager_; |
| 73 | 74 |
| 74 ScalingCallback scaling_callback_; | 75 ScalingCallback scaling_callback_; |
| 75 | 76 |
| 76 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); | 77 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); |
| 77 }; | 78 }; |
| 78 | 79 |
| 79 } // namespace ui | 80 } // namespace ui |
| 80 | 81 |
| 81 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ | 82 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ |
| OLD | NEW |