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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/platform/dri/gbm_surface_factory.h ('k') | ui/ozone/public/ozone_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/dri/gbm_surface_factory.cc
diff --git a/ui/ozone/platform/dri/gbm_surface_factory.cc b/ui/ozone/platform/dri/gbm_surface_factory.cc
index 6e354b8b8a21c25e4808dc4e9a38ea13d4ab24bb..75caa9b7957a9e9ecc4b6600aaabbe0d0ae0f190 100644
--- a/ui/ozone/platform/dri/gbm_surface_factory.cc
+++ b/ui/ozone/platform/dri/gbm_surface_factory.cc
@@ -6,6 +6,7 @@
#include <gbm.h>
+#include "base/command_line.h"
#include "base/files/file_path.h"
#include "third_party/khronos/EGL/egl.h"
#include "ui/ozone/platform/dri/gbm_buffer.h"
@@ -13,9 +14,54 @@
#include "ui/ozone/platform/dri/gbm_surfaceless.h"
#include "ui/ozone/platform/dri/screen_manager.h"
#include "ui/ozone/public/native_pixmap.h"
+#include "ui/ozone/public/overlay_candidates_ozone.h"
+#include "ui/ozone/public/ozone_switches.h"
#include "ui/ozone/public/surface_ozone_egl.h"
namespace ui {
+namespace {
+
+class SingleOverlay : public OverlayCandidatesOzone {
+ public:
+ SingleOverlay() {}
+ virtual ~SingleOverlay() {}
+
+ virtual void CheckOverlaySupport(OverlaySurfaceCandidateList* candidates) {
+ if (candidates->size() == 2) {
+ OverlayCandidatesOzone::OverlaySurfaceCandidate* first =
+ &(*candidates)[0];
+ OverlayCandidatesOzone::OverlaySurfaceCandidate* second =
+ &(*candidates)[1];
+ OverlayCandidatesOzone::OverlaySurfaceCandidate* overlay;
+ if (first->plane_z_order == 0) {
+ overlay = second;
+ } else if (second->plane_z_order == 0) {
+ overlay = first;
+ } else {
+ NOTREACHED();
+ return;
+ }
+ if (overlay->plane_z_order > 0 &&
+ IsTransformSupported(overlay->transform)) {
+ overlay->overlay_handled = true;
+ }
+ }
+ }
+
+ private:
+ bool IsTransformSupported(gfx::OverlayTransform transform) {
+ switch (transform) {
+ case gfx::OVERLAY_TRANSFORM_NONE:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ DISALLOW_COPY_AND_ASSIGN(SingleOverlay);
+};
+
+} // namespace
GbmSurfaceFactory::GbmSurfaceFactory(bool allow_surfaceless)
: DriSurfaceFactory(NULL, NULL),
@@ -125,6 +171,14 @@ scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap(
return scoped_refptr<GbmPixmap>(new GbmPixmap(buffer));
}
+OverlayCandidatesOzone* GbmSurfaceFactory::GetOverlayCandidates(
+ gfx::AcceleratedWidget w) {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kOzoneTestSingleOverlaySupport))
+ return new SingleOverlay();
+ return NULL;
+}
+
bool GbmSurfaceFactory::ScheduleOverlayPlane(
gfx::AcceleratedWidget widget,
int plane_z_order,
« no previous file with comments | « ui/ozone/platform/dri/gbm_surface_factory.h ('k') | ui/ozone/public/ozone_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698