Bug 35163 - In game text display drops glyphs. (Achron) [bisected]
Summary: In game text display drops glyphs. (Achron) [bisected]
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Chris Wilson
QA Contact:
URL:
Whiteboard:
Keywords: NEEDINFO
Depends on:
Blocks:
 
Reported: 2011-03-09 15:33 UTC by Thomas Jones
Modified: 2011-04-12 11:19 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Screenshot showing problem (488.21 KB, image/png)
2011-03-09 15:43 UTC, Thomas Jones
Details

Description Thomas Jones 2011-03-09 15:33:26 UTC
In the game the text display is missing random characters, seems to be in blocks (ie you have runs of missing characters and runs of ones that actually show)


bisection says it was introduced in this commit:

b4cbd2b312d53a50603e2cda925711bc9def4517 is the first bad commit
commit b4cbd2b312d53a50603e2cda925711bc9def4517
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Feb 22 11:19:32 2011 +0000

    i965: Reinstate max-index paranoia
    
    Don't trust the applications not to reference beyond the end of the
    vertex buffers.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

:040000 040000 32271cda06fefdecdfd9df2a9938cd0582291e42 1b50b3eb11b7330dba025e97575488b755cebcf2 M	src
Comment 1 Thomas Jones 2011-03-09 15:43:40 UTC
Created attachment 44289 [details]
Screenshot showing problem

Added a screenshot showing the problem.

Also noticed it actually flickers sometimes showing all the text.
Comment 2 Chris Wilson 2011-03-10 10:26:15 UTC
Hmm, does this help?

diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index e96c32a..da61e09 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -575,7 +575,7 @@ static void brw_emit_vertices(struct brw_context *brw)
 	 if (intel->gen >= 5) {
 	    OUT_RELOC(buffer->bo, I915_GEM_DOMAIN_VERTEX, 0, buffer->bo->size - 1);
 	 } else
-	    OUT_BATCH(buffer->bo->size / buffer->stride);
+	    OUT_BATCH((buffer->bo->size - buffer->offset) / buffer->stride);
 	 OUT_BATCH(0); /* Instance data step rate */
 
 	 brw->vb.current_buffers[i].handle = buffer->bo->handle;
Comment 3 Thomas Jones 2011-03-11 19:32:10 UTC
(In reply to comment #2)
> Hmm, does this help?
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c
> b/src/mesa/drivers/dri/i965/brw_draw_upload.c
> index e96c32a..da61e09 100644
> --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
> +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
> @@ -575,7 +575,7 @@ static void brw_emit_vertices(struct brw_context *brw)
>       if (intel->gen >= 5) {
>          OUT_RELOC(buffer->bo, I915_GEM_DOMAIN_VERTEX, 0, buffer->bo->size -
> 1);
>       } else
> -        OUT_BATCH(buffer->bo->size / buffer->stride);
> +        OUT_BATCH((buffer->bo->size - buffer->offset) / buffer->stride);
>       OUT_BATCH(0); /* Instance data step rate */
> 
>       brw->vb.current_buffers[i].handle = buffer->bo->handle;

Nope
Comment 4 Chris Wilson 2011-03-16 04:34:30 UTC
And you verified that reverting b4cbd2b312d is sufficient?
Comment 5 Thomas Jones 2011-04-06 19:14:35 UTC
(In reply to comment #4)
> And you verified that reverting b4cbd2b312d is sufficient?

Yes, sorry it took so long to respond, I missed the email.
Comment 6 Thomas Jones 2011-04-12 11:08:34 UTC
Still in mesa master, and reverting b4cbd2b312d is still sufficient to fix it.
Comment 7 Chris Wilson 2011-04-12 11:19:01 UTC
No worries, many thanks for testing! I just didn't want to push the revert without being sure that I had not caused further breakage.

commit f703ba8c42e924ee6d5e4308c3888e434d8ba98c
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Apr 12 19:13:22 2011 +0100

    Revert "i965: Reinstate max-index paranoia"
    
    This reverts commit b4cbd2b312d53a50603e2cda925711bc9def4517.
    
    It looked like a safe sanity check. It missed the issue of the start of
    the buffer not being at 0, but even that was not enough to explain why
    setting the max vertex index caused glyphs to be dropped from the game
    'Achron'.
    
    Instead, the issue appears to be related to the use of the vertex bias
    and so we would need to re-emit the max-index every time we adjusted the
    bias, so re-emitting the relocations and defeating the original
    optimisation.
    
    Reported-and-tested-by: Thomas Jones <thomas.jones@utoronto.ca>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=35163
    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.