summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2019-03-08 14:02:53 -0700
committerBrian Paul <[email protected]>2019-03-17 20:07:22 -0600
commita7afab7952c37da3144795f6ea81b7a31f5249e2 (patch)
tree18b0fc2e92e9baad52f146138e267e1424a3396e /src
parent20de0359b53311cad322de8286448f2cbb34f475 (diff)
svga: stop using pipe_sampler_view_release()
This function was used in the past to avoid deleting a sampler view for a context that no longer exists. But the Mesa state tracker ensures that cannot happen. Use the standard refcounting function instead. Also, remove the code which checked for context mis-matches in svga_sampler_view_destroy(). It's no longer needed since implementing the zombie sampler view code in the state tracker. Testing Done: google chrome, variety of GL demos/games Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Neha Bhende <[email protected]> Reviewed-by: Mathias Fröhlich <[email protected]> Reviewed-By: Jose Fonseca <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/svga/svga_pipe_sampler.c38
-rw-r--r--src/gallium/drivers/svga/svga_state_tss.c4
2 files changed, 14 insertions, 28 deletions
diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c
index b32bb098f7f..f1e68dd726a 100644
--- a/src/gallium/drivers/svga/svga_pipe_sampler.c
+++ b/src/gallium/drivers/svga/svga_pipe_sampler.c
@@ -405,28 +405,18 @@ svga_sampler_view_destroy(struct pipe_context *pipe,
struct svga_pipe_sampler_view *sv = svga_pipe_sampler_view(view);
if (svga_have_vgpu10(svga) && sv->id != SVGA3D_INVALID_ID) {
- if (view->context != pipe) {
- /* The SVGA3D device will generate an error (and on Linux, cause
- * us to abort) if we try to destroy a shader resource view from
- * a context other than the one it was created with. Skip the
- * SVGA3D_vgpu10_DestroyShaderResourceView() and leak the sampler
- * view for now. This should only sometimes happen when a shared
- * texture is deleted.
- */
- _debug_printf("context mismatch in %s\n", __func__);
- }
- else {
- enum pipe_error ret;
+ enum pipe_error ret;
+
+ assert(view->context == pipe);
- svga_hwtnl_flush_retry(svga); /* XXX is this needed? */
+ svga_hwtnl_flush_retry(svga);
+ ret = SVGA3D_vgpu10_DestroyShaderResourceView(svga->swc, sv->id);
+ if (ret != PIPE_OK) {
+ svga_context_flush(svga, NULL);
ret = SVGA3D_vgpu10_DestroyShaderResourceView(svga->swc, sv->id);
- if (ret != PIPE_OK) {
- svga_context_flush(svga, NULL);
- ret = SVGA3D_vgpu10_DestroyShaderResourceView(svga->swc, sv->id);
- }
- util_bitmask_clear(svga->sampler_view_id_bm, sv->id);
}
+ util_bitmask_clear(svga->sampler_view_id_bm, sv->id);
}
pipe_resource_reference(&sv->base.texture, NULL);
@@ -465,7 +455,8 @@ svga_set_sampler_views(struct pipe_context *pipe,
*/
if (start == 0 && num == 0 && svga->curr.num_sampler_views[shader] > 0) {
for (i = 0; i < svga->curr.num_sampler_views[shader]; i++) {
- pipe_sampler_view_release(pipe, &svga->curr.sampler_views[shader][i]);
+ pipe_sampler_view_reference(&svga->curr.sampler_views[shader][i],
+ NULL);
}
any_change = TRUE;
}
@@ -474,11 +465,6 @@ svga_set_sampler_views(struct pipe_context *pipe,
enum pipe_texture_target target;
if (svga->curr.sampler_views[shader][start + i] != views[i]) {
- /* Note: we're using pipe_sampler_view_release() here to work around
- * a possible crash when the old view belongs to another context that
- * was already destroyed.
- */
- pipe_sampler_view_release(pipe, &svga->curr.sampler_views[shader][start + i]);
pipe_sampler_view_reference(&svga->curr.sampler_views[shader][start + i],
views[i]);
any_change = TRUE;
@@ -552,8 +538,8 @@ svga_cleanup_sampler_state(struct svga_context *svga)
unsigned i;
for (i = 0; i < svga->state.hw_draw.num_sampler_views[shader]; i++) {
- pipe_sampler_view_release(&svga->pipe,
- &svga->state.hw_draw.sampler_views[shader][i]);
+ pipe_sampler_view_reference(&svga->state.hw_draw.sampler_views[shader][i],
+ NULL);
}
}
diff --git a/src/gallium/drivers/svga/svga_state_tss.c b/src/gallium/drivers/svga/svga_state_tss.c
index d598d23c4ea..95b1a9e952d 100644
--- a/src/gallium/drivers/svga/svga_state_tss.c
+++ b/src/gallium/drivers/svga/svga_state_tss.c
@@ -50,8 +50,8 @@ svga_cleanup_tss_binding(struct svga_context *svga)
struct svga_hw_view_state *view = &svga->state.hw_draw.views[i];
if (view) {
svga_sampler_view_reference(&view->v, NULL);
- pipe_sampler_view_release(&svga->pipe,
- &svga->curr.sampler_views[shader][i]);
+ pipe_sampler_view_reference(&svga->curr.sampler_views[shader][i],
+ NULL);
pipe_resource_reference(&view->texture, NULL);
view->dirty = TRUE;
}