Commit c2761c32 authored by achaulk's avatar achaulk Committed by Commit bot

Single overlay test selector

Selects one on top overlay, if possible, from a main plane + single overlay combination

BUG=370522

Review URL: https://codereview.chromium.org/489193002

Cr-Commit-Position: refs/heads/master@{#291627}
parent 15a2a659
......@@ -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,
......
......@@ -34,6 +34,8 @@ class GbmSurfaceFactory : public DriSurfaceFactory {
virtual scoped_refptr<ui::NativePixmap> CreateNativePixmap(
gfx::Size size,
BufferFormat format) OVERRIDE;
virtual OverlayCandidatesOzone* GetOverlayCandidates(
gfx::AcceleratedWidget w) OVERRIDE;
virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
int plane_z_order,
gfx::OverlayTransform plane_transform,
......
......@@ -16,4 +16,8 @@ const char kOzoneDumpFile[] = "ozone-dump-file";
// mode there is no EGL surface.
const char kOzoneUseSurfaceless[] = "ozone-use-surfaceless";
// Enable support for a single overlay plane.
const char kOzoneTestSingleOverlaySupport[] =
"ozone-test-single-overlay-support";
} // namespace switches
......@@ -16,6 +16,8 @@ OZONE_EXPORT extern const char kOzoneDumpFile[];
OZONE_EXPORT extern const char kOzoneUseSurfaceless[];
OZONE_EXPORT extern const char kOzoneTestSingleOverlaySupport[];
} // namespace switches
#endif // UI_OZONE_PUBLIC_OZONE_SWITCHES_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment