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

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

Issue 1311043016: Switch DRM platform to using a separate thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mv-drm-calls-on-thread2
Patch Set: Created 5 years, 3 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/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"
11 #include "ui/gfx/geometry/size.h" 11 #include "ui/gfx/geometry/size.h"
12 #include "ui/ozone/platform/drm/gpu/gbm_buffer_base.h" 12 #include "ui/ozone/platform/drm/gpu/gbm_buffer_base.h"
13 #include "ui/ozone/platform/drm/gpu/screen_manager.h"
14 #include "ui/ozone/public/native_pixmap.h" 13 #include "ui/ozone/public/native_pixmap.h"
15 14
16 struct gbm_bo; 15 struct gbm_bo;
17 16
18 namespace ui { 17 namespace ui {
19 18
19 class DrmThread;
20 class DrmWindowProxy;
20 class GbmDevice; 21 class GbmDevice;
21 22
22 class GbmBuffer : public GbmBufferBase { 23 class GbmBuffer : public GbmBufferBase {
23 public: 24 public:
24 static scoped_refptr<GbmBuffer> CreateBuffer( 25 static scoped_refptr<GbmBuffer> CreateBuffer(
25 const scoped_refptr<GbmDevice>& gbm, 26 const scoped_refptr<GbmDevice>& gbm,
26 gfx::BufferFormat format, 27 gfx::BufferFormat format,
27 const gfx::Size& size, 28 const gfx::Size& size,
28 gfx::BufferUsage usage); 29 gfx::BufferUsage usage);
29 gfx::BufferUsage GetUsage() const { return usage_; } 30 gfx::BufferUsage GetUsage() const { return usage_; }
30 31
31 private: 32 private:
32 GbmBuffer(const scoped_refptr<GbmDevice>& gbm, 33 GbmBuffer(const scoped_refptr<GbmDevice>& gbm,
33 gbm_bo* bo, 34 gbm_bo* bo,
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 GbmPixmap(const scoped_refptr<GbmBuffer>& buffer, DrmThread* drm_thread);
45 ScreenManager* screen_manager);
46 bool Initialize(); 46 bool Initialize();
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 71
72 ScreenManager* screen_manager_; // Not owned. 72 DrmThread* drm_thread_; // Not owned.
73
74 // Since buffers are likely to be shown on the same window, keep a cached
75 // window proxy so we don't have to get this every time the buffer is used.
76 scoped_ptr<DrmWindowProxy> cached_window_;
73 77
74 ScalingCallback scaling_callback_; 78 ScalingCallback scaling_callback_;
75 79
76 DISALLOW_COPY_AND_ASSIGN(GbmPixmap); 80 DISALLOW_COPY_AND_ASSIGN(GbmPixmap);
77 }; 81 };
78 82
79 } // namespace ui 83 } // namespace ui
80 84
81 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_ 85 #endif // UI_OZONE_PLATFORM_DRM_GPU_GBM_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698