Skip to content

Commit

Permalink
Remove references to old display-level robust resource init extension.
Browse files Browse the repository at this point in the history
Remove the passthrough command decoder flag from the gl layer.

BUG=angleproject:1635
BUG=602688

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Ie32bbce062f5ed3a5480fb06f7f283e895c97157
Reviewed-on: https://chromium-review.googlesource.com/703634
Reviewed-by: Antoine Labour <piman@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#508535}
  • Loading branch information
vonture authored and Commit Bot committed Oct 12, 2017
1 parent bc4f798 commit d72f1e9
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 63 deletions.
4 changes: 2 additions & 2 deletions content/public/browser/gpu_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/command_buffer/service/service_utils.h"
#include "gpu/config/gpu_switches.h"
#include "media/media_features.h"
#include "ui/gl/gl_switches.h"
#include "ui/gl/gl_utils.h"

namespace {

Expand Down Expand Up @@ -125,7 +125,7 @@ const gpu::GpuPreferences GetGpuPreferencesFromCommandLine() {
gpu_preferences.enable_gpu_service_tracing =
command_line->HasSwitch(switches::kEnableGPUServiceTracing);
gpu_preferences.use_passthrough_cmd_decoder =
gl::UsePassthroughCommandDecoder(command_line);
gpu::gles2::UsePassthroughCommandDecoder(command_line);
// Some of these preferences are set or adjusted in
// GpuDataManagerImplPrivate::AppendGpuCommandLine.
return gpu_preferences;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "gpu/command_buffer/common/gles2_cmd_format.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/service/context_group.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "gpu/command_buffer/service/logger.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/program_manager.h"
Expand Down
4 changes: 4 additions & 0 deletions gpu/command_buffer/service/gpu_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,8 @@ const char kGLShaderIntermOutput[] = "gl-shader-interm-output";
// round intermediate values in ANGLE.
const char kEmulateShaderPrecision[] = "emulate-shader-precision";

// Use the Pass-through command decoder, skipping all validation and state
// tracking.
const char kUsePassthroughCmdDecoder[] = "use-passthrough-cmd-decoder";

} // namespace switches
1 change: 1 addition & 0 deletions gpu/command_buffer/service/gpu_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ GPU_EXPORT extern const char kDisableGpuShaderDiskCache[];
GPU_EXPORT extern const char kEnableThreadedTextureMailboxes[];
GPU_EXPORT extern const char kGLShaderIntermOutput[];
GPU_EXPORT extern const char kEmulateShaderPrecision[];
GPU_EXPORT extern const char kUsePassthroughCmdDecoder[];

} // namespace switches

Expand Down
8 changes: 6 additions & 2 deletions gpu/command_buffer/service/service_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "base/command_line.h"
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/service/context_group.h"
#include "gpu/command_buffer/service/gpu_switches.h"
#include "ui/gl/gl_switches.h"

#if defined(USE_EGL)
Expand Down Expand Up @@ -57,14 +58,17 @@ gl::GLContextAttribs GenerateGLContextAttribs(
return attribs;
}

bool UsePassthroughCommandDecoder(const base::CommandLine* command_line) {
return command_line->HasSwitch(switches::kUsePassthroughCmdDecoder);
}

bool PassthroughCommandDecoderSupported() {
#if defined(USE_EGL)
// Using the passthrough command buffer requires that specific ANGLE
// extensions are exposed
return gl::GLSurfaceEGL::IsCreateContextBindGeneratesResourceSupported() &&
gl::GLSurfaceEGL::IsCreateContextWebGLCompatabilitySupported() &&
(gl::GLSurfaceEGL::IsRobustResourceInitSupported() ||
gl::GLSurfaceEGL::IsDisplayRobustResourceInitSupported()) &&
gl::GLSurfaceEGL::IsRobustResourceInitSupported() &&
gl::GLSurfaceEGL::IsDisplayTextureShareGroupSupported() &&
gl::GLSurfaceEGL::IsCreateContextClientArraysSupported();
#else
Expand Down
5 changes: 5 additions & 0 deletions gpu/command_buffer/service/service_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#ifndef GPU_COMMAND_BUFFER_SERVICE_SERVICE_UTILS_H_
#define GPU_COMMAND_BUFFER_SERVICE_SERVICE_UTILS_H_

#include "base/command_line.h"
#include "gpu/gpu_export.h"
#include "ui/gl/gl_context.h"

Expand All @@ -18,6 +19,10 @@ GPU_EXPORT gl::GLContextAttribs GenerateGLContextAttribs(
const ContextCreationAttribHelper& attribs_helper,
const ContextGroup* context_group);

// Returns true if the passthrough command decoder has been requested
GPU_EXPORT bool UsePassthroughCommandDecoder(
const base::CommandLine* command_line);

// Returns true if the driver supports creating passthrough command decoders
GPU_EXPORT bool PassthroughCommandDecoderSupported();

Expand Down
3 changes: 1 addition & 2 deletions gpu/command_buffer/tests/gl_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include "ui/gl/gl_image_ref_counted_memory.h"
#include "ui/gl/gl_share_group.h"
#include "ui/gl/gl_surface.h"
#include "ui/gl/gl_utils.h"
#include "ui/gl/init/gl_factory.h"

#if defined(OS_MACOSX)
Expand All @@ -57,7 +56,7 @@ void InitializeGpuPreferencesForTestingFromCommandLine(
GpuPreferences* preferences) {
// Only initialize specific GpuPreferences members used for testing.
preferences->use_passthrough_cmd_decoder =
gl::UsePassthroughCommandDecoder(&command_line);
gles2::UsePassthroughCommandDecoder(&command_line);
}

class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
Expand Down
2 changes: 1 addition & 1 deletion gpu/ipc/service/gpu_init.cc
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line) {
gpu_info_.sandboxed);

