[Mesa-dev] [PATCH] i965: disable blorp's linear filtering on SNB

Neil Roberts neil at linux.intel.com
Wed Jun 25 10:59:33 PDT 2014


Hi,

I've been looking into this bug a bit more. I don't think disabling the
blorp path on Sandybridge is the right thing to do. The only notable
difference between the blorp code path and the meta code path seems to
be that the blorp code forces the use of non-normalized coordinates
whereas the meta code path doesn't. It looks like the linear filtering
on Sandybridge is not very precise and switching to non-normalized
coordinates is enough to tip it over the balance and make the test fail.

You can also make the meta code path fail if you change the test to use
a rectangle texture instead of a 2D texture. That will make it also use
non-normalized coordinates. Therefore I think the meta path isn't really
any better than the blorp path and the problem is with the sampler. I've
made a patch for piglit to demonstrate using rectangle textures here:

https://github.com/bpeel/piglit/commit/69d431af43825ea184e224c9dec7fca6

I made a little test program to demonstrate the results of the linear
filtering here:

https://github.com/bpeel/glthing/blob/wip/simple-longblit/src/main.c

This creates a 2x1 rectangle texture with a black pixel on the left and
a red pixel on the right. It then renders this using a triangle strip
into a 256x1 texture where the texture coordinates are set up such that
the center of the first pixel in the destination samples the center of
the left pixel in the source and the center of the rightmost pixel
samples the center of the right pixel. Linear interpolation is used so
that if the rendering is working preciesly the red channel of the result
should have exactly the values from 0 to 255.

On Haswell, this gives the values you would expect from 0 to 255.
However on Sandybridge I get the following result:

00  00* 00* 00* 04  04* 04* 04* 08  08* 08* 08* 0c  0c* 0c* 0c*
10  10* 10* 10* 14  14* 14* 14* 18  18* 18* 18* 1c  1c* 1c* 1c*
20  20* 20* 20* 24  24* 24* 24* 28  28* 28* 28* 2c  2c* 2c* 2c*
30  30* 30* 30* 34  34* 34* 34* 38  38* 38* 38* 3c  3c* 3c* 3c*
40  40* 40* 40* 44  44* 44* 44* 48  48* 48* 48* 4c  4c* 4c* 4c*
50  50* 50* 50* 54  54* 54* 54* 58  58* 58* 58* 5c  5c* 5c* 5c*
60  60* 60* 60* 64  64* 64* 64* 68  68* 68* 68* 6c  6c* 6c* 6c*
70  70* 70* 70* 74  74* 74* 74* 78  78* 78* 78* 7c  7c* 7c* 7c*
80  80* 80* 80* 83* 83* 83* 83* 87* 87* 87* 87* 8b* 8b* 8b* 8b*
8f* 8f* 8f* 8f* 93* 93* 93* 93* 97* 97* 97* 97* 9b* 9b* 9b* 9b*
9f* 9f* 9f* 9f* a3* a3* a3* a3* a7* a7* a7* a7* ab* ab* ab* ab*
af* af* af* af* b3* b3* b3* b3* b7* b7* b7* b7* bb* bb* bb* bb*
bf* bf* bf* bf* c3* c3* c3* c3* c7* c7* c7* c7* cb* cb* cb* cb*
cf* cf* cf* cf* d3* d3* d3* d3* d7* d7* d7* d7* db* db* db* db*
df* df* df* df* e3* e3* e3* e3* e7* e7* e7* e7* eb* eb* eb* eb*
ef* ef* ef* ef* f3* f3* f3* f3* f7* f7* f7* f7* fb* fb* fb* fb*
Maximum diff = 4 (1.568627%)

(The asterisk marks when the value is not correct)

With a 2D texture this gives:

00  00* 04* 04* 04  04* 08* 08* 08  08* 0c* 0c* 0c  0c* 10* 10*
10  10* 14* 14* 14  14* 18* 18* 18  18* 1c* 1c* 1c  1c* 20* 20*
20  20* 24* 24* 24  24* 28* 28* 28  28* 2c* 2c* 2c  2c* 30* 30*
30  30* 34* 34* 34  34* 38* 38* 38  38* 3c* 3c* 3c  3c* 40* 40*
40  40* 44* 44* 44  44* 48* 48* 48  48* 4c* 4c* 4c  4c* 50* 50*
50  50* 54* 54* 54  54* 58* 58* 58  58* 5c* 5c* 5c  5c* 60* 60*
60  60* 64* 64* 64  64* 68* 68* 68  68* 6c* 6c* 6c  6c* 70* 70*
70  70* 74* 74* 74  74* 78* 78* 78  78* 7c* 7c* 7c  7c* 80* 80*
80  80* 83* 83  83* 83* 87* 87  87* 87* 8b* 8b  8b* 8b* 8f* 8f 
8f* 8f* 93* 93  93* 93* 97* 97  97* 97* 9b* 9b  9b* 9b* 9f* 9f 
9f* 9f* a3* a3  a3* a3* a7* a7  a7* a7* ab* ab  ab* ab* af* af 
af* af* b3* b3  b3* b3* b7* b7  b7* b7* bb* bb  bb* bb* bf* bf 
bf* bf* c3* c3  c3* c3* c7* c7  c7* c7* cb* cb  cb* cb* cf* cf 
cf* cf* d3* d3  d3* d3* d7* d7  d7* d7* db* db  db* db* df* df 
df* df* e3* e3  e3* e3* e7* e7  e7* e7* eb* eb  eb* eb* ef* ef 
ef* ef* f3* f3  f3* f3* f7* f7  f7* f7* fb* fb  fb* fb* ff* ff 
Maximum diff = 2 (0.784314%)

Piglit effectively has a default tolerance of 1% so the 2D texture
version would pass. However the results are still clumped together in
fours and they are just offset slightly. It doesn't look like it's
actually any better.

Is this amount of imprecision something that we should expect on
Sandybridge? If so perhaps we should increase the tolerance level in the
test.

- Neil


More information about the mesa-dev mailing list