Bug 59495

Summary: [i965 Bisected]Oglc fbblit(advanced.blitFb-3d-cube.mirror.both) fails
Product: Mesa Reporter: lu hua <huax.lu>
Component: Drivers/DRI/i965Assignee: Anuj Phogat <anuj.phogat>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: high CC: idr, xunx.fang
Version: unspecified   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: output

Description lu hua 2013-01-17 03:09:54 UTC
Created attachment 73176 [details]
output

System Environment:
--------------------------
Arch:           x86_64
Platform:       Ivybridge
Libdrm:		(master)libdrm-2.4.40-13-g9e6f96a579fc2ed241e9a31a35a5995129ee8f7a
Mesa:       (master)56c01d81094795286828ecb83713e043695e905a 
Xserver:(master)xorg-server-1.13.99.901-2-g6703a7c7cf1a349c137e247a0c8eb462ff7b07be
Xf86_video_intel: (master)2.20.17-88-g2113f7f440dd2f10e80f0bb3bd5cd155f7e19098
Cairo:	(master)1dfea39841fc6d545e45420b1999239f29556c05
Libva:	(staging)21649988d6b532cc96f633db017d1e4369f640e9
Libva_intel_driver:(staging)788e99361208127763fdf1e146e63fca03a09f67
Kernel:	(drm-intel-nightly) 644e43935a4b9a61460fa4bf449b79032556fb90

Bug detailed description:
-------------------------
It fails on ironlake, sandybridge, ivybridge and haswell with mesa master branch. It works well on mesa 9.0 branch.
Following cases also fail, and have same bisect commit:
fbblit(advanced.blitFb-3d-cube.mirror.horizontal)
fbblit(advanced.blitFb-3d-cube.mirror.negated)
fbblit(advanced.blitFb-3d-cube.mirror.vertical)

case fbblit(negative.nullblit.zeroSize) core dumped and has same bisect commit.

Bisect shows: 0c535ae7fc703e10c1df7a108e8704263d7b75d3 is the first bad commit.
commit 0c535ae7fc703e10c1df7a108e8704263d7b75d3
Author:     Anuj Phogat <anuj.phogat@gmail.com>
AuthorDate: Wed Nov 28 12:55:55 2012 -0800
Commit:     Ian Romanick <ian.d.romanick@intel.com>
CommitDate: Tue Jan 15 15:08:38 2013 -0800

    meta: Add functionality to do _mesa_meta_BlitFrameBuffer() using glsl

    This patch rewrites _mesa_meta_BlitFrameBuffer() function to add support
    for blitting with GLSL/GLSL ES shaders. These changes were required to
    support glBlitFrameBuffer() in gles3. This patch, along with other
    patches in this series, make 16 failing framebuffer_blit test cases in
    gles3 conformance pass.

    V2: Properly handle flipped blits for source and destination
        renderbuffer / textures. Add support for GL_TEXTURE_RECTANGLE in
        _mesa_meta_BlitFrameBuffer. Create a temp depth texture to support
        depth buffer blitting.
    V3: Remove unsupported / redundant shader code. Add an assertion to make
        sure that we don't use rectangle texture in ES. Put API guard on
        glTexEnvi().
    V4: For gles3: Don't use ReadPixels or CopyTexImage2D to blit depth
        buffer.  gles3 spec says for CopyTexImage2D that "color buffer
        components can be dropped during the conversion to internalformat,
        but new components cannot be added." So, use the internal format of
        read renderbuffer to create texture for color buffer blitting.


