[Mesa-dev] [PATCH] gallium: Mute arrays for several meta like callbacks.
Mathias.Froehlich at gmx.net
Mathias.Froehlich at gmx.net
Tue Feb 6 20:18:15 UTC 2018
From: Mathias Fröhlich <Mathias.Froehlich at gmx.net>
Hi Brian,
I think you are right the _mesa_set_drawing_arrays better belong into
the state tracker. You mean like the below?
I added also two other callbacks that lookes suspicious to me.
I just sent the single patch in question out of the series of three.
Tested with piglit quick on radeonsi, classic swrast and i965
without regressions.
best and thanks
Mathias
Set the _DrawArray pointer to NULL when calling into the Drivers
Bitmap/CopyPixels/DrawAtlasBitmaps/DrawPixels/DrawTex hooks.
This fixes an assert that gets uncovered with the following
patch gets applied.
v2: Mute from within the state tracker instead of generic mesa.
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
---
src/mesa/state_tracker/st_cb_bitmap.c | 7 +++++++
src/mesa/state_tracker/st_cb_drawpixels.c | 7 +++++++
src/mesa/state_tracker/st_cb_drawtex.c | 4 ++++
3 files changed, 18 insertions(+)
diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c
index a5c7ed0ee6..a1e35994de 100644
--- a/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/src/mesa/state_tracker/st_cb_bitmap.c
@@ -36,6 +36,7 @@
#include "main/dlist.h"
#include "main/macros.h"
#include "main/pbo.h"
+#include "main/varray.h"
#include "program/program.h"
#include "program/prog_print.h"
@@ -613,6 +614,9 @@ st_Bitmap(struct gl_context *ctx, GLint x, GLint y,
assert(width > 0);
assert(height > 0);
+ /* Prevent st_atom_array from accessing stale draw array data */
+ _mesa_set_drawing_arrays(ctx, NULL);
+
st_invalidate_readpix_cache(st);
if (!st->bitmap.vs) {
@@ -675,6 +679,9 @@ st_DrawAtlasBitmaps(struct gl_context *ctx,
struct pipe_vertex_buffer vb = {0};
unsigned i;
+ /* Prevent st_atom_array from accessing stale draw array data */
+ _mesa_set_drawing_arrays(ctx, NULL);
+
if (!st->bitmap.vs) {
init_bitmap_state(st);
}
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index ff3eb9b614..73108812da 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -45,6 +45,7 @@
#include "main/texformat.h"
#include "main/teximage.h"
#include "main/texstore.h"
+#include "main/varray.h"
#include "main/glformats.h"
#include "program/program.h"
#include "program/prog_print.h"
@@ -1142,6 +1143,9 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y,
/* Mesa state should be up to date by now */
assert(ctx->NewState == 0x0);
+ /* Prevent st_atom_array from accessing stale draw array data */
+ _mesa_set_drawing_arrays(ctx, NULL);
+
_mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer);
st_flush_bitmap_cache(st);
@@ -1509,6 +1513,9 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
GLint readX, readY, readW, readH;
struct gl_pixelstore_attrib pack = ctx->DefaultPacking;
+ /* Prevent st_atom_array from accessing stale draw array data */
+ _mesa_set_drawing_arrays(ctx, NULL);
+
_mesa_update_draw_buffer_bounds(ctx, ctx->DrawBuffer);
st_flush_bitmap_cache(st);
diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c
index 01c5757a73..0df0ab4713 100644
--- a/src/mesa/state_tracker/st_cb_drawtex.c
+++ b/src/mesa/state_tracker/st_cb_drawtex.c
@@ -17,6 +17,7 @@
#include "main/macros.h"
#include "main/teximage.h"
#include "main/framebuffer.h"
+#include "main/varray.h"
#include "program/program.h"
#include "program/prog_print.h"
@@ -117,6 +118,9 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z,
struct pipe_vertex_element velements[2 + MAX_TEXTURE_UNITS];
unsigned offset;
+ /* Prevent st_atom_array from accessing stale draw array data */
+ _mesa_set_drawing_arrays(ctx, NULL);
+
st_flush_bitmap_cache(st);
st_invalidate_readpix_cache(st);
--
2.14.3
More information about the mesa-dev
mailing list