Bug 102999

Summary: [BISECTED,REGRESSION] Failing Android EGL dEQP with RGBA configs
Product: Mesa Reporter: Tapani Pälli <lemody>
Component: Drivers/DRI/i965Assignee: Jason Ekstrand <jason>
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium CC: chadversary
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 94448    
Attachments: hacky patch
hopeful fix

Description Tapani Pälli 2017-09-26 11:21:37 UTC
following tests fail:

dEQP-EGL.functional.color_clears.multi_context.gles1#rgba8888_window
dEQP-EGL.functional.color_clears.multi_context.gles1_gles2#rgba8888_window
dEQP-EGL.functional.color_clears.multi_context.gles1_gles2_gles3#rgba8888_window
dEQP-EGL.functional.color_clears.multi_context.gles2#rgba8888_window
dEQP-EGL.functional.color_clears.multi_context.gles3#rgba8888_window
dEQP-EGL.functional.color_clears.multi_thread.gles1#rgba8888_window
dEQP-EGL.functional.color_clears.multi_thread.gles1_gles2#rgba8888_window
dEQP-EGL.functional.color_clears.multi_thread.gles1_gles2_gles3#rgba8888_window
dEQP-EGL.functional.color_clears.multi_thread.gles2#rgba8888_window
dEQP-EGL.functional.color_clears.multi_thread.gles3#rgba8888_window
dEQP-EGL.functional.color_clears.single_context.gles1#rgba8888_window
dEQP-EGL.functional.color_clears.single_context.gles2#rgba8888_window
dEQP-EGL.functional.color_clears.single_context.gles3#rgba8888_window
dEQP-EGL.functional.render.multi_context.gles2#rgba8888_window
dEQP-EGL.functional.render.multi_context.gles2_gles3#rgba8888_window
dEQP-EGL.functional.render.multi_context.gles3#rgba8888_window
dEQP-EGL.functional.render.multi_thread.gles2#rgba8888_window
dEQP-EGL.functional.render.multi_thread.gles2_gles3#rgba8888_window
dEQP-EGL.functional.render.multi_thread.gles3#rgba8888_window
dEQP-EGL.functional.render.single_context.gles2#rgba8888_window
dEQP-EGL.functional.render.single_context.gles3#rgba8888_window
Comment 1 Tapani Pälli 2017-09-26 11:22:49 UTC
bisected to following commit:
-----------------------------

commit b3a44ae7a4168677ae855563d80723895e87966b
Author: Jason Ekstrand <jason.ekstrand@intel.com>
Date:   Fri Jun 16 10:28:39 2017 -0700

    i965: Use create_for_dri_image in intel_update_image_buffer
    
    Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
    Reviewed-by: Chad Versace <chadversary@chromium.org>
Comment 2 Tapani Pälli 2017-09-26 11:23:43 UTC
Reason for failures is because DRI image and renderbuffer disagree on the format (rgba vs bgra) and rendering ends up using incorrect channel write masks. We should somehow use format from rb instead of DRI. Any suggestions how to fix this?
Comment 3 Tapani Pälli 2017-09-26 11:39:58 UTC
(In reply to Tapani Pälli from comment #2)
> Reason for failures is because DRI image and renderbuffer disagree on the
> format (rgba vs bgra) and rendering ends up using incorrect channel write
> masks. We should somehow use format from rb instead of DRI. Any suggestions
> how to fix this?

Disclaimer! Above is bit of a guess game but because old method works then it seems it is like this, old method works and uses format that rb has.
Comment 4 Tapani Pälli 2017-09-28 06:50:12 UTC
I have a somewhat dirty workaround for this, I'll try to come up with a clean fix.
Comment 5 Tapani Pälli 2017-09-28 08:37:13 UTC
Created attachment 134525 [details] [review]
hacky patch

This is a hack but the main attempt is to show what the issue is. __DRIimage and renderbuffer format do not agree, there are at least 2 cases. One is when we have rgbx vs rgba (this is ok and handled by format fallback later) but then there is rgba vs bgra that the patch 'fixes'.
Comment 6 Tapani Pälli 2017-10-04 12:06:32 UTC
Created attachment 134660 [details] [review]
hopeful fix

Here's better patch, will do final testing and send to list.
Comment 7 Tapani Pälli 2017-10-06 05:47:14 UTC
commit 03516382844c4513a68b8e0b6ef4a0040385906a
Author: Tapani Pälli <tapani.palli@intel.com>
Date:   Wed Oct 4 16:32:05 2017 +0300

    i965: pass wanted format to intel_miptree_create_for_dri_image
    
    Change b3a44ae7a4 caused regressions on Android where DRI and renderbuffer
    can disagree on the format being used. This patch removes the colorspace
    parameter and instead we pass renderbuffer format. For non-winsys images we
    still do srgb/linear modification in same manner as change b3a44ae7a4 wanted
    but take format from renderbuffer instead of DRI image.
    
    This patch fixes regressions seen with following test sets:
    
       dEQP-EGL.functional.color_clears*
       dEQP-EGL.functional.render*
    
    Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102999
    Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.