Bug 40864

Summary: [bisected pineview] oglc pxconv-gettex(basic.allCases) fails on pineview
Product: Mesa Reporter: fangxun <xunx.fang>
Component: Drivers/DRI/i915Assignee: Anuj Phogat <anuj.phogat>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: high CC: brianp
Version: git   
Hardware: All   
OS: Linux (All)   
Whiteboard:
Bug Depends on:    
Bug Blocks: 42993    
Attachments: SNB oglc test pxconv-gettex failures
SNB oglc test pxstore-gettex failures
SNB oglc test pxtrans-gettex failures
SNB pxstore-gettex error log after patch

Description fangxun 2011-09-14 02:17:38 UTC
System Environment:
--------------------------
Arch:           i386
Platform:       pineview 
Libdrm:         (master)2.4.26-3-g2acaf160df584a5ef7b5c5b84819389948cd97ad
Mesa:           (master)f97acf40155a5d63a70ac6875df8128cb91d2369
Xserver:         (master)xorg-server-1.11.0
Xf86_video_intel:   (master)2.16.0-45-g6b1ed58d63e9ac80d7d028fa3036633436154816
Kernel_unstable:  (drm-intel-next)c6a389f123b9f68d605bb7e0f9b32ec1e3e14132

Bug detailed description:
------------------------- 
Oglc pxstore-gettex(basic.allCases) and pxtrans-gettex(basic.allCases) also fail on pineview due to the same commit. 
Bisect find c1b3faefc06ef6dfc9b0eb226f0a0af4dd6c6c9d is the first bad commit.
commit c1b3faefc06ef6dfc9b0eb226f0a0af4dd6c6c9d
Author: Brian Paul <brianp@vmware.com>
Date:   Thu Sep 8 20:16:18 2011 -0600

    mesa: handle compressed images in get_tex_rgba()

    Uses the new _mesa_decompress_image() function.  Unlike the meta path
    that uses textured quad rendering to do decompression, this works with
    signed formats as well.

Reproduce steps:
----------------
1. start X
2. ./oglconform -z -s -suite all -v 2 -D 115 -test pxconv-gettex basic.allCases
Comment 1 Anuj Phogat 2012-01-18 18:14:21 UTC
Reproduced the issue on Sandybridge with mesa master at commit dcdfd19. Reverted the master past bisected commit (c1b3fae) But the issue still exist at commit 3370ba802ff93fde399c9b07303a71ab0827e217. So this bisect seems incorrect to me.
Comment 2 Anuj Phogat 2012-01-20 15:18:04 UTC
Created attachment 55875 [details]
SNB oglc test pxconv-gettex failures
Comment 3 Anuj Phogat 2012-01-20 15:19:08 UTC
Created attachment 55876 [details]
SNB oglc test pxstore-gettex failures
Comment 4 Anuj Phogat 2012-01-20 15:20:05 UTC
Created attachment 55877 [details]
SNB oglc test pxtrans-gettex failures
Comment 5 Anuj Phogat 2012-01-20 17:08:42 UTC
These oglc tests compute the expected color values by clamping them to [0, 1]. But, in mesa driver clamping doesn't apply to glGetTexImage() except if the returned type of the image can't hold negative values. This looks like a valid behavior.   

Test case expects clamped color values as shown in below error log which doesn't match with unclamped values returned by driver: 
texFormat->str = GL_RG
PixelConvertCompareRead ERROR:    Test failed with format GL_LUMINANCE and type GL_FLOAT, generated color (0.215, 1.000, 0.691, 0.000).
Read back {1.216}. Expected {1.000}.

please look at the attachments for detailed error logs.

Most of these failures on Sandybridge are due incorrect assumptions made in the test case, not in mesa driver. I'll update above comments if i find something which contradicts my investigations.
Comment 6 Anuj Phogat 2012-01-27 16:32:44 UTC
Following commit fixes pxconv-gettex and pxtrans-gettex test cases:

