Bug 42268

Summary: [bisected] oglc pbo(negative.invalidOffsetValue) aborts on 7.11 branch
Product: Mesa Reporter: fangxun <xunx.fang>
Component: Drivers/DRI/i915Assignee: Ian Romanick <idr>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: high CC: idr, kenneth, yuanhan.liu
Version: 7.11   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description fangxun 2011-10-26 02:38:46 UTC
System Environment:
--------------------------
Arch:           i386
Platform:       pineview 
Libdrm:         (master)2.4.26-18-gcc088f1721eaa5f8f1ba1932723882f92e34c39a
Mesa:           (7.11)681f4820ab7339b0ecc4cf656ae1e0adac6ed8f6
Xserver:                (server-1.11-branch)xorg-server-1.11.1
Xf86_video_intel:  (master)2.16.0-205-ga18f559961135fa288dda3b94207abb0b6d4d302
Kernel:         (drm-intel-fixes) cd0de039bff32ee314046c0e4c047c38aa696f84

Bug detailed description:
------------------------- 
It aborts on pineview, ironlake and sandybridge with belowing error info.
glconform: intel_buffer_objects.c:512: intel_bufferobj_unmap: Assertion `obj->Pointer' failed
  
Bisect shows 53a3e743ae91457d2259ef2f6eae9d238a48cf0f is the first bad commit.
commit 53a3e743ae91457d2259ef2f6eae9d238a48cf0f
Author:     Yuanhan Liu <yuanhan.liu@linux.intel.com>
AuthorDate: Mon Oct 17 09:57:36 2011 +0800
Commit:     Ian Romanick <ian.d.romanick@intel.com>
CommitDate: Mon Oct 24 15:54:31 2011 -0700

    mesa: generate error if pbo offset is not aligned with the size of specified type

    v2: quote the spec; explicitly exclude the GL_BITMAP case to make code
        more readable. (comments from Ian)

    v3: Cast the offset by GLintptr to remove the compile warning(comments
        from Brian).

        I also found that I should use _mesa_sizeof_packed_type() instead,
        as it includes packed pixel type, like GL_UNSIGNED_SHORT_5_6_5.

    Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
    Reviewed-by: Brian Paul <brianp@vmware.com>
    (cherry picked from commit 9024d8af0ae832a0b4278eb6683bc0e76c69baac)

Reproduce steps:
----------------
1. start X
2. ./oglconform -z -s -suite all -v 2 -D 115 -test pbo negative.invalidOffsetValue
Comment 1 fangxun 2011-11-01 19:55:26 UTC
It passes on mesa master branch.
Comment 2 Ian Romanick 2011-11-03 11:57:11 UTC
This should be fixed on the 7.11 branch by the following commit:

commit 5459781715f47dcd3f93d84e69ab82245f684660
Author: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Date:   Wed Nov 2 14:13:45 2011 +0800

    intel: don't call unmap pbo if pbo is not mapped
    
    The PBO only needs to be unmapped if one of the previous calls to
    _mesa_validate_pbo_* succeeded.  In this case, pixels will be
    non-NULL.  Various paths through _mesa_unmap_texmiage_pbo can hit
    assertion failures or segfaults if the buffer is not mapped.
    
    To work around this, move the call to _mesa_unmap_teximage_pbo inside
    the last 'if (pixels)' block.
    
    NOTE: this is just for 7.11 stable branch
    
    Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
    Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: Eric Anholt <eric@anholt.net>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42268
Comment 3 fangxun 2011-11-07 22:46:16 UTC
Verified with mesa(7.11) commit 4464ee1a9aa3745109cee23531e3fb2323234d07.

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.