Commit dd52d1ea authored by achaulk@chromium.org's avatar achaulk@chromium.org

Add a new ozone switch to enable surfaceless output mode.

This is an output surface that displays the content using
overlays and render-to-FBO, instead of the usual system-managed
framebuffer. Implementation to follow in another CL.

BUG=380861
TBR=stevenjb

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

Cr-Commit-Position: refs/heads/master@{#290072}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290072 0039d316-1c4b-4281-b951-d872f2087c98
parent dc28cb11
......@@ -157,6 +157,7 @@ std::string DeriveCommandLine(const GURL& start_url,
::switches::kDisableVaapiAcceleratedVideoEncode,
#if defined(USE_OZONE)
::switches::kOzonePlatform,
::switches::kOzoneUseSurfaceless,
#endif
app_list::switches::kDisableSyncAppList,
app_list::switches::kEnableSyncAppList,
......
......@@ -868,6 +868,7 @@ bool GpuProcessHost::LaunchGpuProcess(const std::string& channel_id) {
#endif
#if defined(USE_OZONE)
switches::kOzonePlatform,
switches::kOzoneUseSurfaceless,
#endif
#if defined(USE_X11) && !defined(OS_CHROMEOS)
switches::kX11Display,
......
......@@ -97,19 +97,21 @@ scoped_ptr<SurfaceOzoneEGL> GbmSurfaceFactory::CreateEGLSurfaceForWidget(
DCHECK(state_ == INITIALIZED);
ResetCursor(widget);
if (allow_surfaceless_) {
return scoped_ptr<SurfaceOzoneEGL>(
new GbmSurfaceless(screen_manager_->GetDisplayController(widget)));
} else {
scoped_ptr<GbmSurface> surface(
new GbmSurface(screen_manager_->GetDisplayController(widget),
device_,
drm_));
if (!surface->Initialize())
return scoped_ptr<SurfaceOzoneEGL>();
return surface.PassAs<SurfaceOzoneEGL>();
}
scoped_ptr<GbmSurface> surface(new GbmSurface(
screen_manager_->GetDisplayController(widget), device_, drm_));
if (!surface->Initialize())
return scoped_ptr<SurfaceOzoneEGL>();
return surface.PassAs<SurfaceOzoneEGL>();
}
scoped_ptr<SurfaceOzoneEGL>
GbmSurfaceFactory::CreateSurfacelessEGLSurfaceForWidget(
gfx::AcceleratedWidget widget) {
if (!allow_surfaceless_)
return scoped_ptr<SurfaceOzoneEGL>();
return scoped_ptr<SurfaceOzoneEGL>(
new GbmSurfaceless(screen_manager_->GetDisplayController(widget)));
}
scoped_refptr<ui::NativePixmap> GbmSurfaceFactory::CreateNativePixmap(
......
......@@ -29,6 +29,8 @@ class GbmSurfaceFactory : public DriSurfaceFactory {
SetGLGetProcAddressProcCallback set_gl_get_proc_address) OVERRIDE;
virtual scoped_ptr<ui::SurfaceOzoneEGL> CreateEGLSurfaceForWidget(
gfx::AcceleratedWidget w) OVERRIDE;
virtual scoped_ptr<SurfaceOzoneEGL> CreateSurfacelessEGLSurfaceForWidget(
gfx::AcceleratedWidget widget) OVERRIDE;
virtual scoped_refptr<ui::NativePixmap> CreateNativePixmap(
gfx::Size size,
BufferFormat format) OVERRIDE;
......
......@@ -9,6 +9,7 @@
#include <stdlib.h>
#include "base/at_exit.h"
#include "base/command_line.h"
#include "ui/events/ozone/device/device_manager.h"
#include "ui/events/ozone/evdev/event_factory_evdev.h"
#include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h"
......@@ -26,6 +27,7 @@
#include "ui/ozone/public/gpu_platform_support.h"
#include "ui/ozone/public/gpu_platform_support_host.h"
#include "ui/ozone/public/ozone_platform.h"
#include "ui/ozone/public/ozone_switches.h"
#if defined(OS_CHROMEOS)
#include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h"
......@@ -173,10 +175,8 @@ class OzonePlatformGbm : public OzonePlatform {
} // namespace
OzonePlatform* CreateOzonePlatformGbm() {
return new OzonePlatformGbm(false);
}
OzonePlatform* CreateOzonePlatformGbmEglImage() {
return new OzonePlatformGbm(true);
CommandLine* cmd = CommandLine::ForCurrentProcess();
return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless));
}
} // namespace ui
......@@ -12,4 +12,8 @@ const char kOzonePlatform[] = "ozone-platform";
// Specify location for image dumps.
const char kOzoneDumpFile[] = "ozone-dump-file";
// Specify if the accelerated path should use surfaceless rendering. In this
// mode there is no EGL surface.
const char kOzoneUseSurfaceless[] = "ozone-use-surfaceless";
} // namespace switches
......@@ -14,6 +14,8 @@ OZONE_EXPORT extern const char kOzonePlatform[];
OZONE_EXPORT extern const char kOzoneDumpFile[];
OZONE_EXPORT extern const char kOzoneUseSurfaceless[];
} // namespace switches
#endif // UI_OZONE_PUBLIC_OZONE_SWITCHES_H_
......@@ -41,6 +41,13 @@ scoped_ptr<SurfaceOzoneEGL> SurfaceFactoryOzone::CreateEGLSurfaceForWidget(
return scoped_ptr<SurfaceOzoneEGL>();
}
scoped_ptr<SurfaceOzoneEGL>
SurfaceFactoryOzone::CreateSurfacelessEGLSurfaceForWidget(
gfx::AcceleratedWidget widget) {
NOTIMPLEMENTED();
return scoped_ptr<SurfaceOzoneCanvas>();
}
scoped_ptr<SurfaceOzoneCanvas> SurfaceFactoryOzone::CreateCanvasForWidget(
gfx::AcceleratedWidget widget) {
NOTIMPLEMENTED();
......
......@@ -90,6 +90,12 @@ class OZONE_BASE_EXPORT SurfaceFactoryOzone {
virtual scoped_ptr<SurfaceOzoneEGL> CreateEGLSurfaceForWidget(
gfx::AcceleratedWidget widget);
// Create an EGL surface that isn't backed by any buffers, and is used
// for overlay-only displays. This will return NULL if this mode is
// not supported.
virtual scoped_ptr<SurfaceOzoneEGL> CreateSurfacelessEGLSurfaceForWidget(
gfx::AcceleratedWidget widget);
// Create SurfaceOzoneCanvas for the specified gfx::AcceleratedWidget.
//
// Note: The platform must support creation of SurfaceOzoneCanvas from the
......
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