Bug 45414

Summary: loading a texture of 2049 on gen2 (max 3d texture 2048) leads to X crash due to assert in kgem
Product: xorg Reporter: Alban Browaeys <prahal>
Component: Driver/intelAssignee: Chris Wilson <chris>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
workaround for texture bigger than 3d max texture and tiling enabled
none
sample test (cogl/clutter)
none
workaround for texture bigger than 3d max texture and tiling enabled (v2) none

Description Alban Browaeys 2012-01-30 15:34:17 UTC
Created attachment 56346 [details]
workaround for texture bigger than 3d max texture and tiling enabled

kgem_create_2d assert due to size behing zero. This comes from kgem_surface_size returning 0 if pitch is greater than 8192 and tiling is enabled.

As it was working before (I guess tiling was disabled when loading too big a texture) I make up this fix.

This is only tested against the sample code that triggered the previous crash (attached). But it works (ie it load a white texture).
Comment 1 Alban Browaeys 2012-01-30 15:38:17 UTC
Created attachment 56347 [details]
sample test (cogl/clutter)

Sample that triggered the bug on gen2 (change MAX_RECT_LOCAL to 3d max texture + 1). At least on gen2 i865g using 2049 leads to crash with xf86 video intel to commit ed1c1a7468d78e99cb4f9a4a8b8a6b00c3257a75 .
Comment 2 Alban Browaeys 2012-01-30 15:57:39 UTC
Created attachment 56350 [details] [review]
workaround for texture bigger than 3d max texture and tiling enabled (v2)

Avoid calling kgem_surface_size if size is not zero with tiling on.
Comment 3 Chris Wilson 2012-01-31 02:11:56 UTC
The assertion is there to tell you the caller is being idiotic. Fix the caller.
Comment 4 Chris Wilson 2012-01-31 02:31:54 UTC
commit e872c1011fc7b67683703fd891234f07dd7acd04
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Jan 31 10:21:05 2012 +0000

    sna/dri: We need to reduce tiling on older gen if we cannot fence
    
    Only apply the architectural limits to enable bo creation for DRI buffers.
    
    Reported-by: Alban Browaeys <prahal@yahoo.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45414
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

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.