commit 5665b5cc31da70e833f80e7a17bfa034d2f7ba44
Author: Anuj Phogat <anuj.phogat@gmail.com>
Date:   Tue Jan 24 20:06:27 2012 -0800

    mesa: set clamp bit in glGetTexImage for GL_UNSIGNED_NORMALIZED
    
    Color clamping should be enabled in glGetTexImage if texture dataType is
    GL_UNSIGNED_NORMALIZED and format is GL_LUMINANCE or GL_LUMINANCE_ALPHA
    
    Fixes 2 Intel oglconform test cases: pxconv-gettex and pxtrans-gettex
    https://bugs.freedesktop.org/show_bug.cgi?id=40864
    
    NOTE: This is a candidate for the 8.0 branch
    
    Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>

Here is the link for patch:
http://comments.gmane.org/gmane.comp.video.mesa3d.devel/36690
Comment 7 Anuj Phogat 2012-01-27 16:38:01 UTC
Created attachment 56247 [details]
SNB pxstore-gettex error log after patch

pxstore-gettex still fails on SNB. Above patch pushed on mesa reduces the number of failures in this testcase.
Comment 8 Ian Romanick 2012-02-02 10:59:45 UTC
Fixed on 8.0 branch by:

commit 736f1e53e4f08e9c56ce6480695f5de0f2caa982
Author: Anuj Phogat <anuj.phogat@gmail.com>
Date:   Tue Jan 24 20:06:27 2012 -0800

    mesa: set clamp bit in glGetTexImage for GL_UNSIGNED_NORMALIZED
    
    Color clamping should be enabled in glGetTexImage if texture dataType is
    GL_UNSIGNED_NORMALIZED and format is GL_LUMINANCE or GL_LUMINANCE_ALPHA
    
    Fixes 2 Intel oglconform test cases: pxconv-gettex and pxtrans-gettex
    https://bugs.freedesktop.org/show_bug.cgi?id=40864
    
    NOTE: This is a candidate for the 8.0 branch
    
    Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>
    (cherry picked from commit 5665b5cc31da70e833f80e7a17bfa034d2f7ba44)
Comment 9 Anuj Phogat 2012-02-03 16:57:55 UTC
pxstore-gettex failures on mesa master:

ce62473408f884c876ee535f5f48cfe70dacb1ef is the first bad commit
commit ce62473408f884c876ee535f5f48cfe70dacb1ef
Author: Brian Paul <brianp@vmware.com>
Date:   Sun Jul 31 21:00:21 2011 -0700

    mesa: Finally, convert RGBA glGetTexImage() to using MapTextureImage().
        
    v2: Changes by Brian to MapTexImage in the decompression path.
    v3: Changes by anholt to fix srcRowStride for decompression of NPOT.
                    
    Tested-by: Brian Paul <brianp@vmware.com> (v2)
Comment 10 Anuj Phogat 2012-02-14 10:39:12 UTC
failures in pxstore-gettex has been resolved by following commit on mesa master:

commit 40427025916e003cfd380c2e30df78ad2bc8fe10
Author: Anuj Phogat <anuj.phogat@gmail.com>
Date:   Fri Feb 10 16:27:19 2012 -0800

    meta: Add pixel store/pack operations in decompress_texture_image
    
    This patch adds the pixel store operations in decompress_texture_image().
    decompress_texture_image() is used in glGetTexImage() for compressed
    textures with unsigned, normalized values.
    
    It also fixes the failures in intel oglconform pxstore-gettex due to
    following sub test cases:
    
     - Test all mipmaps with byte swapping enabled
     - Test all small mipmaps with all allowable alignment values
     - Test subimage packing for all mipmap levels
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40864
    
    Note: This is a candidate for stable branches
    
    Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>
Comment 11 Anuj Phogat 2012-02-14 10:42:47 UTC
Here is the link to the patch posted on mailing list:
http://www.mail-archive.com/mesa-dev@lists.freedesktop.org/msg18614.html
Comment 12 fangxun 2012-11-14 03:02:41 UTC
Note it fails due to new issue, and is tracked in bug 47720.
Comment 13 fangxun 2012-11-14 03:04:03 UTC
(In reply to comment #12)
> Note it fails due to new issue, and is tracked in bug 47720.

bug 47220