r300: fix r300_draw_elements() behavior
Indeed, the pointer processed by r300_upload_index_buffer() was not the right one. This is the reason why "deqp-gles2 --deqp-case=dEQP-GLES2.functional.draw.draw_elements.indices.user_ptr.index_byte" was failing (the logs are below). This change corrects this issue and makes the related deqp tests work properly. This change considers that r300_upload_index_buffer() sets indexBuffer to NULL. The indexBuffer resource should be properly freed once the buffer is processed. This is required to avoid another refcnt imbalance (another kind of memory leak). ==9962==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60200000721f at pc 0x7fd57b54a9a0 bp 0x7fffd2c39290 sp 0x7fffd2c38a40 READ of size 30 at 0x60200000721f thread T0 #0 0x7fd57b54a99f in __interceptor_memcpy (/usr/lib64/libasan.so.6.0.0+0x3c99f) #1 0x7fd570d10528 in u_upload_data ../src/gallium/auxiliary/util/u_upload_mgr.c:333 #2 0x7fd57114142b in r300_upload_index_buffer ../src/gallium/drivers/r300/r300_screen_buffer.c:44 #3 0x7fd57113943c in r300_draw_elements ../src/gallium/drivers/r300/r300_render.c:632 #4 0x7fd57113bbc4 in r300_draw_vbo ../src/gallium/drivers/r300/r300_render.c:840 #5 0x7fd570d212e2 in u_vbuf_draw_vbo ../src/gallium/auxiliary/util/u_vbuf.c:1487 #6 0x7fd56fceb873 in _mesa_validated_drawrangeelements ../src/mesa/main/draw.c:1709 #7 0x7fd56fcf28c5 in _mesa_DrawElementsBaseVertex ../src/mesa/main/draw.c:1852 Fixes: 330d0607 ("gallium: remove pipe_index_buffer and set_index_buffer") Signed-off-by:Patrick Lerda <patrick9876@free.fr> Part-of: <!28523>
- src/gallium/drivers/r300/ci/r300-r480-fails.txt 0 additions, 1 deletionsrc/gallium/drivers/r300/ci/r300-r480-fails.txt
- src/gallium/drivers/r300/ci/r300-rv380-fails.txt 0 additions, 1 deletionsrc/gallium/drivers/r300/ci/r300-rv380-fails.txt
- src/gallium/drivers/r300/ci/r300-rv530-nohiz-fails.txt 0 additions, 1 deletionsrc/gallium/drivers/r300/ci/r300-rv530-nohiz-fails.txt
- src/gallium/drivers/r300/r300_context.h 2 additions, 1 deletionsrc/gallium/drivers/r300/r300_context.h
- src/gallium/drivers/r300/r300_render.c 13 additions, 4 deletionssrc/gallium/drivers/r300/r300_render.c
- src/gallium/drivers/r300/r300_render_translate.c 9 additions, 8 deletionssrc/gallium/drivers/r300/r300_render_translate.c