diff options
author | Ilia Mirkin <imirkin@alum.mit.edu> | 2019-07-25 23:26:46 -0400 |
---|---|---|
committer | Juan A. Suarez Romero <jasuarez@igalia.com> | 2019-07-29 10:56:22 +0000 |
commit | 645462fe85af8606585d03b958af2cdd6a5b1279 (patch) | |
tree | a3297d5bb440afb0ae6a4b6001451eb8c361313f | |
parent | e671e6823830fc87355509b34f4b6a33a81e1b5c (diff) |
nv50,nvc0: update sampler/view bind functions to accept NULL array
Apparently vl (or vdpau) wants to pass that in now. Handle it.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111213
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Cc: mesa-stable@lists.freedesktop.org
(cherry picked from commit c52b057e003b18a5f3248b2cfe2aae4c8d57197e)
-rw-r--r-- | src/gallium/drivers/nouveau/nv50/nv50_state.c | 14 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_state.c | 18 |
2 files changed, 18 insertions, 14 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c b/src/gallium/drivers/nouveau/nv50/nv50_state.c index 8688af14d3e..5af5e38b82e 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_state.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c @@ -599,19 +599,20 @@ nv50_sampler_state_delete(struct pipe_context *pipe, void *hwcso) static inline void nv50_stage_sampler_states_bind(struct nv50_context *nv50, int s, - unsigned nr, void **hwcso) + unsigned nr, void **hwcsos) { unsigned highest_found = 0; unsigned i; assert(nr <= PIPE_MAX_SAMPLERS); for (i = 0; i < nr; ++i) { + struct nv50_tsc_entry *hwcso = hwcsos ? nv50_tsc_entry(hwcsos[i]) : NULL; struct nv50_tsc_entry *old = nv50->samplers[s][i]; - if (hwcso[i]) + if (hwcso) highest_found = i; - nv50->samplers[s][i] = nv50_tsc_entry(hwcso[i]); + nv50->samplers[s][i] = hwcso; if (old) nv50_screen_tsc_unlock(nv50->screen, old); } @@ -685,12 +686,13 @@ nv50_stage_set_sampler_views(struct nv50_context *nv50, int s, assert(nr <= PIPE_MAX_SAMPLERS); for (i = 0; i < nr; ++i) { + struct pipe_sampler_view *view = views ? views[i] : NULL; struct nv50_tic_entry *old = nv50_tic_entry(nv50->textures[s][i]); if (old) nv50_screen_tic_unlock(nv50->screen, old); - if (views[i] && views[i]->texture) { - struct pipe_resource *res = views[i]->texture; + if (view && view->texture) { + struct pipe_resource *res = view->texture; if (res->target == PIPE_BUFFER && (res->flags & PIPE_RESOURCE_FLAG_MAP_COHERENT)) nv50->textures_coherent[s] |= 1 << i; @@ -700,7 +702,7 @@ nv50_stage_set_sampler_views(struct nv50_context *nv50, int s, nv50->textures_coherent[s] &= ~(1 << i); } - pipe_sampler_view_reference(&nv50->textures[s][i], views[i]); + pipe_sampler_view_reference(&nv50->textures[s][i], view); } assert(nv50->num_textures[s] <= PIPE_MAX_SAMPLERS); diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c index 30757caaacb..3c31e162b58 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c @@ -463,22 +463,23 @@ nvc0_sampler_state_delete(struct pipe_context *pipe, void *hwcso) static inline void nvc0_stage_sampler_states_bind(struct nvc0_context *nvc0, unsigned s, - unsigned nr, void **hwcso) + unsigned nr, void **hwcsos) { unsigned highest_found = 0; unsigned i; for (i = 0; i < nr; ++i) { + struct nv50_tsc_entry *hwcso = hwcsos ? nv50_tsc_entry(hwcsos[i]) : NULL; struct nv50_tsc_entry *old = nvc0->samplers[s][i]; - if (hwcso[i]) + if (hwcso) highest_found = i; - if (hwcso[i] == old) + if (hwcso == old) continue; nvc0->samplers_dirty[s] |= 1 << i; - nvc0->samplers[s][i] = nv50_tsc_entry(hwcso[i]); + nvc0->samplers[s][i] = hwcso; if (old) nvc0_screen_tsc_unlock(nvc0->screen, old); } @@ -523,14 +524,15 @@ nvc0_stage_set_sampler_views(struct nvc0_context *nvc0, int s, unsigned i; for (i = 0; i < nr; ++i) { + struct pipe_sampler_view *view = views ? views[i] : NULL; struct nv50_tic_entry *old = nv50_tic_entry(nvc0->textures[s][i]); - if (views[i] == nvc0->textures[s][i]) + if (view == nvc0->textures[s][i]) continue; nvc0->textures_dirty[s] |= 1 << i; - if (views[i] && views[i]->texture) { - struct pipe_resource *res = views[i]->texture; + if (view && view->texture) { + struct pipe_resource *res = view->texture; if (res->target == PIPE_BUFFER && (res->flags & PIPE_RESOURCE_FLAG_MAP_COHERENT)) nvc0->textures_coherent[s] |= 1 << i; @@ -548,7 +550,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->textures[s][i], view); } for (i = nr; i < nvc0->num_textures[s]; ++i) { |