Reproduce steps:
----------------
1. xinit
2. ./oglconform -z -suite all -v 2  -test fbblit advanced.blitFb-3d-\
cube.mirror.both
Comment 1 lu hua 2013-01-17 07:21:27 UTC
Following cases fail on ironlake and pineview with mesa master branch, have same bisect info:
Piglit cases:
spec_ARB_ES2_compatibility_FBO_blit_from_missing_attachment_(ES2_completeness_rules)
spec_ARB_ES2_compatibility_FBO_blit_to_missing_attachment_(ES2_completeness_rules)
spec_ARB_framebuffer_object_FBO_blit_from_missing_attachment
spec_ARB_framebuffer_object_FBO_blit_to_missing_attachment
spec_ARB_framebuffer_object_framebuffer-blit-levels_draw_depth
spec_ARB_framebuffer_object_framebuffer-blit-levels_read_depth
spec_EXT_packed_depth_stencil_fbo-blit-d24s8
Oglc cases:
fbblit(advanced.blitFb-3d-cube.fragop.scissortest)
fbblit(advanced.blitFb.bounds)
fbblit(advanced.blitFb.fragop.alphatest)
fbblit(advanced.blitFb.fragop.depthtest)
fbblit(advanced.blitFb.fragop.scissortest)
fbblit(advanced.blitFb.fragop.stenciltest)
fbo-multisample(advanced.blit.defaulttomsaa.colordepth)
fbo-multisample(advanced.blit.singletomsaa.colordepth)
fboarb(basic.blit.colorandepth)
Comment 2 fangxun 2013-02-19 09:19:04 UTC
It also fails on mesa 9.1 branch.
Comment 3 Anuj Phogat 2013-02-19 23:04:28 UTC
Posted a patch on mesa-dev which fixes this failure: http://permalink.gmane.org/gmane.comp.video.mesa3d.devel/53209
Comment 4 Anuj Phogat 2013-03-04 18:58:42 UTC
Reported tests pass on Sandybridge Mobile after following commit:

Author: Anuj Phogat <anuj.phogat@gmail.com>
Date:   Fri Feb 15 11:03:08 2013 -0800

    meta: Allocate texture before initializing texture coordinates
    
    tex->Sright and tex->Ttop are initialized during texture allocation.
    This fixes depth buffer blitting failures in khronos conformance tests
    when run on desktop GL 3.0.
    Fixes https://bugs.freedesktop.org/show_bug.cgi?id=59495
    
    Note: This is a candidate for stable branches.
    
    Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
    Reviewed-by: Chad Versace <chad.versace@linux.intel.com>

Marking the bug resolved/fixed.
Comment 5 lu hua 2013-03-06 06:20:53 UTC
It still fails on mesa 9.1 branch.

fbblit(negative.nullblit.zeroSize) still core dumped on mesa master and 9.1 branch.
output:
Intel OpenGL Conformance Test
Version ENG (Mar  5 2013 17:33:58)

CLI options echo:
oglconform -suite all -v 2 -test fbblit negative.nullblit.zeroSize

Window will be recreated 12 times.
  Window 0 will run 1 testcases on config with id 128.
  Window 1 will run 1 testcases on config with id 124.
  Window 2 will run 1 testcases on config with id 106.
  Window 3 will run 1 testcases on config with id 102.
  Window 4 will run 1 testcases on config with id 129.
  Window 5 will run 1 testcases on config with id 107.
  Window 6 will run 1 testcases on config with id 122.
  Window 7 will run 1 testcases on config with id 100.
  Window 8 will run 1 testcases on config with id 125.
  Window 9 will run 1 testcases on config with id 103.
  Window 10 will run 1 testcases on config with id 123.
  Window 11 will run 1 testcases on config with id 101.
Total of 12 testcases will be executed.

Setup Report.
    Verbose level = 2.
    Path inactive.

Visual Report for ID 128 (32 bits).
ID      |ACCELERA|DB      |REND_T  |SURF_T  |C_BUF_T |BUF_S   |RED_S   |
     128|       1|       1|      gl|  wipbpx|    rgba|      32|       8|

GREEN_S |BLUE_S  |ALPHA_S |DEPTH_S |STENC_S |ACCUM_S |SPL_BUF |SAMPLES |
       8|       8|       8|      24|       8|       0|       0|       0|

SRGB    |TEX_RGB |TEX_RGBA|CAVEAT  |SWAP    |M_PBUF_W|M_PBUF_H|M_PBUF_P
       0|       0|       0|    none|   undef|       0|       0|       0

OpenGL Report.
    Vendor - 'Intel Open Source Technology Center'
    Renderer - 'Mesa DRI Intel(R) Ivybridge Mobile '
    Version - '3.0 Mesa 9.2-devel (git-e291247)' (3.0)
    GLSL Version - '1.30'
    Context Flags - None

