Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: ui/ozone/platform/drm/gpu/gbm_buffer.h

Issue 1381133002: ozone: Implement support for CreateGpuMemoryBufferFromHandle for OzoneNativePixmap backed GMBs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gmb-factory-create-from-handle
Patch Set: rebase Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/macros.h" 9 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
10 #include "ui/gfx/buffer_types.h" 11 #include "ui/gfx/buffer_types.h"
11 #include "ui/gfx/geometry/size.h" 12 #include "ui/gfx/geometry/size.h"
12 #include "ui/ozone/platform/drm/gpu/gbm_buffer_base.h" 13 #include "ui/ozone/platform/drm/gpu/gbm_buffer_base.h"
13 #include "ui/ozone/public/native_pixmap.h" 14 #include "ui/ozone/public/native_pixmap.h"
14 15
15 struct gbm_bo; 16 struct gbm_bo;
16 17
17 namespace ui { 18 namespace ui {
(...skipping 16 matching lines...) Expand all
34 gfx::BufferUsage usage); 35 gfx::BufferUsage usage);
35 ~GbmBuffer() override; 36 ~GbmBuffer() override;
36 37
37 gfx::BufferUsage usage_; 38 gfx::BufferUsage usage_;
38 39
39 DISALLOW_COPY_AND_ASSIGN(GbmBuffer); 40 DISALLOW_COPY_AND_ASSIGN(GbmBuffer);
40 }; 41 };
41 42
42 class GbmPixmap : public NativePixmap { 43 class GbmPixmap : public NativePixmap {
43 public: 44 public:
44 GbmPixmap(const scoped_refptr<GbmBuffer>& buffer, 45 explicit GbmPixmap(GbmSurfaceFactory* surface_manager);
45 GbmSurfaceFactory* surface_manager); 46 void Initialize(base::ScopedFD dma_buf, int dma_buf_pitch);
46 bool Initialize(); 47 bool InitializeFromBuffer(const scoped_refptr<GbmBuffer>& buffer);
47 void SetScalingCallback(const ScalingCallback& scaling_callback) override; 48 void SetScalingCallback(const ScalingCallback& scaling_callback) override;
48 scoped_refptr<NativePixmap> GetScaledPixmap(gfx::Size new_size) override; 49 scoped_refptr<NativePixmap> GetScaledPixmap(gfx::Size new_size) override;
49 50
50 // NativePixmap: 51 // NativePixmap:
51 void* GetEGLClientBuffer() override; 52 void* GetEGLClientBuffer() override;
52 int GetDmaBufFd() override; 53 int GetDmaBufFd() override;
53 int GetDmaBufPitch() override; 54 int GetDmaBufPitch() override;
54 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, 55 bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
55 int plane_z_order, 56 int plane_z_order,
56 gfx::OverlayTransform plane_transform, 57 gfx::OverlayTransform plane_transform,
57 const gfx::Rect& display_bounds, 58 const gfx::Rect& display_bounds,
58 const gfx::RectF& crop_rect) override; 59 const gfx::RectF& crop_rect) override;
59 gfx::NativePixmapHandle ExportHandle() override; 60 gfx::NativePixmapHandle ExportHandle() override;
60 61
61 scoped_refptr<GbmBuffer> buffer() { return buffer_; } 62 scoped_refptr<GbmBuffer> buffer() { return buffer_; }
62 63
63 private: 64 private:
64 ~GbmPixmap() override; 65 ~GbmPixmap() override;
65 bool ShouldApplyScaling(const gfx::Rect& display_bounds, 66 bool ShouldApplyScaling(const gfx::Rect& display_bounds,
66 const gfx::RectF& crop_rect, 67 const gfx::RectF& crop_rect,
67 gfx::Size* required_size); 68 gfx::Size* required_size);
68 69
69 scoped_refptr<GbmBuffer> buffer_; 70 scoped_refptr<GbmBuffer> buffer_;
70 int dma_buf_ = -1; 71 base::ScopedFD dma_buf_;
72 int dma_buf_pitch_ = -1;
71 73
72 GbmSurfaceFactory* surface_manager_; 74 GbmSurfaceFactory* surface_manager_;
73 75
74 ScalingCallback scaling_callback_; 76 ScalingCallback scaling_callback_;
75 77
76 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); 78 DISALLOW_COPY_AND_ASSIGN(GbmPixmap);
77 }; 79 };
78 80
79 } // namespace ui 81 } // namespace ui
80 82
81 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ 83 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap_unittest.cc ('k') | ui/ozone/platform/drm/gpu/gbm_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698