diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index b06a070..e2490bc 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -321,8 +321,8 @@ void cso_release_all( struct cso_context *ctx ) for (shader = 0; shader < Elements(ctx->samplers); shader++) { struct sampler_info *info = &ctx->samplers[shader]; for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { - pipe_sampler_view_reference(&info->views[i], NULL); - pipe_sampler_view_reference(&info->views_saved[i], NULL); + pipe_sampler_view_reference(ctx->pipe, &info->views[i], NULL); + pipe_sampler_view_reference(ctx->pipe, &info->views_saved[i], NULL); } } @@ -1166,11 +1166,11 @@ cso_set_sampler_views(struct cso_context *ctx, /* reference new views */ for (i = 0; i < count; i++) { - pipe_sampler_view_reference(&info->views[i], views[i]); + pipe_sampler_view_reference(ctx->pipe, &info->views[i], views[i]); } /* unref extra old views, if any */ for (; i < info->nr_views; i++) { - pipe_sampler_view_reference(&info->views[i], NULL); + pipe_sampler_view_reference(ctx->pipe, &info->views[i], NULL); } info->nr_views = count; @@ -1202,7 +1202,7 @@ cso_save_sampler_views(struct cso_context *ctx, unsigned shader_stage) for (i = 0; i < info->nr_views; i++) { assert(!info->views_saved[i]); - pipe_sampler_view_reference(&info->views_saved[i], info->views[i]); + pipe_sampler_view_reference(ctx->pipe, &info->views_saved[i], info->views[i]); } } @@ -1214,13 +1214,13 @@ cso_restore_sampler_views(struct cso_context *ctx, unsigned shader_stage) unsigned i, nr_saved = info->nr_views_saved; for (i = 0; i < nr_saved; i++) { - pipe_sampler_view_reference(&info->views[i], NULL); + pipe_sampler_view_reference(ctx->pipe, &info->views[i], NULL); /* move the reference from one pointer to another */ info->views[i] = info->views_saved[i]; info->views_saved[i] = NULL; } for (; i < info->nr_views; i++) { - pipe_sampler_view_reference(&info->views[i], NULL); + pipe_sampler_view_reference(ctx->pipe, &info->views[i], NULL); } /* bind the old/saved sampler views */ diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index b6c328b..7f9db5c 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -706,7 +706,7 @@ aaline_first_line(struct draw_stage *stage, struct prim_header *header) num_samplers = MAX2(num_samplers, aaline->fs->sampler_unit + 1); aaline->state.sampler[aaline->fs->sampler_unit] = aaline->sampler_cso; - pipe_sampler_view_reference(&aaline->state.sampler_views[aaline->fs->sampler_unit], + pipe_sampler_view_reference(pipe, &aaline->state.sampler_views[aaline->fs->sampler_unit], aaline->sampler_view); draw->suspend_flushing = TRUE; @@ -770,7 +770,7 @@ aaline_destroy(struct draw_stage *stage) uint i; for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { - pipe_sampler_view_reference(&aaline->state.sampler_views[i], NULL); + pipe_sampler_view_reference(pipe, &aaline->state.sampler_views[i], NULL); } if (aaline->sampler_cso) @@ -780,7 +780,7 @@ aaline_destroy(struct draw_stage *stage) pipe_resource_reference(&aaline->texture, NULL); if (aaline->sampler_view) { - pipe_sampler_view_reference(&aaline->sampler_view, NULL); + pipe_sampler_view_reference(pipe, &aaline->sampler_view, NULL); } draw_free_temp_verts( stage ); @@ -914,10 +914,10 @@ aaline_set_sampler_views(struct pipe_context *pipe, /* save current */ for (i = 0; i < num; i++) { - pipe_sampler_view_reference(&aaline->state.sampler_views[i], views[i]); + pipe_sampler_view_reference(pipe, &aaline->state.sampler_views[i], views[i]); } for ( ; i < PIPE_MAX_SAMPLERS; i++) { - pipe_sampler_view_reference(&aaline->state.sampler_views[i], NULL); + pipe_sampler_view_reference(pipe, &aaline->state.sampler_views[i], NULL); } aaline->num_sampler_views = num; diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c index 808c7cd..f004024 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c @@ -541,7 +541,7 @@ pstip_first_tri(struct draw_stage *stage, struct prim_header *header) /* plug in our sampler, texture */ pstip->state.samplers[pstip->fs->sampler_unit] = pstip->sampler_cso; - pipe_sampler_view_reference(&pstip->state.sampler_views[pstip->fs->sampler_unit], + pipe_sampler_view_reference(pipe, &pstip->state.sampler_views[pstip->fs->sampler_unit], pstip->sampler_view); assert(num_samplers <= PIPE_MAX_SAMPLERS); @@ -593,7 +593,7 @@ pstip_destroy(struct draw_stage *stage) uint i; for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { - pipe_sampler_view_reference(&pstip->state.sampler_views[i], NULL); + pipe_sampler_view_reference(pstip->pipe, &pstip->state.sampler_views[i], NULL); } pstip->pipe->delete_sampler_state(pstip->pipe, pstip->sampler_cso); @@ -601,7 +601,7 @@ pstip_destroy(struct draw_stage *stage) pipe_resource_reference(&pstip->texture, NULL); if (pstip->sampler_view) { - pipe_sampler_view_reference(&pstip->sampler_view, NULL); + pipe_sampler_view_reference(pstip->pipe, &pstip->sampler_view, NULL); } draw_free_temp_verts( stage ); @@ -729,10 +729,10 @@ pstip_set_sampler_views(struct pipe_context *pipe, /* save current */ for (i = 0; i < num; i++) { - pipe_sampler_view_reference(&pstip->state.sampler_views[i], views[i]); + pipe_sampler_view_reference(pstip->pipe, &pstip->state.sampler_views[i], views[i]); } for (; i < PIPE_MAX_SAMPLERS; i++) { - pipe_sampler_view_reference(&pstip->state.sampler_views[i], NULL); + pipe_sampler_view_reference(pstip->pipe, &pstip->state.sampler_views[i], NULL); } pstip->num_sampler_views = num; diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c index de032b6..5dedcb5 100644 --- a/src/gallium/auxiliary/hud/hud_context.c +++ b/src/gallium/auxiliary/hud/hud_context.c @@ -1088,7 +1088,7 @@ hud_destroy(struct hud_context *hud) pipe->delete_fs_state(pipe, hud->fs_color); pipe->delete_fs_state(pipe, hud->fs_text); pipe->delete_vs_state(pipe, hud->vs); - pipe_sampler_view_reference(&hud->font_sampler_view, NULL); + pipe_sampler_view_reference(pipe, &hud->font_sampler_view, NULL); pipe_resource_reference(&hud->font.texture, NULL); u_upload_destroy(hud->uploader); FREE(hud); diff --git a/src/gallium/auxiliary/postprocess/pp_mlaa.c b/src/gallium/auxiliary/postprocess/pp_mlaa.c index 6d9fa9a..08a3e5e 100644 --- a/src/gallium/auxiliary/postprocess/pp_mlaa.c +++ b/src/gallium/auxiliary/postprocess/pp_mlaa.c @@ -165,7 +165,7 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct pipe_resource *in, pp_filter_draw(p); pp_filter_end_pass(p); - pipe_sampler_view_reference(&arr[1], NULL); + pipe_sampler_view_reference(p->pipe, &arr[1], NULL); /* Third pass: smoothed edges */ @@ -199,7 +199,7 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct pipe_resource *in, pp_filter_draw(p); pp_filter_end_pass(p); - pipe_sampler_view_reference(&arr[0], NULL); + pipe_sampler_view_reference(p->pipe, &arr[0], NULL); p->blend.rt[0].blend_enable = 0; p->framebuffer.zsbuf = NULL; diff --git a/src/gallium/auxiliary/postprocess/pp_run.c b/src/gallium/auxiliary/postprocess/pp_run.c index 8b3f451..107d2c6 100644 --- a/src/gallium/auxiliary/postprocess/pp_run.c +++ b/src/gallium/auxiliary/postprocess/pp_run.c @@ -179,7 +179,7 @@ void pp_filter_end_pass(struct program *p) { pipe_surface_reference(&p->framebuffer.cbufs[0], NULL); - pipe_sampler_view_reference(&p->view, NULL); + pipe_sampler_view_reference_old(&p->view, NULL); } /** diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index cda66d1..c2a82b1 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -736,7 +736,7 @@ util_blit_pixels(struct blit_state *ctx, views[1] = pipe->create_sampler_view(pipe, views[0]->texture, &templ); cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, 2, views); - pipe_sampler_view_reference(&views[1], NULL); + pipe_sampler_view_reference(pipe, &views[1], NULL); } else { cso_set_sampler_views(ctx->cso, PIPE_SHADER_FRAGMENT, 1, &sampler_view); @@ -804,7 +804,7 @@ util_blit_pixels(struct blit_state *ctx, cso_restore_stream_outputs(ctx->cso); cso_restore_render_condition(ctx->cso); - pipe_sampler_view_reference(&sampler_view, NULL); + pipe_sampler_view_reference(ctx->pipe, &sampler_view, NULL); if (dst_surface != dst) pipe_surface_reference(&dst_surface, NULL); } diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 8c871fd..ca06af5 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -563,7 +563,7 @@ static void blitter_restore_textures(struct blitter_context_priv *ctx) ctx->base.saved_sampler_views); for (i = 0; i < ctx->base.saved_num_sampler_views; i++) - pipe_sampler_view_reference(&ctx->base.saved_sampler_views[i], NULL); + pipe_sampler_view_reference(pipe, &ctx->base.saved_sampler_views[i], NULL); ctx->base.saved_num_sampler_views = ~0; } @@ -1254,7 +1254,7 @@ void util_blitter_copy_texture(struct blitter_context *blitter, copy_all_samples); pipe_surface_reference(&dst_view, NULL); - pipe_sampler_view_reference(&src_view, NULL); + pipe_sampler_view_reference(pipe, &src_view, NULL); } void util_blitter_blit_generic(struct blitter_context *blitter, @@ -1378,7 +1378,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter, pipe->set_fragment_sampler_views(pipe, 2, views); pipe->bind_fragment_sampler_states(pipe, 2, samplers); - pipe_sampler_view_reference(&views[1], NULL); + pipe_sampler_view_reference(pipe, &views[1], NULL); } else if (blit_stencil) { /* Set a stencil-only sampler view for it not to sample depth instead. */ struct pipe_sampler_view templ; @@ -1393,7 +1393,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter, pipe->set_fragment_sampler_views(pipe, 1, &view); pipe->bind_fragment_sampler_states(pipe, 1, &sampler_state); - pipe_sampler_view_reference(&view, NULL); + pipe_sampler_view_reference(pipe, &view, NULL); } else { pipe->set_fragment_sampler_views(pipe, 1, &src); pipe->bind_fragment_sampler_states(pipe, 1, &sampler_state); @@ -1531,7 +1531,7 @@ util_blitter_blit(struct blitter_context *blitter, info->scissor_enable ? &info->scissor : NULL, TRUE); pipe_surface_reference(&dst_view, NULL); - pipe_sampler_view_reference(&src_view, NULL); + pipe_sampler_view_reference(pipe, &src_view, NULL); } /* Clear a region of a color surface to a constant value. */ diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h index 1901584..8667c9a 100644 --- a/src/gallium/auxiliary/util/u_blitter.h +++ b/src/gallium/auxiliary/util/u_blitter.h @@ -478,7 +478,7 @@ util_blitter_save_fragment_sampler_views(struct blitter_context *blitter, blitter->saved_num_sampler_views = num_views; for (i = 0; i < num_views; i++) - pipe_sampler_view_reference(&blitter->saved_sampler_views[i], + pipe_sampler_view_reference_old(&blitter->saved_sampler_views[i], views[i]); } diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index 6e65ee6..7e01790 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -142,16 +142,28 @@ pipe_resource_reference(struct pipe_resource **ptr, struct pipe_resource *tex) } static INLINE void -pipe_sampler_view_reference(struct pipe_sampler_view **ptr, struct pipe_sampler_view *view) +pipe_sampler_view_reference(struct pipe_context *ctx, struct pipe_sampler_view **ptr, struct pipe_sampler_view *view) { struct pipe_sampler_view *old_view = *ptr; + + if (pipe_reference_described(&(*ptr)->reference, &view->reference, + (debug_reference_descriptor)debug_describe_sampler_view)) + ctx->sampler_view_destroy(ctx, old_view); + *ptr = view; +} +static INLINE void +pipe_sampler_view_reference_old(struct pipe_sampler_view **ptr, struct pipe_sampler_view *view) +{ + struct pipe_sampler_view *old_view = *ptr; + if (pipe_reference_described(&(*ptr)->reference, &view->reference, (debug_reference_descriptor)debug_describe_sampler_view)) old_view->context->sampler_view_destroy(old_view->context, old_view); *ptr = view; } + /** * Similar to pipe_sampler_view_reference() but always set the pointer to * NULL and pass in an explicit context. Passing an explicit context is a diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index 4b83087..93aad4c 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -788,7 +788,7 @@ vl_compositor_clear_layers(struct vl_compositor_state *s) s->layers[i].viewport.translate[3] = 0; for ( j = 0; j < 3; j++) - pipe_sampler_view_reference(&s->layers[i].sampler_views[j], NULL); + pipe_sampler_view_reference(s->pipe, &s->layers[i].sampler_views[j], NULL); for ( j = 0; j < 4; ++j) s->layers[i].colors[j] = v_one; } @@ -887,7 +887,7 @@ vl_compositor_set_buffer_layer(struct vl_compositor_state *s, sampler_views = buffer->get_sampler_view_components(buffer); for (i = 0; i < 3; ++i) { s->layers[layer].samplers[i] = c->sampler_linear; - pipe_sampler_view_reference(&s->layers[layer].sampler_views[i], sampler_views[i]); + pipe_sampler_view_reference(s->pipe, &s->layers[layer].sampler_views[i], sampler_views[i]); } calc_src_and_dst(&s->layers[layer], buffer->width, buffer->height, @@ -942,9 +942,9 @@ vl_compositor_set_palette_layer(struct vl_compositor_state *s, s->layers[layer].samplers[0] = c->sampler_linear; s->layers[layer].samplers[1] = c->sampler_nearest; s->layers[layer].samplers[2] = NULL; - pipe_sampler_view_reference(&s->layers[layer].sampler_views[0], indexes); - pipe_sampler_view_reference(&s->layers[layer].sampler_views[1], palette); - pipe_sampler_view_reference(&s->layers[layer].sampler_views[2], NULL); + pipe_sampler_view_reference(s->pipe, &s->layers[layer].sampler_views[0], indexes); + pipe_sampler_view_reference(s->pipe, &s->layers[layer].sampler_views[1], palette); + pipe_sampler_view_reference(s->pipe, &s->layers[layer].sampler_views[2], NULL); calc_src_and_dst(&s->layers[layer], indexes->texture->width0, indexes->texture->height0, src_rect ? *src_rect : default_rect(&s->layers[layer]), dst_rect ? *dst_rect : default_rect(&s->layers[layer])); @@ -970,9 +970,9 @@ vl_compositor_set_rgba_layer(struct vl_compositor_state *s, s->layers[layer].samplers[0] = c->sampler_linear; s->layers[layer].samplers[1] = NULL; s->layers[layer].samplers[2] = NULL; - pipe_sampler_view_reference(&s->layers[layer].sampler_views[0], rgba); - pipe_sampler_view_reference(&s->layers[layer].sampler_views[1], NULL); - pipe_sampler_view_reference(&s->layers[layer].sampler_views[2], NULL); + pipe_sampler_view_reference(s->pipe, &s->layers[layer].sampler_views[0], rgba); + pipe_sampler_view_reference(s->pipe, &s->layers[layer].sampler_views[1], NULL); + pipe_sampler_view_reference(s->pipe, &s->layers[layer].sampler_views[2], NULL); calc_src_and_dst(&s->layers[layer], rgba->texture->width0, rgba->texture->height0, src_rect ? *src_rect : default_rect(&s->layers[layer]), dst_rect ? *dst_rect : default_rect(&s->layers[layer])); diff --git a/src/gallium/auxiliary/vl/vl_idct.c b/src/gallium/auxiliary/vl/vl_idct.c index 5346cbc..72cda92 100644 --- a/src/gallium/auxiliary/vl/vl_idct.c +++ b/src/gallium/auxiliary/vl/vl_idct.c @@ -621,7 +621,7 @@ cleanup_source(struct vl_idct_buffer *buffer) pipe_surface_reference(&buffer->fb_state_mismatch.cbufs[0], NULL); - pipe_sampler_view_reference(&buffer->sampler_views.individual.source, NULL); + pipe_sampler_view_reference_old(&buffer->sampler_views.individual.source, NULL); } static bool @@ -674,7 +674,7 @@ cleanup_intermediate(struct vl_idct_buffer *buffer) for(i = 0; i < PIPE_MAX_COLOR_BUFS; ++i) pipe_surface_reference(&buffer->fb_state.cbufs[i], NULL); - pipe_sampler_view_reference(&buffer->sampler_views.individual.intermediate, NULL); + pipe_sampler_view_reference_old(&buffer->sampler_views.individual.intermediate, NULL); } struct pipe_sampler_view * @@ -758,8 +758,8 @@ bool vl_idct_init(struct vl_idct *idct, struct pipe_context *pipe, idct->buffer_height = buffer_height; idct->nr_of_render_targets = nr_of_render_targets; - pipe_sampler_view_reference(&idct->matrix, matrix); - pipe_sampler_view_reference(&idct->transpose, transpose); + pipe_sampler_view_reference(pipe, &idct->matrix, matrix); + pipe_sampler_view_reference(pipe, &idct->transpose, transpose); if(!init_shaders(idct)) return false; @@ -778,8 +778,8 @@ vl_idct_cleanup(struct vl_idct *idct) cleanup_shaders(idct); cleanup_state(idct); - pipe_sampler_view_reference(&idct->matrix, NULL); - pipe_sampler_view_reference(&idct->transpose, NULL); + pipe_sampler_view_reference_old(&idct->matrix, NULL); + pipe_sampler_view_reference_old(&idct->transpose, NULL); } bool @@ -792,10 +792,10 @@ vl_idct_init_buffer(struct vl_idct *idct, struct vl_idct_buffer *buffer, memset(buffer, 0, sizeof(struct vl_idct_buffer)); - pipe_sampler_view_reference(&buffer->sampler_views.individual.matrix, idct->matrix); - pipe_sampler_view_reference(&buffer->sampler_views.individual.source, source); - pipe_sampler_view_reference(&buffer->sampler_views.individual.transpose, idct->transpose); - pipe_sampler_view_reference(&buffer->sampler_views.individual.intermediate, intermediate); + pipe_sampler_view_reference_old(&buffer->sampler_views.individual.matrix, idct->matrix); + pipe_sampler_view_reference_old(&buffer->sampler_views.individual.source, source); + pipe_sampler_view_reference_old(&buffer->sampler_views.individual.transpose, idct->transpose); + pipe_sampler_view_reference_old(&buffer->sampler_views.individual.intermediate, intermediate); if (!init_source(idct, buffer)) return false; @@ -814,8 +814,8 @@ vl_idct_cleanup_buffer(struct vl_idct_buffer *buffer) cleanup_source(buffer); cleanup_intermediate(buffer); - pipe_sampler_view_reference(&buffer->sampler_views.individual.matrix, NULL); - pipe_sampler_view_reference(&buffer->sampler_views.individual.transpose, NULL); + pipe_sampler_view_reference_old(&buffer->sampler_views.individual.matrix, NULL); + pipe_sampler_view_reference_old(&buffer->sampler_views.individual.transpose, NULL); } void diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c index 1eb9708..6c99f03 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c @@ -137,7 +137,7 @@ error_plane: error_surface: error_sampler: - pipe_sampler_view_reference(&buffer->zscan_source, NULL); + pipe_sampler_view_reference_old(&buffer->zscan_source, NULL); error_source: return false; @@ -153,7 +153,7 @@ cleanup_zscan_buffer(struct vl_mpeg12_buffer *buffer) for (i = 0; i < VL_NUM_COMPONENTS; ++i) vl_zscan_cleanup_buffer(&buffer->zscan[i]); - pipe_sampler_view_reference(&buffer->zscan_source, NULL); + pipe_sampler_view_reference_old(&buffer->zscan_source, NULL); } static bool @@ -432,9 +432,9 @@ vl_mpeg12_destroy(struct pipe_video_decoder *decoder) pipe_resource_reference(&dec->quads.buffer, NULL); pipe_resource_reference(&dec->pos.buffer, NULL); - pipe_sampler_view_reference(&dec->zscan_linear, NULL); - pipe_sampler_view_reference(&dec->zscan_normal, NULL); - pipe_sampler_view_reference(&dec->zscan_alternate, NULL); + pipe_sampler_view_reference_old(&dec->zscan_linear, NULL); + pipe_sampler_view_reference_old(&dec->zscan_normal, NULL); + pipe_sampler_view_reference_old(&dec->zscan_alternate, NULL); for (i = 0; i < 4; ++i) if (dec->dec_buffers[i]) @@ -933,7 +933,7 @@ init_idct(struct vl_mpeg12_decoder *dec, const struct format_config* format_conf nr_of_idct_render_targets, matrix, matrix)) goto error_c; - pipe_sampler_view_reference(&matrix, NULL); + pipe_sampler_view_reference_old(&matrix, NULL); return true; @@ -941,7 +941,7 @@ error_c: vl_idct_cleanup(&dec->idct_y); error_y: - pipe_sampler_view_reference(&matrix, NULL); + pipe_sampler_view_reference_old(&matrix, NULL); error_matrix: dec->mc_source->destroy(dec->mc_source); diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c index 6ef95e4..71670eb 100644 --- a/src/gallium/auxiliary/vl/vl_video_buffer.c +++ b/src/gallium/auxiliary/vl/vl_video_buffer.c @@ -253,8 +253,8 @@ vl_video_buffer_destroy(struct pipe_video_buffer *buffer) assert(buf); for (i = 0; i < VL_NUM_COMPONENTS; ++i) { - pipe_sampler_view_reference(&buf->sampler_view_planes[i], NULL); - pipe_sampler_view_reference(&buf->sampler_view_components[i], NULL); + pipe_sampler_view_reference(buf->base.context ,&buf->sampler_view_planes[i], NULL); + pipe_sampler_view_reference(buf->base.context, &buf->sampler_view_components[i], NULL); pipe_resource_reference(&buf->resources[i], NULL); } @@ -296,7 +296,7 @@ vl_video_buffer_sampler_view_planes(struct pipe_video_buffer *buffer) error: for (i = 0; i < buf->num_planes; ++i ) - pipe_sampler_view_reference(&buf->sampler_view_planes[i], NULL); + pipe_sampler_view_reference(pipe, &buf->sampler_view_planes[i], NULL); return NULL; } @@ -344,7 +344,7 @@ vl_video_buffer_sampler_view_components(struct pipe_video_buffer *buffer) error: for (i = 0; i < VL_NUM_COMPONENTS; ++i ) - pipe_sampler_view_reference(&buf->sampler_view_components[i], NULL); + pipe_sampler_view_reference(pipe, &buf->sampler_view_components[i], NULL); return NULL; } diff --git a/src/gallium/auxiliary/vl/vl_zscan.c b/src/gallium/auxiliary/vl/vl_zscan.c index 33baa3d..456e53f 100644 --- a/src/gallium/auxiliary/vl/vl_zscan.c +++ b/src/gallium/auxiliary/vl/vl_zscan.c @@ -465,7 +465,7 @@ vl_zscan_init_buffer(struct vl_zscan *zscan, struct vl_zscan_buffer *buffer, memset(buffer, 0, sizeof(struct vl_zscan_buffer)); - pipe_sampler_view_reference(&buffer->src, src); + pipe_sampler_view_reference_old(&buffer->src, src); buffer->viewport.scale[0] = dst->width; buffer->viewport.scale[1] = dst->height; @@ -511,9 +511,9 @@ vl_zscan_cleanup_buffer(struct vl_zscan_buffer *buffer) { assert(buffer); - pipe_sampler_view_reference(&buffer->src, NULL); - pipe_sampler_view_reference(&buffer->layout, NULL); - pipe_sampler_view_reference(&buffer->quant, NULL); + pipe_sampler_view_reference_old(&buffer->src, NULL); + pipe_sampler_view_reference_old(&buffer->layout, NULL); + pipe_sampler_view_reference_old(&buffer->quant, NULL); pipe_surface_reference(&buffer->fb_state.cbufs[0], NULL); } @@ -523,7 +523,7 @@ vl_zscan_set_layout(struct vl_zscan_buffer *buffer, struct pipe_sampler_view *la assert(buffer); assert(layout); - pipe_sampler_view_reference(&buffer->layout, layout); + pipe_sampler_view_reference_old(&buffer->layout, layout); } void diff --git a/src/gallium/drivers/freedreno/freedreno_texture.c b/src/gallium/drivers/freedreno/freedreno_texture.c index 3ea51ce..ce5c88a 100644 --- a/src/gallium/drivers/freedreno/freedreno_texture.c +++ b/src/gallium/drivers/freedreno/freedreno_texture.c @@ -168,12 +168,12 @@ static void set_sampler_views(struct fd_texture_stateobj *prog, unsigned i; for (i = 0; i < nr; i++) { - pipe_sampler_view_reference(&prog->textures[i], views[i]); + pipe_sampler_view_reference_old(&prog->textures[i], views[i]); prog->dirty_samplers |= (1 << i); } for (; i < prog->num_textures; i++) { - pipe_sampler_view_reference(&prog->textures[i], NULL); + pipe_sampler_view_reference_old(&prog->textures[i], NULL); prog->dirty_samplers |= (1 << i); } diff --git a/src/gallium/drivers/galahad/glhd_objects.c b/src/gallium/drivers/galahad/glhd_objects.c index e4a8f28..28b10e1 100644 --- a/src/gallium/drivers/galahad/glhd_objects.c +++ b/src/gallium/drivers/galahad/glhd_objects.c @@ -140,7 +140,7 @@ void galahad_sampler_view_destroy(struct galahad_context *glhd_context, struct galahad_sampler_view *glhd_view) { - pipe_sampler_view_reference(&glhd_view->sampler_view, NULL); + pipe_sampler_view_reference_old(&glhd_view->sampler_view, NULL); pipe_resource_reference(&glhd_view->base.texture, NULL); FREE(glhd_view); } diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index 06d4d3b..d4e3474 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -719,7 +719,7 @@ static void i915_set_fragment_sampler_views(struct pipe_context *pipe, * was already destroyed. */ pipe_sampler_view_release(pipe, &i915->fragment_sampler_views[i]); - pipe_sampler_view_reference(&i915->fragment_sampler_views[i], + pipe_sampler_view_reference(pipe, &i915->fragment_sampler_views[i], views[i]); } @@ -750,7 +750,7 @@ i915_set_vertex_sampler_views(struct pipe_context *pipe, for (i = 0; i < Elements(i915->vertex_sampler_views); i++) { struct pipe_sampler_view *view = i < num ? views[i] : NULL; - pipe_sampler_view_reference(&i915->vertex_sampler_views[i], view); + pipe_sampler_view_reference(pipe, &i915->vertex_sampler_views[i], view); } i915->num_vertex_sampler_views = num; diff --git a/src/gallium/drivers/ilo/ilo_state.c b/src/gallium/drivers/ilo/ilo_state.c index 3b9e8cb..31b4f80 100644 --- a/src/gallium/drivers/ilo/ilo_state.c +++ b/src/gallium/drivers/ilo/ilo_state.c @@ -644,11 +644,11 @@ set_sampler_views(struct ilo_context *ilo, } for (i = 0; i < start; i++) - pipe_sampler_view_reference(&dst[i], NULL); + pipe_sampler_view_reference(ilo->pipe, &dst[i], NULL); for (; i < start + count; i++) - pipe_sampler_view_reference(&dst[i], views[i - start]); + pipe_sampler_view_reference(ilo->pipe, &dst[i], views[i - start]); for (; i < ilo->view[shader].count; i++) - pipe_sampler_view_reference(&dst[i], NULL); + pipe_sampler_view_reference(ilo->pipe, &dst[i], NULL); ilo->view[shader].count = start + count; @@ -658,11 +658,11 @@ set_sampler_views(struct ilo_context *ilo, dst += start; if (views) { for (i = 0; i < count; i++) - pipe_sampler_view_reference(&dst[i], views[i]); + pipe_sampler_view_reference(ilo->pipe, &dst[i], views[i]); } else { for (i = 0; i < count; i++) - pipe_sampler_view_reference(&dst[i], NULL); + pipe_sampler_view_reference(ilo->pipe, &dst[i], NULL); } if (ilo->view[shader].count <= start + count) { @@ -1130,7 +1130,7 @@ ilo_cleanup_states(struct ilo_context *ilo) for (sh = 0; sh < PIPE_SHADER_TYPES; sh++) { for (i = 0; i < ilo->view[sh].count; i++) { struct pipe_sampler_view *view = ilo->view[sh].states[i]; - pipe_sampler_view_reference(&view, NULL); + pipe_sampler_view_reference(ilo->pipe, &view, NULL); } for (i = 0; i < Elements(ilo->cbuf[sh].cso); i++) { diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index a6d7e59..dd6d70d 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -74,15 +74,15 @@ static void llvmpipe_destroy( struct pipe_context *pipe ) pipe_surface_reference(&llvmpipe->framebuffer.zsbuf, NULL); for (i = 0; i < Elements(llvmpipe->sampler_views[0]); i++) { - pipe_sampler_view_reference(&llvmpipe->sampler_views[PIPE_SHADER_FRAGMENT][i], NULL); + pipe_sampler_view_reference(pipe, &llvmpipe->sampler_views[PIPE_SHADER_FRAGMENT][i], NULL); } for (i = 0; i < Elements(llvmpipe->sampler_views[0]); i++) { - pipe_sampler_view_reference(&llvmpipe->sampler_views[PIPE_SHADER_VERTEX][i], NULL); + pipe_sampler_view_reference(pipe, &llvmpipe->sampler_views[PIPE_SHADER_VERTEX][i], NULL); } for (i = 0; i < Elements(llvmpipe->sampler_views[0]); i++) { - pipe_sampler_view_reference(&llvmpipe->sampler_views[PIPE_SHADER_GEOMETRY][i], NULL); + pipe_sampler_view_reference(pipe, &llvmpipe->sampler_views[PIPE_SHADER_GEOMETRY][i], NULL); } for (i = 0; i < Elements(llvmpipe->constants); i++) { diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c index ee2e444..de157b7 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c +++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c @@ -159,7 +159,7 @@ llvmpipe_set_sampler_views(struct pipe_context *pipe, /* set the new sampler views */ for (i = 0; i < num; i++) { - pipe_sampler_view_reference(&llvmpipe->sampler_views[shader][start + i], + pipe_sampler_view_reference(pipe, &llvmpipe->sampler_views[shader][start + i], views[i]); } diff --git a/src/gallium/drivers/nouveau/nouveau_video.c b/src/gallium/drivers/nouveau/nouveau_video.c index 9357508..8f3a849 100644 --- a/src/gallium/drivers/nouveau/nouveau_video.c +++ b/src/gallium/drivers/nouveau/nouveau_video.c @@ -684,7 +684,7 @@ nouveau_video_buffer_sampler_view_planes(struct pipe_video_buffer *buffer) error: for (i = 0; i < buf->num_planes; ++i ) - pipe_sampler_view_reference(&buf->sampler_view_planes[i], NULL); + pipe_sampler_view_reference(pipe, &buf->sampler_view_planes[i], NULL); return NULL; } @@ -723,7 +723,7 @@ nouveau_video_buffer_sampler_view_components(struct pipe_video_buffer *buffer) error: for (i = 0; i < 3; ++i ) - pipe_sampler_view_reference(&buf->sampler_view_components[i], NULL); + pipe_sampler_view_reference(pipe, &buf->sampler_view_components[i], NULL); return NULL; } @@ -769,12 +769,12 @@ nouveau_video_buffer_destroy(struct pipe_video_buffer *buffer) for (i = 0; i < buf->num_planes; ++i) { pipe_surface_reference(&buf->surfaces[i], NULL); - pipe_sampler_view_reference(&buf->sampler_view_planes[i], NULL); - pipe_sampler_view_reference(&buf->sampler_view_components[i], NULL); + pipe_sampler_view_reference(buf->base.context, &buf->sampler_view_planes[i], NULL); + pipe_sampler_view_reference(buf->base.context, &buf->sampler_view_components[i], NULL); pipe_resource_reference(&buf->resources[i], NULL); } for (;i < 3;++i) - pipe_sampler_view_reference(&buf->sampler_view_components[i], NULL); + pipe_sampler_view_reference(buf->base.context, &buf->sampler_view_components[i], NULL); FREE(buffer); } diff --git a/src/gallium/drivers/nv30/nv30_fragtex.c b/src/gallium/drivers/nv30/nv30_fragtex.c index 1d22cc3..491f19a 100644 --- a/src/gallium/drivers/nv30/nv30_fragtex.c +++ b/src/gallium/drivers/nv30/nv30_fragtex.c @@ -180,13 +180,13 @@ nv30_fragtex_set_sampler_views(struct pipe_context *pipe, unsigned nr, for (i = 0; i < nr; i++) { nouveau_bufctx_reset(nv30->bufctx, BUFCTX_FRAGTEX(i)); - pipe_sampler_view_reference(&nv30->fragprog.textures[i], views[i]); + pipe_sampler_view_reference(pipe, &nv30->fragprog.textures[i], views[i]); nv30->fragprog.dirty_samplers |= (1 << i); } for (; i < nv30->fragprog.num_textures; i++) { nouveau_bufctx_reset(nv30->bufctx, BUFCTX_FRAGTEX(i)); - pipe_sampler_view_reference(&nv30->fragprog.textures[i], NULL); + pipe_sampler_view_reference(pipe, &nv30->fragprog.textures[i], NULL); nv30->fragprog.dirty_samplers |= (1 << i); } diff --git a/src/gallium/drivers/nv30/nv40_verttex.c b/src/gallium/drivers/nv30/nv40_verttex.c index 4ff2278..2bbd23e 100644 --- a/src/gallium/drivers/nv30/nv40_verttex.c +++ b/src/gallium/drivers/nv30/nv40_verttex.c @@ -78,13 +78,13 @@ nv40_verttex_set_sampler_views(struct pipe_context *pipe, unsigned nr, for (i = 0; i < nr; i++) { nouveau_bufctx_reset(nv30->bufctx, BUFCTX_VERTTEX(i)); - pipe_sampler_view_reference(&nv30->vertprog.textures[i], views[i]); + pipe_sampler_view_reference(pipe, &nv30->vertprog.textures[i], views[i]); nv30->vertprog.dirty_samplers |= (1 << i); } for (; i < nv30->vertprog.num_textures; i++) { nouveau_bufctx_reset(nv30->bufctx, BUFCTX_VERTTEX(i)); - pipe_sampler_view_reference(&nv30->vertprog.textures[i], NULL); + pipe_sampler_view_reference(pipe, &nv30->vertprog.textures[i], NULL); nv30->vertprog.dirty_samplers |= (1 << i); } diff --git a/src/gallium/drivers/nv50/nv50_context.c b/src/gallium/drivers/nv50/nv50_context.c index 5781c4b..422842a 100644 --- a/src/gallium/drivers/nv50/nv50_context.c +++ b/src/gallium/drivers/nv50/nv50_context.c @@ -87,7 +87,7 @@ nv50_context_unreference_resources(struct nv50_context *nv50) for (s = 0; s < 3; ++s) { for (i = 0; i < nv50->num_textures[s]; ++i) - pipe_sampler_view_reference(&nv50->textures[s][i], NULL); + pipe_sampler_view_reference(&nv50->base.pipe, &nv50->textures[s][i], NULL); for (i = 0; i < NV50_MAX_PIPE_CONSTBUFS; ++i) if (!nv50->constbuf[s][i].user) diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c index 2454a3d..6fbc6e9 100644 --- a/src/gallium/drivers/nv50/nv50_state.c +++ b/src/gallium/drivers/nv50/nv50_state.c @@ -630,7 +630,7 @@ nv50_stage_set_sampler_views(struct nv50_context *nv50, int s, if (old) nv50_screen_tic_unlock(nv50->screen, old); - pipe_sampler_view_reference(&nv50->textures[s][i], views[i]); + pipe_sampler_view_reference(&nv50->base.pipe, &nv50->textures[s][i], views[i]); } for (i = nr; i < nv50->num_textures[s]; ++i) { @@ -639,7 +639,7 @@ nv50_stage_set_sampler_views(struct nv50_context *nv50, int s, continue; nv50_screen_tic_unlock(nv50->screen, old); - pipe_sampler_view_reference(&nv50->textures[s][i], NULL); + pipe_sampler_view_reference(&nv50->base.pipe, &nv50->textures[s][i], NULL); } nv50->num_textures[s] = nr; diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index 2bfd855..2c3aa7d 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -888,8 +888,8 @@ nv50_blitctx_post_blit(struct nv50_blitctx *blit) nv50->gmtyprog = blit->saved.gp; nv50->fragprog = blit->saved.fp; - pipe_sampler_view_reference(&nv50->textures[2][0], NULL); - pipe_sampler_view_reference(&nv50->textures[2][1], NULL); + pipe_sampler_view_reference(&nv50->base.pipe, &nv50->textures[2][0], NULL); + pipe_sampler_view_reference(&nv50->base.pipe, &nv50->textures[2][1], NULL); for (s = 0; s < 3; ++s) { nv50->num_textures[s] = blit->saved.num_textures[s]; diff --git a/src/gallium/drivers/nvc0/nvc0_context.c b/src/gallium/drivers/nvc0/nvc0_context.c index cd86040..04f301e 100644 --- a/src/gallium/drivers/nvc0/nvc0_context.c +++ b/src/gallium/drivers/nvc0/nvc0_context.c @@ -74,7 +74,7 @@ nvc0_context_unreference_resources(struct nvc0_context *nvc0) for (s = 0; s < 6; ++s) { for (i = 0; i < nvc0->num_textures[s]; ++i) - pipe_sampler_view_reference(&nvc0->textures[s][i], NULL); + pipe_sampler_view_reference(&nvc0->base.pipe, &nvc0->textures[s][i], NULL); for (i = 0; i < NVC0_MAX_PIPE_CONSTBUFS; ++i) if (!nvc0->constbuf[s][i].user) diff --git a/src/gallium/drivers/nvc0/nvc0_state.c b/src/gallium/drivers/nvc0/nvc0_state.c index 2f40369..01358c9 100644 --- a/src/gallium/drivers/nvc0/nvc0_state.c +++ b/src/gallium/drivers/nvc0/nvc0_state.c @@ -571,7 +571,7 @@ nvc0_stage_set_sampler_views(struct nvc0_context *nvc0, int s, nvc0_screen_tic_unlock(nvc0->screen, old); } - pipe_sampler_view_reference(&nvc0->textures[s][i], views[i]); + pipe_sampler_view_reference(&nvc0->base.pipe, &nvc0->textures[s][i], views[i]); } for (i = nr; i < nvc0->num_textures[s]; ++i) { @@ -579,7 +579,7 @@ nvc0_stage_set_sampler_views(struct nvc0_context *nvc0, int s, if (old) { nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_TEX(s, i)); nvc0_screen_tic_unlock(nvc0->screen, old); - pipe_sampler_view_reference(&nvc0->textures[s][i], NULL); + pipe_sampler_view_reference(&nvc0->base.pipe, &nvc0->textures[s][i], NULL); } } @@ -637,7 +637,7 @@ nvc0_stage_set_sampler_views_range(struct nvc0_context *nvc0, const unsigned s, nouveau_bufctx_reset(bctx, bin + i); nvc0_screen_tic_unlock(nvc0->screen, old); } - pipe_sampler_view_reference(&nvc0->textures[s][i], views[p]); + pipe_sampler_view_reference(&nvc0->base.pipe, &nvc0->textures[s][i], views[p]); } } else { for (i = start; i < end; ++i) { @@ -647,7 +647,7 @@ nvc0_stage_set_sampler_views_range(struct nvc0_context *nvc0, const unsigned s, nvc0->textures_dirty[s] |= 1 << i; nvc0_screen_tic_unlock(nvc0->screen, old); - pipe_sampler_view_reference(&nvc0->textures[s][i], NULL); + pipe_sampler_view_reference(&nvc0->base.pipe, &nvc0->textures[s][i], NULL); nouveau_bufctx_reset(bctx, bin + i); } } diff --git a/src/gallium/drivers/nvc0/nvc0_surface.c b/src/gallium/drivers/nvc0/nvc0_surface.c index e02cf22..6f6b1cb 100644 --- a/src/gallium/drivers/nvc0/nvc0_surface.c +++ b/src/gallium/drivers/nvc0/nvc0_surface.c @@ -782,8 +782,8 @@ nvc0_blitctx_post_blit(struct nvc0_blitctx *blit) nvc0->gmtyprog = blit->saved.gp; nvc0->fragprog = blit->saved.fp; - pipe_sampler_view_reference(&nvc0->textures[4][0], NULL); - pipe_sampler_view_reference(&nvc0->textures[4][1], NULL); + pipe_sampler_view_reference(&nvc0->base.pipe, &nvc0->textures[4][0], NULL); + pipe_sampler_view_reference(&nvc0->base.pipe, &nvc0->textures[4][1], NULL); for (s = 0; s <= 4; ++s) { nvc0->num_textures[s] = blit->saved.num_textures[s]; diff --git a/src/gallium/drivers/nvc0/nvc0_video.c b/src/gallium/drivers/nvc0/nvc0_video.c index 3c50016..f770318 100644 --- a/src/gallium/drivers/nvc0/nvc0_video.c +++ b/src/gallium/drivers/nvc0/nvc0_video.c @@ -531,8 +531,8 @@ nvc0_video_buffer_destroy(struct pipe_video_buffer *buffer) for (i = 0; i < VL_NUM_COMPONENTS; ++i) { pipe_resource_reference(&buf->resources[i], NULL); - pipe_sampler_view_reference(&buf->sampler_view_planes[i], NULL); - pipe_sampler_view_reference(&buf->sampler_view_components[i], NULL); + pipe_sampler_view_reference_old(&buf->sampler_view_planes[i], NULL); + pipe_sampler_view_reference_old(&buf->sampler_view_components[i], NULL); pipe_surface_reference(&buf->surfaces[i * 2], NULL); pipe_surface_reference(&buf->surfaces[i * 2 + 1], NULL); } diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c index 76f8327..c651ab6 100644 --- a/src/gallium/drivers/r300/r300_blit.c +++ b/src/gallium/drivers/r300/r300_blit.c @@ -676,7 +676,7 @@ static void r300_resource_copy_region(struct pipe_context *pipe, r300_blitter_end(r300); pipe_surface_reference(&dst_view, NULL); - pipe_sampler_view_reference(&src_view, NULL); + pipe_sampler_view_reference(pipe, &src_view, NULL); } static boolean r300_is_simple_msaa_resolve(const struct pipe_blit_info *info) diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 7647f9e..6c2251e 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -50,12 +50,12 @@ static void r300_release_referenced_objects(struct r300_context *r300) /* Textures. */ for (i = 0; i < textures->sampler_view_count; i++) - pipe_sampler_view_reference( + pipe_sampler_view_reference(&r300->context, (struct pipe_sampler_view**)&textures->sampler_views[i], NULL); /* The special dummy texture for texkill. */ if (r300->texkill_sampler) { - pipe_sampler_view_reference( + pipe_sampler_view_reference(&r300->context, (struct pipe_sampler_view**)&r300->texkill_sampler, NULL); } diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 6cfc192..b942c84 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -1602,6 +1602,7 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe, for (i = 0; i < count; i++) { pipe_sampler_view_reference( + &r300->context, (struct pipe_sampler_view**)&state->sampler_views[i], views[i]); @@ -1627,6 +1628,7 @@ static void r300_set_fragment_sampler_views(struct pipe_context* pipe, for (i = count; i < tex_units; i++) { if (state->sampler_views[i]) { pipe_sampler_view_reference( + &r300->context, (struct pipe_sampler_view**)&state->sampler_views[i], NULL); } diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 1013557..5050afe 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -978,6 +978,7 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300) * the first unit enabled all the time. */ if (i == 0 && !r300->screen->caps.is_r500) { pipe_sampler_view_reference( + &r300->context, (struct pipe_sampler_view**)&state->sampler_views[i], &r300->texkill_sampler->base); diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c index 058bf81..f086a0d 100644 --- a/src/gallium/drivers/r600/r600_blit.c +++ b/src/gallium/drivers/r600/r600_blit.c @@ -686,7 +686,7 @@ static void r600_resource_copy_region(struct pipe_context *ctx, r600_blitter_end(ctx); pipe_surface_reference(&dst_view, NULL); - pipe_sampler_view_reference(&src_view, NULL); + pipe_sampler_view_reference(ctx, &src_view, NULL); } /* For MSAA integer resolving to work, we change the format to NORM using this function. */ diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 4995c81..82f0743 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -588,7 +588,7 @@ static void r600_set_sampler_views(struct pipe_context *pipe, unsigned shader, i = u_bit_scan(&remaining_mask); assert(dst->views.views[i]); - pipe_sampler_view_reference((struct pipe_sampler_view **)&dst->views.views[i], NULL); + pipe_sampler_view_reference(pipe, (struct pipe_sampler_view **)&dst->views.views[i], NULL); } for (i = 0; i < count; i++) { @@ -623,11 +623,11 @@ static void r600_set_sampler_views(struct pipe_context *pipe, unsigned shader, dirty_sampler_states_mask |= 1 << i; } - pipe_sampler_view_reference((struct pipe_sampler_view **)&dst->views.views[i], views[i]); + pipe_sampler_view_reference(pipe, (struct pipe_sampler_view **)&dst->views.views[i], views[i]); new_mask |= 1 << i; r600_context_add_resource_size(pipe, views[i]->texture); } else { - pipe_sampler_view_reference((struct pipe_sampler_view **)&dst->views.views[i], NULL); + pipe_sampler_view_reference(pipe, (struct pipe_sampler_view **)&dst->views.views[i], NULL); disable_mask |= 1 << i; } } diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 0dc74bc..f5cc60e 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -2354,6 +2354,7 @@ static struct si_pm4_state *si_set_sampler_view(struct r600_context *rctx, si_pm4_sh_data_begin(pm4); for (i = 0; i < count; i++) { pipe_sampler_view_reference( + rctx->pipe, (struct pipe_sampler_view **)&samplers->views[i], views[i]); @@ -2379,7 +2380,7 @@ static struct si_pm4_state *si_set_sampler_view(struct r600_context *rctx, for (i = count; i < NUM_TEX_UNITS; i++) { if (samplers->views[i]) - pipe_sampler_view_reference((struct pipe_sampler_view **)&samplers->views[i], NULL); + pipe_sampler_view_reference(rctx->pipe, (struct pipe_sampler_view **)&samplers->views[i], NULL); } si_pm4_sh_data_end(pm4, user_data_reg, SI_SGPR_RESOURCE); diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 141b7a8..d4be968 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -65,7 +65,7 @@ softpipe_destroy( struct pipe_context *pipe ) pipe->delete_sampler_state(pipe, softpipe->pstipple.sampler); pipe_resource_reference(&softpipe->pstipple.texture, NULL); - pipe_sampler_view_reference(&softpipe->pstipple.sampler_view, NULL); + pipe_sampler_view_reference(pipe, &softpipe->pstipple.sampler_view, NULL); #endif if (softpipe->blitter) { @@ -98,7 +98,7 @@ softpipe_destroy( struct pipe_context *pipe ) for (sh = 0; sh < Elements(softpipe->tex_cache); sh++) { for (i = 0; i < Elements(softpipe->tex_cache[0]); i++) { sp_destroy_tex_tile_cache(softpipe->tex_cache[sh][i]); - pipe_sampler_view_reference(&softpipe->sampler_views[sh][i], NULL); + pipe_sampler_view_reference(pipe, &softpipe->sampler_views[sh][i], NULL); } } diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 6115349..1f72fda 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -312,8 +312,8 @@ update_polygon_stipple_pattern(struct softpipe_context *softpipe) view = util_pstipple_create_sampler_view(&softpipe->pipe, softpipe->pstipple.texture); - pipe_sampler_view_reference(&softpipe->pstipple.sampler_view, view); - pipe_sampler_view_reference(&view, NULL); + pipe_sampler_view_reference(&softpipe->pipe, &softpipe->pstipple.sampler_view, view); + pipe_sampler_view_reference(&softpipe->pipe, &view, NULL); } diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index aeb2b9d..10ea0ad 100644 --- a/src/gallium/drivers/softpipe/sp_state_sampler.c +++ b/src/gallium/drivers/softpipe/sp_state_sampler.c @@ -155,7 +155,7 @@ softpipe_set_sampler_views(struct pipe_context *pipe, struct sp_sampler_view *sp_sviewdst = &softpipe->tgsi.sampler[shader]->sp_sview[start + i]; struct pipe_sampler_view **pview = &softpipe->sampler_views[shader][start + i]; - pipe_sampler_view_reference(pview, views[i]); + pipe_sampler_view_reference(pipe, pview, views[i]); sp_tex_tile_cache_set_sampler_view(softpipe->tex_cache[shader][start + i], views[i]); /* diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c index 03d604d..ccf79b9 100644 --- a/src/gallium/drivers/svga/svga_pipe_sampler.c +++ b/src/gallium/drivers/svga/svga_pipe_sampler.c @@ -263,7 +263,7 @@ svga_set_sampler_views(struct pipe_context *pipe, * was already destroyed. */ pipe_sampler_view_release(pipe, &svga->curr.sampler_views[start + i]); - pipe_sampler_view_reference(&svga->curr.sampler_views[start + i], + pipe_sampler_view_reference(pipe, &svga->curr.sampler_views[start + i], views[i]); } diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index ee23077..4a47082 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -867,7 +867,7 @@ trace_context_sampler_view_destroy(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, view); - pipe_sampler_view_reference(&tr_view->sampler_view, NULL); + pipe_sampler_view_reference(pipe, &tr_view->sampler_view, NULL); trace_dump_call_end(); diff --git a/src/gallium/state_trackers/vdpau/bitmap.c b/src/gallium/state_trackers/vdpau/bitmap.c index 469f3e8..d1ea5a1 100644 --- a/src/gallium/state_trackers/vdpau/bitmap.c +++ b/src/gallium/state_trackers/vdpau/bitmap.c @@ -114,13 +114,14 @@ VdpStatus vlVdpBitmapSurfaceDestroy(VdpBitmapSurface surface) { vlVdpBitmapSurface *vlsurface; + struct pipe_context *pipe; vlsurface = vlGetDataHTAB(surface); if (!vlsurface) return VDP_STATUS_INVALID_HANDLE; - + pipe = vlsurface->device->context; pipe_mutex_lock(vlsurface->device->mutex); - pipe_sampler_view_reference(&vlsurface->sampler_view, NULL); + pipe_sampler_view_reference(pipe, &vlsurface->sampler_view, NULL); pipe_mutex_unlock(vlsurface->device->mutex); vlRemoveDataHTAB(surface); diff --git a/src/gallium/state_trackers/vdpau/device.c b/src/gallium/state_trackers/vdpau/device.c index a829c27..a23314c 100644 --- a/src/gallium/state_trackers/vdpau/device.c +++ b/src/gallium/state_trackers/vdpau/device.c @@ -264,7 +264,8 @@ vlVdpResolveDelayedRendering(vlVdpDevice *dev, struct pipe_surface *surface, str { struct vl_compositor_state *cstate; vlVdpOutputSurface *vlsurface; - + struct pipe_context * pipe; + assert(dev); cstate = dev->delayed_rendering.cstate; @@ -274,6 +275,8 @@ vlVdpResolveDelayedRendering(vlVdpDevice *dev, struct pipe_surface *surface, str vlsurface = vlGetDataHTAB(dev->delayed_rendering.surface); if (!vlsurface) return; + + pipe = vlsurface->device->context; if (!surface) { surface = vlsurface->surface; @@ -291,7 +294,7 @@ vlVdpResolveDelayedRendering(vlVdpDevice *dev, struct pipe_surface *surface, str struct pipe_sampler_view sv_templ; vlVdpDefaultSamplerViewTemplate(&sv_templ, res); - pipe_sampler_view_reference(&vlsurface->sampler_view, NULL); + pipe_sampler_view_reference(pipe, &vlsurface->sampler_view, NULL); vlsurface->sampler_view = dev->context->create_sampler_view(dev->context, res, &sv_templ); } diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c index 7266cdb..1b2ee42 100644 --- a/src/gallium/state_trackers/vdpau/output.c +++ b/src/gallium/state_trackers/vdpau/output.c @@ -145,7 +145,7 @@ vlVdpOutputSurfaceDestroy(VdpOutputSurface surface) vlVdpResolveDelayedRendering(vlsurface->device, NULL, NULL); pipe_surface_reference(&vlsurface->surface, NULL); - pipe_sampler_view_reference(&vlsurface->sampler_view, NULL); + pipe_sampler_view_reference(pipe, &vlsurface->sampler_view, NULL); pipe->screen->fence_reference(pipe->screen, &vlsurface->fence, NULL); vl_compositor_cleanup_state(&vlsurface->cstate); pipe_mutex_unlock(vlsurface->device->mutex); @@ -283,11 +283,14 @@ vlVdpOutputSurfacePutBitsIndexed(VdpOutputSurface surface, struct pipe_box box; struct u_rect dst_rect; + struct pipe_context * pipe; vlsurface = vlGetDataHTAB(surface); if (!vlsurface) return VDP_STATUS_INVALID_HANDLE; - + + pipe = vlsurface->device->context; + context = vlsurface->device->context; compositor = &vlsurface->device->compositor; cstate = &vlsurface->cstate; @@ -384,15 +387,15 @@ vlVdpOutputSurfacePutBitsIndexed(VdpOutputSurface surface, vl_compositor_set_layer_dst_area(cstate, 0, RectToPipe(destination_rect, &dst_rect)); vl_compositor_render(cstate, compositor, vlsurface->surface, &vlsurface->dirty_area, false); - pipe_sampler_view_reference(&sv_idx, NULL); - pipe_sampler_view_reference(&sv_tbl, NULL); + pipe_sampler_view_reference(pipe, &sv_idx, NULL); + pipe_sampler_view_reference(pipe, &sv_tbl, NULL); pipe_mutex_unlock(vlsurface->device->mutex); return VDP_STATUS_OK; error_resource: - pipe_sampler_view_reference(&sv_idx, NULL); - pipe_sampler_view_reference(&sv_tbl, NULL); + pipe_sampler_view_reference(pipe, &sv_idx, NULL); + pipe_sampler_view_reference(pipe, &sv_tbl, NULL); pipe_mutex_unlock(vlsurface->device->mutex); return VDP_STATUS_RESOURCES; } diff --git a/src/gallium/state_trackers/vega/api_filters.c b/src/gallium/state_trackers/vega/api_filters.c index f5856db..7984ba2 100644 --- a/src/gallium/state_trackers/vega/api_filters.c +++ b/src/gallium/state_trackers/vega/api_filters.c @@ -630,7 +630,7 @@ void vegaLookup(VGImage dst, VGImage src, execute_filter(ctx, &info); - pipe_sampler_view_reference(&lut_texture_view, NULL); + pipe_sampler_view_reference(ctx->pipe, &lut_texture_view, NULL); } void vegaLookupSingle(VGImage dst, VGImage src, @@ -701,5 +701,5 @@ void vegaLookupSingle(VGImage dst, VGImage src, execute_filter(ctx, &info); - pipe_sampler_view_reference(&lut_texture_view, NULL); + pipe_sampler_view_reference(ctx->pipe, &lut_texture_view, NULL); } diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c index 4434550..6e5d2be 100644 --- a/src/gallium/state_trackers/vega/image.c +++ b/src/gallium/state_trackers/vega/image.c @@ -351,7 +351,7 @@ void image_destroy(struct vg_image *img) vg_free_object(&img->base); - pipe_sampler_view_reference(&img->sampler_view, NULL); + pipe_sampler_view_reference(ctx->pipe, &img->sampler_view, NULL); FREE(img); } @@ -488,7 +488,7 @@ struct vg_image * image_child_image(struct vg_image *parent, image->height = height; image->parent = parent; image->sampler_view = NULL; - pipe_sampler_view_reference(&image->sampler_view, + pipe_sampler_view_reference(ctx->pipe, &image->sampler_view, parent->sampler_view); image->sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; diff --git a/src/gallium/state_trackers/vega/mask.c b/src/gallium/state_trackers/vega/mask.c index ca8edd0..a5f2f7d 100644 --- a/src/gallium/state_trackers/vega/mask.c +++ b/src/gallium/state_trackers/vega/mask.c @@ -375,7 +375,7 @@ void mask_layer_destroy(struct vg_mask_layer *layer) struct vg_context *ctx = vg_current_context(); vg_context_remove_object(ctx, &layer->base); - pipe_sampler_view_reference(&layer->sampler_view, NULL); + pipe_sampler_view_reference(ctx->pipe, &layer->sampler_view, NULL); vg_free_object(&layer->base); FREE(layer); } diff --git a/src/gallium/state_trackers/vega/paint.c b/src/gallium/state_trackers/vega/paint.c index 79b7a27..46b4bb0 100644 --- a/src/gallium/state_trackers/vega/paint.c +++ b/src/gallium/state_trackers/vega/paint.c @@ -226,9 +226,9 @@ struct vg_paint * paint_create(struct vg_context *ctx) void paint_destroy(struct vg_paint *paint) { struct vg_context *ctx = paint->base.ctx; - pipe_sampler_view_reference(&paint->gradient.sampler_view, NULL); + pipe_sampler_view_reference(ctx->pipe, &paint->gradient.sampler_view, NULL); if (paint->pattern.sampler_view) - pipe_sampler_view_reference(&paint->pattern.sampler_view, NULL); + pipe_sampler_view_reference(ctx->pipe, &paint->pattern.sampler_view, NULL); if (ctx) { vg_context_remove_object(ctx, &paint->base); vg_free_object(&paint->base); @@ -385,6 +385,7 @@ void paint_set_type(struct vg_paint *paint, VGPaintType type) void paint_set_ramp_stops(struct vg_paint *paint, const VGfloat *stops, int num) { + struct vg_context *ctx = paint->base.ctx; const VGfloat default_stops[] = {0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f}; VGint i; @@ -421,7 +422,7 @@ void paint_set_ramp_stops(struct vg_paint *paint, const VGfloat *stops, 1024); if (paint->gradient.sampler_view) { - pipe_sampler_view_reference(&paint->gradient.sampler_view, NULL); + pipe_sampler_view_reference(ctx->pipe, &paint->gradient.sampler_view, NULL); paint->gradient.sampler_view = NULL; } @@ -485,11 +486,12 @@ void paint_set_radial_gradient(struct vg_paint *paint, void paint_set_pattern(struct vg_paint *paint, struct vg_image *img) { + struct vg_context *ctx = paint->base.ctx; if (paint->pattern.sampler_view) - pipe_sampler_view_reference(&paint->pattern.sampler_view, NULL); + pipe_sampler_view_reference(ctx->pipe, &paint->pattern.sampler_view, NULL); paint->pattern.sampler_view = NULL; - pipe_sampler_view_reference(&paint->pattern.sampler_view, + pipe_sampler_view_reference(ctx->pipe, &paint->pattern.sampler_view, img->sampler_view); } diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c index c636188..ad50e07 100644 --- a/src/gallium/state_trackers/vega/vg_context.c +++ b/src/gallium/state_trackers/vega/vg_context.c @@ -306,7 +306,7 @@ vg_context_update_surface_mask_view(struct vg_context *ctx, if (!stfb->surface_mask_view) { if (old_sampler_view) - pipe_sampler_view_reference(&old_sampler_view, NULL); + pipe_sampler_view_reference(pipe, &old_sampler_view, NULL); return; } @@ -335,7 +335,7 @@ vg_context_update_surface_mask_view(struct vg_context *ctx, /* Free the old texture */ if (old_sampler_view) - pipe_sampler_view_reference(&old_sampler_view, NULL); + pipe_sampler_view_reference(pipe, &old_sampler_view, NULL); } static void @@ -354,7 +354,7 @@ vg_context_update_blend_texture_view(struct vg_context *ctx, stfb->blend_texture_view = create_tex_and_view(pipe, PIPE_FORMAT_B8G8R8A8_UNORM, width, height); - pipe_sampler_view_reference(&old, NULL); + pipe_sampler_view_reference(pipe, &old, NULL); } static boolean @@ -477,7 +477,7 @@ struct pipe_sampler_view *vg_prepare_blend_surface(struct vg_context *ctx) vg_prepare_blend_texture(ctx, view); - pipe_sampler_view_reference(&view, NULL); + pipe_sampler_view_reference(pipe, &view, NULL); return stfb->blend_texture_view; } diff --git a/src/gallium/state_trackers/xa/xa_composite.c b/src/gallium/state_trackers/xa/xa_composite.c index eb949b9..2262fda 100644 --- a/src/gallium/state_trackers/xa/xa_composite.c +++ b/src/gallium/state_trackers/xa/xa_composite.c @@ -401,7 +401,7 @@ bind_samplers(struct xa_context *ctx, if (src_pic) { if (ctx->has_solid_color) { samplers[0] = NULL; - pipe_sampler_view_reference(&ctx->bound_sampler_views[0], NULL); + pipe_sampler_view_reference(pipe, &ctx->bound_sampler_views[0], NULL); } else { unsigned src_wrap = xa_repeat_to_gallium(src_pic->wrap); int filter; @@ -421,7 +421,7 @@ bind_samplers(struct xa_context *ctx, src_pic->srf->tex->format); src_view = pipe->create_sampler_view(pipe, src_pic->srf->tex, &view_templ); - pipe_sampler_view_reference(&ctx->bound_sampler_views[0], NULL); + pipe_sampler_view_reference(pipe, &ctx->bound_sampler_views[0], NULL); ctx->bound_sampler_views[0] = src_view; } } @@ -445,7 +445,7 @@ bind_samplers(struct xa_context *ctx, mask_pic->srf->tex->format); src_view = pipe->create_sampler_view(pipe, mask_pic->srf->tex, &view_templ); - pipe_sampler_view_reference(&ctx->bound_sampler_views[1], NULL); + pipe_sampler_view_reference(pipe, &ctx->bound_sampler_views[1], NULL); ctx->bound_sampler_views[1] = src_view; @@ -454,7 +454,7 @@ bind_samplers(struct xa_context *ctx, * dummy one that will not be used anyway. */ if (ctx->bound_sampler_views[0] == NULL) - pipe_sampler_view_reference(&ctx->bound_sampler_views[0], + pipe_sampler_view_reference(pipe, &ctx->bound_sampler_views[0], src_view); } diff --git a/src/gallium/state_trackers/xa/xa_context.c b/src/gallium/state_trackers/xa/xa_context.c index b31d555..e0a5742d 100644 --- a/src/gallium/state_trackers/xa/xa_context.c +++ b/src/gallium/state_trackers/xa/xa_context.c @@ -391,6 +391,6 @@ xa_ctx_sampler_views_destroy(struct xa_context *ctx) int i; for (i = 0; i < ctx->num_bound_samplers; ++i) - pipe_sampler_view_reference(&ctx->bound_sampler_views[i], NULL); + pipe_sampler_view_reference(ctx->pipe, &ctx->bound_sampler_views[i], NULL); ctx->num_bound_samplers = 0; } diff --git a/src/gallium/state_trackers/xa/xa_renderer.c b/src/gallium/state_trackers/xa/xa_renderer.c index b775509..2fbaec1 100644 --- a/src/gallium/state_trackers/xa/xa_renderer.c +++ b/src/gallium/state_trackers/xa/xa_renderer.c @@ -447,7 +447,7 @@ renderer_copy_prepare(struct xa_context *r, src_texture, src_texture->format); src_view = pipe->create_sampler_view(pipe, src_texture, &templ); cso_set_sampler_views(r->cso, PIPE_SHADER_FRAGMENT, 1, &src_view); - pipe_sampler_view_reference(&src_view, NULL); + pipe_sampler_view_reference(pipe, &src_view, NULL); } /* shaders */ diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 7ccb3fe..bdba0b1 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -370,7 +370,7 @@ bind_samplers(struct exa_context *exa, int op, if (exa->has_solid_color) { debug_assert(!"solid color with textures"); samplers[0] = NULL; - pipe_sampler_view_reference(&exa->bound_sampler_views[0], NULL); + pipe_sampler_view_reference(pipe, &exa->bound_sampler_views[0], NULL); } else { unsigned src_wrap = render_repeat_to_gallium( pSrcPicture->repeatType); @@ -390,7 +390,7 @@ bind_samplers(struct exa_context *exa, int op, pSrc->tex, pSrc->tex->format); src_view = pipe->create_sampler_view(pipe, pSrc->tex, &view_templ); - pipe_sampler_view_reference(&exa->bound_sampler_views[0], NULL); + pipe_sampler_view_reference(pipe, &exa->bound_sampler_views[0], NULL); exa->bound_sampler_views[0] = src_view; } } @@ -414,7 +414,7 @@ bind_samplers(struct exa_context *exa, int op, pMask->tex, pMask->tex->format); src_view = pipe->create_sampler_view(pipe, pMask->tex, &view_templ); - pipe_sampler_view_reference(&exa->bound_sampler_views[1], NULL); + pipe_sampler_view_reference(pipe, &exa->bound_sampler_views[1], NULL); exa->bound_sampler_views[1] = src_view; } diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 3e764f8..7e8a7a2 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -958,8 +958,8 @@ xorg_exa_close(ScrnInfoPtr pScrn) modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa = ms->exa; - pipe_sampler_view_reference(&exa->bound_sampler_views[0], NULL); - pipe_sampler_view_reference(&exa->bound_sampler_views[1], NULL); + pipe_sampler_view_reference(exa->pipe, &exa->bound_sampler_views[0], NULL); + pipe_sampler_view_reference(exa->pipe, &exa->bound_sampler_views[1], NULL); renderer_destroy(exa->renderer); diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index 3097d00..fdaa0b1 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -191,19 +191,19 @@ check_yuv_textures(struct xorg_xv_port_priv *priv, int width, int height) dst[0]->width0 != width || dst[0]->height0 != height) { pipe_resource_reference(&dst[0], NULL); - pipe_sampler_view_reference(&dst_view[0], NULL); + pipe_sampler_view_reference(pipe, &dst_view[0], NULL); } if (!dst[1] || dst[1]->width0 != width || dst[1]->height0 != height) { pipe_resource_reference(&dst[1], NULL); - pipe_sampler_view_reference(&dst_view[1], NULL); + pipe_sampler_view_reference(pipe, &dst_view[1], NULL); } if (!dst[2] || dst[2]->width0 != width || dst[2]->height0 != height) { pipe_resource_reference(&dst[2], NULL); - pipe_sampler_view_reference(&dst_view[2], NULL); + pipe_sampler_view_reference(pipe, &dst_view[2], NULL); } if (!dst[0]) { diff --git a/src/gallium/state_trackers/xvmc/subpicture.c b/src/gallium/state_trackers/xvmc/subpicture.c index 3e13aa6..a774a92 100644 --- a/src/gallium/state_trackers/xvmc/subpicture.c +++ b/src/gallium/state_trackers/xvmc/subpicture.c @@ -376,6 +376,8 @@ PUBLIC Status XvMCDestroySubpicture(Display *dpy, XvMCSubpicture *subpicture) { XvMCSubpicturePrivate *subpicture_priv; + XvMCContextPrivate *context_priv; + struct pipe_context *pipe; XVMC_MSG(XVMC_TRACE, "[XvMC] Destroying subpicture %p.\n", subpicture); @@ -383,10 +385,13 @@ Status XvMCDestroySubpicture(Display *dpy, XvMCSubpicture *subpicture) if (!subpicture) return XvMCBadSubpicture; - + subpicture_priv = subpicture->privData; - pipe_sampler_view_reference(&subpicture_priv->sampler, NULL); - pipe_sampler_view_reference(&subpicture_priv->palette, NULL); + context_priv = subpicture_priv->context->privData; + pipe = context_priv->pipe; + + pipe_sampler_view_reference(pipe, &subpicture_priv->sampler, NULL); + pipe_sampler_view_reference(pipe, &subpicture_priv->palette, NULL); FREE(subpicture_priv); XVMC_MSG(XVMC_TRACE, "[XvMC] Subpicture %p destroyed.\n", subpicture); diff --git a/src/gallium/tests/trivial/quad-tex.c b/src/gallium/tests/trivial/quad-tex.c index 5ed741b..6fab8db 100644 --- a/src/gallium/tests/trivial/quad-tex.c +++ b/src/gallium/tests/trivial/quad-tex.c @@ -287,7 +287,7 @@ static void close_prog(struct program *p) p->pipe->delete_fs_state(p->pipe, p->fs); pipe_surface_reference(&p->framebuffer.cbufs[0], NULL); - pipe_sampler_view_reference(&p->view, NULL); + pipe_sampler_view_reference_old(&p->view, NULL); pipe_resource_reference(&p->target, NULL); pipe_resource_reference(&p->tex, NULL); pipe_resource_reference(&p->vbuf, NULL); diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index d79e04c..6be518a 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -255,7 +255,7 @@ update_single_texture(struct st_context *st, stObj->base.DepthMode) || (view_format != stObj->sampler_view->format) || stObj->base.BaseLevel != stObj->sampler_view->u.tex.first_level) { - pipe_sampler_view_reference(&stObj->sampler_view, NULL); + pipe_sampler_view_reference(pipe, &stObj->sampler_view, NULL); } } @@ -303,7 +303,7 @@ update_textures(struct st_context *st, break; } - pipe_sampler_view_reference(&(sampler_views[unit]), sampler_view); + pipe_sampler_view_reference(st->pipe, &(sampler_views[unit]), sampler_view); } /* Ex: if old_max = 3 and *num_textures = 1, we need to pass an diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index e96f4b3..a679583 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -657,7 +657,7 @@ st_flush_bitmap_cache(struct st_context *st) sv, cache->color); - pipe_sampler_view_reference(&sv, NULL); + pipe_sampler_view_reference(st->pipe, &sv, NULL); } /* release/free the texture */ @@ -787,7 +787,7 @@ st_Bitmap(struct gl_context *ctx, GLint x, GLint y, width, height, sv, st->ctx->Current.RasterColor); - pipe_sampler_view_reference(&sv, NULL); + pipe_sampler_view_reference(st->pipe, &sv, NULL); } /* release/free the texture */ diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 68359e8..cfbe131 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -1194,9 +1194,9 @@ st_DrawPixels(struct gl_context *ctx, GLint x, GLint y, driver_vp, driver_fp, color, GL_FALSE, write_depth, write_stencil); - pipe_sampler_view_reference(&sv[0], NULL); + pipe_sampler_view_reference(st->pipe, &sv[0], NULL); if (num_sampler_view > 1) - pipe_sampler_view_reference(&sv[1], NULL); + pipe_sampler_view_reference(st->pipe, &sv[1], NULL); } pipe_resource_reference(&pt, NULL); } @@ -1643,7 +1643,7 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy, color, invertTex, GL_FALSE, GL_FALSE); pipe_resource_reference(&pt, NULL); - pipe_sampler_view_reference(&sv[0], NULL); + pipe_sampler_view_reference(pipe, &sv[0], NULL); } diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c index b871cdd..72fd054 100644 --- a/src/mesa/state_tracker/st_cb_eglimage.c +++ b/src/mesa/state_tracker/st_cb_eglimage.c @@ -98,6 +98,7 @@ st_bind_surface(struct gl_context *ctx, GLenum target, { struct st_texture_object *stObj; struct st_texture_image *stImage; + struct st_context *st = st_context(ctx); GLenum internalFormat; gl_format texFormat; @@ -124,7 +125,7 @@ st_bind_surface(struct gl_context *ctx, GLenum target, /* FIXME create a non-default sampler view from the pipe_surface? */ pipe_resource_reference(&stObj->pt, ps->texture); - pipe_sampler_view_reference(&stObj->sampler_view, NULL); + pipe_sampler_view_reference(st->pipe, &stObj->sampler_view, NULL); pipe_resource_reference(&stImage->pt, stObj->pt); stObj->width0 = ps->width; diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index e5512af..04a6e8f 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -96,7 +96,7 @@ st_render_mipmap(struct st_context *st, util_gen_mipmap(st->gen_mipmap, psv, face, baseLevel, lastLevel, PIPE_TEX_FILTER_LINEAR); - pipe_sampler_view_reference(&psv, NULL); + pipe_sampler_view_reference(pipe, &psv, NULL); return TRUE; } @@ -182,7 +182,7 @@ st_generate_mipmap(struct gl_context *ctx, GLenum target, /* release the old tex (will likely be freed too) */ pipe_resource_reference(&oldTex, NULL); - pipe_sampler_view_reference(&stObj->sampler_view, NULL); + pipe_sampler_view_reference(st->pipe, &stObj->sampler_view, NULL); } else { /* Make sure that the base texture image data is present in the