| 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/files/scoped_file.h" | 8 #include "base/files/scoped_file.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "ui/gfx/buffer_types.h" | 10 #include "ui/gfx/buffer_types.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 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 explicit GbmPixmap(GbmSurfaceFactory* surface_manager); | 44 explicit GbmPixmap(GbmSurfaceFactory* surface_manager); |
| 45 void Initialize(base::ScopedFD dma_buf, int dma_buf_pitch); | 45 void Initialize(base::ScopedFD dma_buf, int dma_buf_pitch); |
| 46 bool InitializeFromBuffer(const scoped_refptr<GbmBuffer>& buffer); | 46 bool InitializeFromBuffer(const scoped_refptr<GbmBuffer>& buffer); |
| 47 void SetScalingCallback(const ScalingCallback& scaling_callback) override; | 47 void SetProcessingCallback( |
| 48 scoped_refptr<NativePixmap> GetScaledPixmap(gfx::Size new_size) override; | 48 const ProcessingCallback& processing_callback) override; |
| 49 scoped_refptr<NativePixmap> GetProcessedPixmap( |
| 50 gfx::Size target_size, |
| 51 gfx::BufferFormat target_format) override; |
| 49 | 52 |
| 50 // NativePixmap: | 53 // NativePixmap: |
| 51 void* GetEGLClientBuffer() override; | 54 void* GetEGLClientBuffer() override; |
| 52 int GetDmaBufFd() override; | 55 int GetDmaBufFd() override; |
| 53 int GetDmaBufPitch() override; | 56 int GetDmaBufPitch() override; |
| 57 gfx::BufferFormat GetBufferFormat() override; |
| 54 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | 58 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
| 55 int plane_z_order, | 59 int plane_z_order, |
| 56 gfx::OverlayTransform plane_transform, | 60 gfx::OverlayTransform plane_transform, |
| 57 const gfx::Rect& display_bounds, | 61 const gfx::Rect& display_bounds, |
| 58 const gfx::RectF& crop_rect) override; | 62 const gfx::RectF& crop_rect) override; |
| 59 gfx::NativePixmapHandle ExportHandle() override; | 63 gfx::NativePixmapHandle ExportHandle() override; |
| 60 | 64 |
| 61 scoped_refptr<GbmBuffer> buffer() { return buffer_; } | 65 scoped_refptr<GbmBuffer> buffer() { return buffer_; } |
| 62 | 66 |
| 63 private: | 67 private: |
| 64 ~GbmPixmap() override; | 68 ~GbmPixmap() override; |
| 65 bool ShouldApplyScaling(const gfx::Rect& display_bounds, | 69 bool ShouldApplyProcessing(const gfx::Rect& display_bounds, |
| 66 const gfx::RectF& crop_rect, | 70 const gfx::RectF& crop_rect, |
| 67 gfx::Size* required_size); | 71 gfx::Size* target_size, |
| 72 gfx::BufferFormat* target_format); |
| 68 | 73 |
| 69 scoped_refptr<GbmBuffer> buffer_; | 74 scoped_refptr<GbmBuffer> buffer_; |
| 70 base::ScopedFD dma_buf_; | 75 base::ScopedFD dma_buf_; |
| 71 int dma_buf_pitch_ = -1; | 76 int dma_buf_pitch_ = -1; |
| 72 | 77 |
| 73 GbmSurfaceFactory* surface_manager_; | 78 GbmSurfaceFactory* surface_manager_; |
| 74 | 79 |
| 75 ScalingCallback scaling_callback_; | 80 ProcessingCallback processing_callback_; |
| 76 | 81 |
| 77 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); | 82 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); |
| 78 }; | 83 }; |
| 79 | 84 |
| 80 } // namespace ui | 85 } // namespace ui |
| 81 | 86 |
| 82 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ | 87 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ |
| OLD | NEW |