gpu_info_.passthrough_cmd_decoder =
gl::UsePassthroughCommandDecoder(command_line) &&
gles2::UsePassthroughCommandDecoder(command_line) &&
gles2::PassthroughCommandDecoderSupported();

init_successful_ = true;
Expand Down
4 changes: 2 additions & 2 deletions ui/gl/gl_context_egl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ bool GLContextEGL::Initialize(GLSurface* compatible_surface,
context_attributes.push_back(EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE);
context_attributes.push_back(
attribs.robust_resource_initialization ? EGL_TRUE : EGL_FALSE);
} else if (attribs.robust_resource_initialization) {
DCHECK(GLSurfaceEGL::IsDisplayRobustResourceInitSupported());
} else {
DCHECK(!attribs.robust_resource_initialization);
}

// Append final EGL_NONE to signal the context attributes are finished
Expand Down
49 changes: 11 additions & 38 deletions ui/gl/gl_surface_egl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ bool g_egl_context_priority_supported = false;
bool g_egl_khr_colorspace = false;
bool g_egl_ext_colorspace_display_p3 = false;
bool g_use_direct_composition = false;
bool g_egl_display_robust_resource_init_supported = false;
bool g_egl_robust_resource_init_supported = false;
bool g_egl_display_texture_share_group_supported = false;
bool g_egl_create_context_client_arrays_supported = false;
Expand Down Expand Up @@ -205,8 +204,7 @@ class EGLSyncControlVSyncProvider : public SyncControlVSyncProvider {

EGLDisplay GetPlatformANGLEDisplay(EGLNativeDisplayType native_display,
EGLenum platform_type,
bool warpDevice,
bool robustResourceInit) {
bool warpDevice) {
std::vector<EGLint> display_attribs;

display_attribs.push_back(EGL_PLATFORM_ANGLE_TYPE_ANGLE);
Expand All @@ -217,11 +215,6 @@ EGLDisplay GetPlatformANGLEDisplay(EGLNativeDisplayType native_display,
display_attribs.push_back(EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE);
}

if (robustResourceInit) {
display_attribs.push_back(EGL_DISPLAY_ROBUST_RESOURCE_INITIALIZATION_ANGLE);
display_attribs.push_back(EGL_TRUE);
}

#if defined(USE_X11)
// ANGLE_NULL doesn't use the visual, and may run without X11 where we can't
// get it anyway.
Expand All @@ -242,32 +235,26 @@ EGLDisplay GetPlatformANGLEDisplay(EGLNativeDisplayType native_display,
}

EGLDisplay GetDisplayFromType(DisplayType display_type,
EGLNativeDisplayType native_display,
bool robustResourceInit) {
EGLNativeDisplayType native_display) {
switch (display_type) {
case DEFAULT:
case SWIFT_SHADER:
return eglGetDisplay(native_display);
case ANGLE_D3D9:
return GetPlatformANGLEDisplay(native_display,
EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE, false,
robustResourceInit);
EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE, false);
case ANGLE_D3D11:
return GetPlatformANGLEDisplay(native_display,
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, false,
robustResourceInit);
return GetPlatformANGLEDisplay(
native_display, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, false);
case ANGLE_OPENGL:
return GetPlatformANGLEDisplay(native_display,
EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE,
false, robustResourceInit);
return GetPlatformANGLEDisplay(
native_display, EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE, false);
case ANGLE_OPENGLES:
return GetPlatformANGLEDisplay(native_display,
EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE,
false, robustResourceInit);
return GetPlatformANGLEDisplay(
native_display, EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE, false);
case ANGLE_NULL:
return GetPlatformANGLEDisplay(native_display,
EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE, false,
robustResourceInit);
EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE, false);
default:
NOTREACHED();
return EGL_NO_DISPLAY;
Expand Down Expand Up @@ -660,7 +647,6 @@ void GLSurfaceEGL::ShutdownOneOff() {
g_egl_surface_orientation_supported = false;
g_use_direct_composition = false;
g_egl_surfaceless_context_supported = false;
g_egl_display_robust_resource_init_supported = false;
g_egl_robust_resource_init_supported = false;
g_egl_display_texture_share_group_supported = false;
g_egl_create_context_client_arrays_supported = false;
Expand Down Expand Up @@ -716,10 +702,6 @@ bool GLSurfaceEGL::IsDirectCompositionSupported() {
return g_use_direct_composition;
}

bool GLSurfaceEGL::IsDisplayRobustResourceInitSupported() {
return g_egl_display_robust_resource_init_supported;
}

bool GLSurfaceEGL::IsRobustResourceInitSupported() {
return g_egl_robust_resource_init_supported;
}
Expand Down Expand Up @@ -764,23 +746,14 @@ EGLDisplay GLSurfaceEGL::InitializeDisplay(
ExtensionsContain(client_extensions, "EGL_ANGLE_platform_angle_null");
}

g_egl_display_robust_resource_init_supported =
client_extensions &&
ExtensionsContain(client_extensions,
"EGL_ANGLE_display_robust_resource_initialization");
bool use_robust_resource_init =
g_egl_display_robust_resource_init_supported &&
UsePassthroughCommandDecoder(base::CommandLine::ForCurrentProcess());

std::vector<DisplayType> init_displays;
GetEGLInitDisplays(supports_angle_d3d, supports_angle_opengl,
supports_angle_null,
base::CommandLine::ForCurrentProcess(), &init_displays);

for (size_t disp_index = 0; disp_index < init_displays.size(); ++disp_index) {
DisplayType display_type = init_displays[disp_index];
EGLDisplay display = GetDisplayFromType(display_type, g_native_display,
use_robust_resource_init);
EGLDisplay display = GetDisplayFromType(display_type, g_native_display);
if (display == EGL_NO_DISPLAY) {
LOG(ERROR) << "EGL display query failed with error "
<< GetLastEGLErrorString();
Expand Down
1 change: 0 additions & 1 deletion ui/gl/gl_surface_egl.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ class GL_EXPORT GLSurfaceEGL : public GLSurface {
static bool IsEGLSurfacelessContextSupported();
static bool IsEGLContextPrioritySupported();
static bool IsDirectCompositionSupported();
static bool IsDisplayRobustResourceInitSupported();
static bool IsRobustResourceInitSupported();
static bool IsDisplayTextureShareGroupSupported();
static bool IsCreateContextClientArraysSupported();
Expand Down
4 changes: 0 additions & 4 deletions ui/gl/gl_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,6 @@ const char kEnableDirectCompositionLayers[] =
const char kDisableDirectCompositionLayers[] =
"disable-direct-composition-layers";

// Use the Pass-through command decoder, skipping all validation and state
// tracking.
const char kUsePassthroughCmdDecoder[] = "use-passthrough-cmd-decoder";

// This is the list of switches passed from this file that are passed from the
// GpuProcessHost to the GPU Process. Add your switch to this list if you need
Expand All @@ -130,7 +127,6 @@ const char* const kGLSwitchesCopiedFromGpuProcessHost[] = {
kEnableSwapBuffersWithBounds,
kEnableDirectCompositionLayers,
kDisableDirectCompositionLayers,
kUsePassthroughCmdDecoder,
};
const int kGLSwitchesCopiedFromGpuProcessHostNumSwitches =
arraysize(kGLSwitchesCopiedFromGpuProcessHost);
Expand Down
2 changes: 0 additions & 2 deletions ui/gl/gl_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ GL_EXPORT extern const char kEnableSwapBuffersWithBounds[];
GL_EXPORT extern const char kEnableDirectCompositionLayers[];
GL_EXPORT extern const char kDisableDirectCompositionLayers[];

GL_EXPORT extern const char kUsePassthroughCmdDecoder[];

// These flags are used by the test harness code, not passed in by users.
GL_EXPORT extern const char kDisableGLDrawingForTests[];
GL_EXPORT extern const char kOverrideUseSoftwareGLForTests[];
Expand Down
5 changes: 0 additions & 5 deletions ui/gl/gl_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@

#include "ui/gfx/color_space.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_switches.h"

namespace gl {

bool UsePassthroughCommandDecoder(const base::CommandLine* command_line) {
return command_line->HasSwitch(switches::kUsePassthroughCmdDecoder);
}

int GetGLColorSpace(const gfx::ColorSpace& color_space) {
if (color_space == gfx::ColorSpace::CreateSCRGBLinear())
return GL_COLOR_SPACE_SCRGB_LINEAR_CHROMIUM;
Expand Down
4 changes: 0 additions & 4 deletions ui/gl/gl_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@
#ifndef UI_GL_GL_UTILS_H_
#define UI_GL_GL_UTILS_H_

#include "base/command_line.h"
#include "ui/gl/gl_export.h"

namespace gfx {
class ColorSpace;
} // namespace gfx

namespace gl {
GL_EXPORT bool UsePassthroughCommandDecoder(
const base::CommandLine* command_line);

GL_EXPORT int GetGLColorSpace(const gfx::ColorSpace& color_space);
} // namespace gl

Expand Down

0 comments on commit d72f1e9

Please sign in to comment.