>> Framebuffer blit (fbblit)  test:
--> 4.4 - negative.nullblit.zeroSize subcase:
Floating point exception (core dumped)


(gdb) bt
#0  0x00007ffff62a8c3c in _mesa_meta_BlitFramebuffer (ctx=0x34c2880, srcX0=0, srcY0=0, srcX1=0, srcY1=0, dstX0=1, dstY0=1, dstX1=99, dstY1=99, mask=<optimized out>,
    filter=9729) at ../../../src/mesa/drivers/common/meta.c:1794
#1  0x00007ffff617a30a in _mesa_BlitFramebuffer (srcX0=0, srcY0=0, srcX1=0, srcY1=0, dstX0=<optimized out>, dstY0=1, dstX1=99, dstY1=99, mask=16384, filter=9729)
    at ../../../src/mesa/main/fbobject.c:3198
#2  0x0000000001331439 in (anonymous namespace)::fbblit::testcases::negativeZeroSizeBlit() ()
#3  0x0000000001331629 in long (anonymous namespace)::fbblit::runSubcaseAndHandleUnsupportedFbo<&(anonymous namespace)::fbblit::testcases::negativeZeroSizeBlit>() ()
#4  0x00000000013331d1 in FramebufferBlitExec(testParameters*) ()
#5  0x0000000001843a19 in callFunctionHandleExceptionsInner(long (*)(testParameters*), testParameters*, char*) ()
#6  0x0000000001843b6f in callFunctionHandleExceptions(long (*)(testParameters*), testParameters*) ()
#7  0x0000000001842801 in DriverExec(long (*)(testParameters*), testParameters*) ()
#8  0x0000000001779345 in Driver(std::vector<std::pair<std::string, std::string>, std::allocator<std::pair<std::string, std::string> > > const&, std::vector<driverRec*, std::allocator<driverRec*> > const&, std::vector<boost::shared_ptr<PrePostTestAction>, std::allocator<boost::shared_ptr<PrePostTestAction> > > const&, std::vector<boost::shared_ptr<PrePostTestcaseAction>, std::allocator<boost::shared_ptr<PrePostTestcaseAction> > > const&) ()
#9  0x0000000001779df8 in (anonymous namespace)::MyMessagePump::idle() ()
#10 0x000000000174b0f0 in MessagePump::process_messages() ()
#11 0x0000000001778404 in ExecutionManager::execute_schedules() ()
#12 0x0000000001717a1f in tkShellExecute(std::vector<std::pair<std::string, std::string>, std::allocator<std::pair<std::string, std::string> > > const&, std::vector<std::pair<std::string, std::string>, std::allocator<std::pair<std::string, std::string> > > const&) ()
#13 0x00000000004287c5 in main ()
Comment 6 Anuj Phogat 2013-03-07 22:21:38 UTC
fbblit(negative.nullblit.zeroSize) doesn't look like a regression caused by commit 0c535ae. I couldn't make the test pass with revisions prior to 0c535ae on mesa master. I think bisected commit is incorrect for this test case.
I've anyway posted a patch on mailing list to fix this issue.
Comment 7 Anuj Phogat 2013-03-15 17:19:35 UTC
fixed on mesa master:
commit d78dcdf103271c539ff246651236e71f7a9c10fd
Author: Anuj Phogat <anuj.phogat@gmail.com>
Date:   Thu Mar 7 14:05:38 2013 -0800

    mesa: Fix FB blitting in case of zero size src or dst rect
    
    Framebuffer blitting operation should be skipped if any of the
    dimensions (width/height) of src/dst rect is zero.
    
    V2: Move the dimension check after error checking in _mesa_BlitFramebuffer.
    
    Fixes: fbblit(negative.nullblit.zeroSize) in Intel oglconform
    https://bugs.freedesktop.org/show_bug.cgi?id=59495
    
    Note: Candidate for all the stable branches.
    
    Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
    Reviewed-by: Paul Berry <stereotype441@gmail.com>
Comment 8 lu hua 2013-03-20 02:49:24 UTC
It fixed on mesa master branch.
When fbblit(negative.nullblit.zeroSize) fixed on 9.1 branch, I will closed it.
Comment 9 lu hua 2013-04-25 05:26:02 UTC
Verified.Fixed.

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.