зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1715902 - Refuse WebRender on Linux if backed by software driver. r=jrmuizel
Reject software rasterizers on Linux (except Software WebRender) when trying to create full WebRender, unless WebRender was force enabled. Differential Revision: https://phabricator.services.mozilla.com/D117534
This commit is contained in:
Родитель
7af763acbe
Коммит
805d9ce3e3
|
@ -76,7 +76,8 @@ class gfxVarReceiver;
|
|||
_(UseAHardwareBufferSharedSurface, bool, false) \
|
||||
_(UseEGL, bool, false) \
|
||||
_(DrmRenderDevice, nsCString, nsCString()) \
|
||||
_(UseDMABuf, bool, false)
|
||||
_(UseDMABuf, bool, false) \
|
||||
_(WebRenderRequiresHardwareDriver, bool, false)
|
||||
|
||||
/* Add new entries above this line. */
|
||||
|
||||
|
|
|
@ -2673,6 +2673,15 @@ void gfxPlatform::InitWebRenderConfig() {
|
|||
bool hasSoftware = gfxConfig::IsEnabled(Feature::WEBRENDER_SOFTWARE);
|
||||
bool hasWebRender = hasHardware || hasSoftware;
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
// We require a hardware driver to back the GL context unless the user forced
|
||||
// on WebRender.
|
||||
if (!gfxConfig::IsForcedOnByUser(Feature::WEBRENDER) &&
|
||||
StaticPrefs::gfx_webrender_reject_software_driver_AtStartup()) {
|
||||
gfxVars::SetWebRenderRequiresHardwareDriver(true);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
if (gfxConfig::IsEnabled(Feature::WEBRENDER_ANGLE)) {
|
||||
gfxVars::SetUseWebRenderANGLE(hasWebRender);
|
||||
|
|
|
@ -167,7 +167,8 @@ class NewRenderer : public RendererEvent {
|
|||
compositor->ShouldDrawPreviousPartialPresentRegions(), mDocHandle,
|
||||
&wrRenderer, mMaxTextureSize, &errorMessage,
|
||||
StaticPrefs::gfx_webrender_enable_gpu_markers_AtStartup(),
|
||||
panic_on_gl_error, picTileWidth, picTileHeight)) {
|
||||
panic_on_gl_error, picTileWidth, picTileHeight,
|
||||
gfx::gfxVars::WebRenderRequiresHardwareDriver())) {
|
||||
// wr_window_new puts a message into gfxCriticalNote if it returns false
|
||||
MOZ_ASSERT(errorMessage);
|
||||
mError->AssignASCII(errorMessage);
|
||||
|
|
|
@ -1501,6 +1501,7 @@ pub extern "C" fn wr_window_new(
|
|||
panic_on_gl_error: bool,
|
||||
picture_tile_width: i32,
|
||||
picture_tile_height: i32,
|
||||
reject_software_rasterizer: bool,
|
||||
) -> bool {
|
||||
assert!(unsafe { is_in_render_thread() });
|
||||
|
||||
|
@ -1646,6 +1647,7 @@ pub extern "C" fn wr_window_new(
|
|||
panic_on_gl_error,
|
||||
picture_tile_size,
|
||||
texture_cache_config,
|
||||
reject_software_rasterizer,
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
|
|
@ -854,6 +854,7 @@ pub enum RendererError {
|
|||
Thread(std::io::Error),
|
||||
Resource(ResourceCacheError),
|
||||
MaxTextureSize,
|
||||
SoftwareRasterizer,
|
||||
}
|
||||
|
||||
impl From<ShaderError> for RendererError {
|
||||
|
@ -960,6 +961,13 @@ impl Renderer {
|
|||
max_internal_texture_size = max_internal_texture_size.min(internal_limit);
|
||||
}
|
||||
|
||||
if options.reject_software_rasterizer {
|
||||
let renderer_name_lc = device.get_capabilities().renderer_name.to_lowercase();
|
||||
if renderer_name_lc.contains("llvmpipe") || renderer_name_lc.contains("softpipe") || renderer_name_lc.contains("software rasterizer") {
|
||||
return Err(RendererError::SoftwareRasterizer);
|
||||
}
|
||||
}
|
||||
|
||||
let image_tiling_threshold = options.image_tiling_threshold
|
||||
.min(max_internal_texture_size);
|
||||
|
||||
|
@ -5363,6 +5371,9 @@ pub struct RendererOptions {
|
|||
/// If false, we'll duplicate the instance attributes per vertex and issue
|
||||
/// regular indexed draws instead.
|
||||
pub enable_instancing: bool,
|
||||
/// If true, we'll reject contexts backed by a software rasterizer, except
|
||||
/// Software WebRender.
|
||||
pub reject_software_rasterizer: bool,
|
||||
}
|
||||
|
||||
impl RendererOptions {
|
||||
|
@ -5429,6 +5440,7 @@ impl Default for RendererOptions {
|
|||
// Disabling instancing means more vertex data to upload and potentially
|
||||
// process by the vertex shaders.
|
||||
enable_instancing: true,
|
||||
reject_software_rasterizer: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4940,6 +4940,13 @@
|
|||
value: false
|
||||
mirror: once
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
- name: gfx.webrender.reject-software-driver
|
||||
type: bool
|
||||
value: true
|
||||
mirror: once
|
||||
#endif
|
||||
|
||||
- name: gfx.webrender.highlight-painted-layers
|
||||
type: RelaxedAtomicBool
|
||||
value: false
|
||||
|
|
Загрузка…
Ссылка в новой задаче