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

Side by Side Diff: ui/ozone/platform/dri/gbm_surface_factory.cc

Issue 489193002: Ozone overlay candidates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « ui/ozone/platform/dri/gbm_surface_factory.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "ui/ozone/platform/dri/gbm_surface_factory.h" 5 #include "ui/ozone/platform/dri/gbm_surface_factory.h"
6 6
7 #include <gbm.h> 7 #include <gbm.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "third_party/khronos/EGL/egl.h" 10 #include "third_party/khronos/EGL/egl.h"
11 #include "ui/ozone/platform/dri/gbm_buffer.h" 11 #include "ui/ozone/platform/dri/gbm_buffer.h"
12 #include "ui/ozone/platform/dri/gbm_surface.h" 12 #include "ui/ozone/platform/dri/gbm_surface.h"
13 #include "ui/ozone/platform/dri/gbm_surfaceless.h" 13 #include "ui/ozone/platform/dri/gbm_surfaceless.h"
14 #include "ui/ozone/platform/dri/screen_manager.h" 14 #include "ui/ozone/platform/dri/screen_manager.h"
15 #include "ui/ozone/public/native_pixmap.h" 15 #include "ui/ozone/public/native_pixmap.h"
16 #include "ui/ozone/public/overlay_candidates_ozone.h"
16 #include "ui/ozone/public/surface_ozone_egl.h" 17 #include "ui/ozone/public/surface_ozone_egl.h"
17 18
18 namespace ui { 19 namespace ui {
20 namespace {
dnicoara 2014/08/20 19:36:38 Please add blank line between namespaces and betwe
achaulk 2014/08/21 15:16:32 Done.
21 class SingleOverlayOzone : public OverlayCandidatesOzone {
dnicoara 2014/08/20 19:36:38 As a rule, please don't use Ozone in internal impl
achaulk 2014/08/21 15:16:32 Acknowledged.
22 public:
dnicoara 2014/08/20 19:36:39 needs a virtual destructor. Also, please add a DIS
achaulk 2014/08/21 15:16:32 Done.
23 static bool IsTransformSupported(gfx::OverlayTransform transform) {
dnicoara 2014/08/20 19:36:38 There's no need for a static, just make it private
24 switch (transform) {
25 case gfx::OVERLAY_TRANSFORM_NONE:
26 return true;
27 default:
28 return false;
29 }
30 }
31 virtual void CheckOverlaySupport(OverlaySurfaceCandidateList* surfaces) {
dnicoara 2014/08/20 19:36:38 nit: rename surfaces to candidates (or surface_can
32 if (surfaces->size() == 2) {
alexst (slow to review) 2014/08/20 19:52:36 So this isn't universally true, some HW may not ev
achaulk 2014/08/21 15:16:32 Sure, a flag makes sense
33 const OverlayCandidatesOzone::OverlaySurfaceCandidate& first =
dnicoara 2014/08/20 19:36:38 Is this one marked to true by default? It isn't sp
achaulk 2014/08/21 15:16:32 I think the idea is we mark all surfaces we want t
dnicoara 2014/08/21 15:57:20 Sorry, I think something went over my head. Is the
achaulk 2014/08/21 16:04:29 Well normally the primary plane wouldn't get trans
dnicoara 2014/08/22 02:00:15 But in surfaceless, the primary plane is an "overl
achaulk 2014/08/22 02:43:11 Yes, but surfaceless unconditionally sends the pri
34 (*surfaces)[0];
35 OverlayCandidatesOzone::OverlaySurfaceCandidate& second = (*surfaces)[1];
36 if (first.plane_z_order == 0 && second.plane_z_order > 0 &&
dnicoara 2014/08/21 15:57:20 Are these guaranteed to be in order? Why not treat
achaulk 2014/08/21 16:04:29 They are in the only thing that sends us planes so
dnicoara 2014/08/22 02:00:14 I think we shouldn't assume order. Or if we do, th
achaulk 2014/08/22 17:55:01 Done.
37 IsTransformSupported(second.transform)) {
38 second.overlay_handled = true;
39 }
40 }
41 }
42 };
43 } // namespace
19 44
20 GbmSurfaceFactory::GbmSurfaceFactory(bool allow_surfaceless) 45 GbmSurfaceFactory::GbmSurfaceFactory(bool allow_surfaceless)
21 : DriSurfaceFactory(NULL, NULL), 46 : DriSurfaceFactory(NULL, NULL),
22 device_(NULL), 47 device_(NULL),
23 allow_surfaceless_(allow_surfaceless) { 48 allow_surfaceless_(allow_surfaceless) {
24 } 49 }
25 50
26 GbmSurfaceFactory::~GbmSurfaceFactory() {} 51 GbmSurfaceFactory::~GbmSurfaceFactory() {}
27 52
28 void GbmSurfaceFactory::InitializeGpu( 53 void GbmSurfaceFactory::InitializeGpu(
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 gfx::Size size, 143 gfx::Size size,
119 BufferFormat format) { 144 BufferFormat format) {
120 scoped_refptr<GbmBuffer> buffer = GbmBuffer::CreateBuffer( 145 scoped_refptr<GbmBuffer> buffer = GbmBuffer::CreateBuffer(
121 drm_, device_, format, size, true); 146 drm_, device_, format, size, true);
122 if (!buffer) 147 if (!buffer)
123 return NULL; 148 return NULL;
124 149
125 return scoped_refptr<GbmPixmap>(new GbmPixmap(buffer)); 150 return scoped_refptr<GbmPixmap>(new GbmPixmap(buffer));
126 } 151 }
127 152
153 OverlayCandidatesOzone* GbmSurfaceFactory::GetOverlayCandidates(
154 gfx::AcceleratedWidget w) {
155 return new SingleOverlayOzone();
156 }
157
128 bool GbmSurfaceFactory::ScheduleOverlayPlane( 158 bool GbmSurfaceFactory::ScheduleOverlayPlane(
129 gfx::AcceleratedWidget widget, 159 gfx::AcceleratedWidget widget,
130 int plane_z_order, 160 int plane_z_order,
131 gfx::OverlayTransform plane_transform, 161 gfx::OverlayTransform plane_transform,
132 scoped_refptr<NativePixmap> buffer, 162 scoped_refptr<NativePixmap> buffer,
133 const gfx::Rect& display_bounds, 163 const gfx::Rect& display_bounds,
134 const gfx::RectF& crop_rect) { 164 const gfx::RectF& crop_rect) {
135 scoped_refptr<GbmPixmap> pixmap = static_cast<GbmPixmap*>(buffer.get()); 165 scoped_refptr<GbmPixmap> pixmap = static_cast<GbmPixmap*>(buffer.get());
136 if (!pixmap) { 166 if (!pixmap) {
137 LOG(ERROR) << "ScheduleOverlayPlane passed NULL buffer."; 167 LOG(ERROR) << "ScheduleOverlayPlane passed NULL buffer.";
138 return false; 168 return false;
139 } 169 }
140 base::WeakPtr<HardwareDisplayController> hdc = 170 base::WeakPtr<HardwareDisplayController> hdc =
141 screen_manager_->GetDisplayController(widget); 171 screen_manager_->GetDisplayController(widget);
142 if (!hdc) 172 if (!hdc)
143 return true; 173 return true;
144 hdc->QueueOverlayPlane(OverlayPlane(pixmap->buffer(), 174 hdc->QueueOverlayPlane(OverlayPlane(pixmap->buffer(),
145 plane_z_order, 175 plane_z_order,
146 plane_transform, 176 plane_transform,
147 display_bounds, 177 display_bounds,
148 crop_rect)); 178 crop_rect));
149 return true; 179 return true;
150 } 180 }
151 181
152 bool GbmSurfaceFactory::CanShowPrimaryPlaneAsOverlay() { 182 bool GbmSurfaceFactory::CanShowPrimaryPlaneAsOverlay() {
153 return allow_surfaceless_; 183 return allow_surfaceless_;
154 } 184 }
155 185
156 } // namespace ui 186 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/gbm_surface_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698