[Mesa-dev] [PATCH 6/7] nvc0: only invalidate currently bound tic/tsc
Samuel Pitoiset
samuel.pitoiset at gmail.com
Wed Oct 26 08:17:10 UTC 2016
On 10/25/2016 09:59 PM, Ilia Mirkin wrote:
> On Tue, Oct 25, 2016 at 3:41 PM, Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>> This is especially useful when switching from compute to 3D.
>>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>> src/gallium/drivers/nouveau/nvc0/nvc0_compute.c | 11 +++++++----
>> src/gallium/drivers/nouveau/nvc0/nvc0_tex.c | 14 ++++++++++----
>> src/gallium/drivers/nouveau/nvc0/nve4_compute.c | 11 +++++++----
>> 3 files changed, 24 insertions(+), 12 deletions(-)
>>
>> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
>> index 11635c9..5175bd0 100644
>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c
>> @@ -150,8 +150,10 @@ nvc0_compute_validate_samplers(struct nvc0_context *nvc0)
>> }
>>
>> /* Invalidate all 3D samplers because they are aliased. */
>> - for (int s = 0; s < 5; s++)
>> - nvc0->samplers_dirty[s] = ~0;
>> + for (int s = 0; s < 5; s++) {
>> + for (int i = 0; i < nvc0->num_samplers[5]; i++)
>> + nvc0->samplers_dirty[s] |= 1 << i;
>> + }
>
> samplers_dirty[s] |= (1ULL << nvc0->num_samplers[5]) - 1;
Much better, thanks!
>
> Or perhaps there's a helper function which does this, if so use that.
>
>> nvc0->dirty_3d |= NVC0_NEW_3D_SAMPLERS;
>> }
>>
>> @@ -166,9 +168,10 @@ nvc0_compute_validate_textures(struct nvc0_context *nvc0)
>>
>> /* Invalidate all 3D textures because they are aliased. */
>> for (int s = 0; s < 5; s++) {
>> - for (int i = 0; i < nvc0->num_textures[s]; i++)
>> + for (int i = 0; i < nvc0->num_textures[5]; i++) {
>> nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_TEX(s, i));
>> - nvc0->textures_dirty[s] = ~0;
>> + nvc0->textures_dirty[s] |= 1 << i;
>> + }
>> }
>> nvc0->dirty_3d |= NVC0_NEW_3D_TEXTURES;
>> }
>> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
>> index e57391e..4c4249f 100644
>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_tex.c
>> @@ -606,9 +606,12 @@ void nvc0_validate_textures(struct nvc0_context *nvc0)
>> }
>>
>> /* Invalidate all CP textures because they are aliased. */
>> - for (int i = 0; i < nvc0->num_textures[5]; i++)
>> - nouveau_bufctx_reset(nvc0->bufctx_cp, NVC0_BIND_CP_TEX(i));
>> - nvc0->textures_dirty[5] = ~0;
>> + for (int s = 0; s < 5; s++) {
>> + for (int i = 0; i < nvc0->num_textures[s]; i++) {
>> + nouveau_bufctx_reset(nvc0->bufctx_cp, NVC0_BIND_CP_TEX(i));
>> + nvc0->textures_dirty[5] |= 1 << i;
>> + }
>> + }
>> nvc0->dirty_cp |= NVC0_NEW_CP_TEXTURES;even if blob a
>> }
>>
>> @@ -715,7 +718,10 @@ void nvc0_validate_samplers(struct nvc0_context *nvc0)
>> }
>>
>> /* Invalidate all CP samplers because they are aliased. */
>> - nvc0->samplers_dirty[5] = ~0;
>> + for (int s = 0; s < 5; s++) {
>> + for (int i = 0; i < nvc0->num_samplers[s]; i++)
>> + nvc0->samplers_dirty[5] |= 1 << i;
>> + }
>> nvc0->dirty_cp |= NVC0_NEW_CP_SAMPLERS;
>> }
>>
>> diff --git a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
>> index d1f0855..4c59e73 100644
>> --- a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
>> +++ b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
>> @@ -306,8 +306,10 @@ nve4_compute_validate_samplers(struct nvc0_context *nvc0)
>> }
>>
>> /* Invalidate all 3D samplers because they are aliased. */
>> - for (int s = 0; s < 5; s++)
>> - nvc0->samplers_dirty[s] = ~0;
>> + for (int s = 0; s < 5; s++) {
>> + for (int i = 0; i < nvc0->num_samplers[5]; i++)
>> + nvc0->samplers_dirty[s] |= 1 << i;
>> + }
>> nvc0->dirty_3d |= NVC0_NEW_3D_SAMPLERS;
>> }
>>
>> @@ -755,9 +757,10 @@ nve4_compute_validate_textures(struct nvc0_context *nvc0)
>>
>> /* Invalidate all 3D textures because they are aliased. */
>> for (int s = 0; s < 5; s++) {
>> - for (int i = 0; i < nvc0->num_textures[s]; i++)
>> + for (int i = 0; i < nvc0->num_textures[5]; i++) {
>> nouveau_bufctx_reset(nvc0->bufctx_3d, NVC0_BIND_3D_TEX(s, i));
>> - nvc0->textures_dirty[s] = ~0;
>> + nvc0->textures_dirty[s] |= 1 << i;
>> + }
>> }
>> nvc0->dirty_3d |= NVC0_NEW_3D_TEXTURES;
>> }
>> --
>> 2.10.1
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
--
-Samuel
More information about the mesa-dev
mailing list