Bug 1541145 - Use (1.0, 1.0, 1.0, 1.0) as clear clolor on android r=kats
authorsotaro <sotaro.ikeda.g@gmail.com>
Tue, 02 Apr 2019 19:51:16 +0000
changeset 467712 08cd2fdb32d453c8ab0990a7fddf847fc1f808f7
parent 467711 9ea2a2424ea54bc1d44e16382f330ae70919a01e
child 467713 82df33c088cd8548b0c8eb849d1b9f10d546f2d6
push id112658
push useraciure@mozilla.com
push dateThu, 04 Apr 2019 04:41:45 +0000
treeherdermozilla-inbound@a36718c8163e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1541145
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1541145 - Use (1.0, 1.0, 1.0, 1.0) as clear clolor on android r=kats wr_window_new() uses (0.0, 0.0, 0.0, 1.0) and (0.0, 0.0, 0.0, 0.0) as clear color. Then it makes rendering black until a content of webrender comes. By changing clear color to (1.0, 1.0, 1.0, 1.0), we could suppress black flashing. Differential Revision: https://phabricator.services.mozilla.com/D25832
gfx/webrender_bindings/src/bindings.rs
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -1140,17 +1140,16 @@ pub extern "C" fn wr_window_new(window_i
     };
 
     let gl;
     if unsafe { is_glcontext_egl(gl_context) } {
         gl = unsafe { gl::GlesFns::load_with(|symbol| get_proc_address(gl_context, symbol)) };
     } else {
         gl = unsafe { gl::GlFns::load_with(|symbol| get_proc_address(gl_context, symbol)) };
     }
-    gl.clear_color(0.0, 0.0, 0.0, 1.0);
 
     let version = gl.get_string(gl::VERSION);
 
     info!("WebRender - OpenGL version new {}", version);
 
     let workers = unsafe {
         Arc::clone(&(*thread_pool).0)
     };
@@ -1167,16 +1166,23 @@ pub extern "C" fn wr_window_new(window_i
         ShaderPrecacheFlags::empty()
     };
 
     let cached_programs = match program_cache {
         Some(program_cache) => Some(Rc::clone(&program_cache.rc_get())),
         None => None,
     };
 
+    let color = if cfg!(target_os = "android") {
+        // The color is for avoiding black flash before receiving display list.
+        ColorF::new(1.0, 1.0, 1.0, 1.0)
+    } else {
+        ColorF::new(0.0, 0.0, 0.0, 0.0)
+    };
+
     let opts = RendererOptions {
         enable_aa: true,
         enable_subpixel_aa: cfg!(not(target_os = "android")),
         support_low_priority_transactions,
         recorder: recorder,
         blob_image_handler: Some(Box::new(Moz2dBlobImageHandler::new(workers.clone()))),
         workers: Some(workers.clone()),
         thread_listener: Some(Box::new(GeckoProfilerThreadListener::new())),
@@ -1194,17 +1200,17 @@ pub extern "C" fn wr_window_new(window_i
                 }
             }
         },
         renderer_id: Some(window_id.0),
         upload_method,
         scene_builder_hooks: Some(Box::new(APZCallbacks::new(window_id))),
         sampler: Some(Box::new(SamplerCallback::new(window_id))),
         max_texture_size: Some(8192), // Moz2D doesn't like textures bigger than this
-        clear_color: Some(ColorF::new(0.0, 0.0, 0.0, 0.0)),
+        clear_color: Some(color),
         precache_flags,
         namespace_alloc_by_client: true,
         enable_picture_caching,
         allow_pixel_local_storage_support: false,
         ..Default::default()
     };
 
     // Ensure the WR profiler callbacks are hooked up to the Gecko profiler.