[Mesa-dev] [PATCH 1/6] nvc0: move nvc0_validate_global_residents() to its correct location

Samuel Pitoiset samuel.pitoiset at gmail.com
Sun Feb 21 23:18:34 UTC 2016



On 02/22/2016 12:15 AM, Ilia Mirkin wrote:
> Nope. This will be needed on nvc0 as well if it's to support OpenCL.

I was thinking the same thing actually but I was not sure.
I think we should also validate those global buffers on Fermi.

>
> On Sun, Feb 21, 2016 at 9:19 AM, Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>> This function is currently only used for the compute validation path
>> on GK104+. While we are at it, also rename it to
>> nvc0_compute_validate_globals() and update its prototype.
>>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>>   src/gallium/drivers/nouveau/nvc0/nvc0_context.h        |  2 --
>>   src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c | 15 ---------------
>>   src/gallium/drivers/nouveau/nvc0/nve4_compute.c        | 18 ++++++++++++++++--
>>   3 files changed, 16 insertions(+), 19 deletions(-)
>>
>> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
>> index 64d7b74..0bbbff5 100644
>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
>> @@ -261,8 +261,6 @@ void nvc0_tfb_validate(struct nvc0_context *);
>>   extern void nvc0_init_state_functions(struct nvc0_context *);
>>
>>   /* nvc0_state_validate.c */
>> -void nvc0_validate_global_residents(struct nvc0_context *,
>> -                                    struct nouveau_bufctx *, int bin);
>>   bool nvc0_state_validate(struct nvc0_context *, uint32_t state_mask);
>>
>>   /* nvc0_surface.c */
>> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
>> index 18e79e36..fbf45ce 100644
>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state_validate.c
>> @@ -559,21 +559,6 @@ nvc0_validate_driverconst(struct nvc0_context *nvc0)
>>      nvc0->dirty_cp |= NVC0_NEW_CP_DRIVERCONST;
>>   }
>>
>> -void
>> -nvc0_validate_global_residents(struct nvc0_context *nvc0,
>> -                               struct nouveau_bufctx *bctx, int bin)
>> -{
>> -   unsigned i;
>> -
>> -   for (i = 0; i < nvc0->global_residents.size / sizeof(struct pipe_resource *);
>> -        ++i) {
>> -      struct pipe_resource *res = *util_dynarray_element(
>> -         &nvc0->global_residents, struct pipe_resource *, i);
>> -      if (res)
>> -         nvc0_add_resident(bctx, bin, nv04_resource(res), NOUVEAU_BO_RDWR);
>> -   }
>> -}
>> -
>>   static void
>>   nvc0_validate_derived_1(struct nvc0_context *nvc0)
>>   {
>> diff --git a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
>> index 652bc6d..0ffcfb1 100644
>> --- a/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
>> +++ b/src/gallium/drivers/nouveau/nvc0/nve4_compute.c
>> @@ -302,6 +302,21 @@ nve4_compute_set_tex_handles(struct nvc0_context *nvc0)
>>      nvc0->samplers_dirty[s] = 0;
>>   }
>>
>> +static void
>> +nvc0_compute_validate_globals(struct nvc0_context *nvc0)
>> +{
>> +   unsigned i;
>> +
>> +   for (i = 0; i < nvc0->global_residents.size / sizeof(struct pipe_resource *);
>> +        ++i) {
>> +      struct pipe_resource *res = *util_dynarray_element(
>> +         &nvc0->global_residents, struct pipe_resource *, i);
>> +      if (res)
>> +         nvc0_add_resident(nvc0->bufctx_cp, NVC0_BIND_CP_GLOBAL,
>> +                           nv04_resource(res), NOUVEAU_BO_RDWR);
>> +   }
>> +}
>> +
>>
>>   static bool
>>   nve4_compute_state_validate(struct nvc0_context *nvc0)
>> @@ -317,8 +332,7 @@ nve4_compute_state_validate(struct nvc0_context *nvc0)
>>      if (nvc0->dirty_cp & NVC0_NEW_CP_SURFACES)
>>         nve4_compute_validate_surfaces(nvc0);
>>      if (nvc0->dirty_cp & NVC0_NEW_CP_GLOBALS)
>> -      nvc0_validate_global_residents(nvc0,
>> -                                     nvc0->bufctx_cp, NVC0_BIND_CP_GLOBAL);
>> +      nvc0_compute_validate_globals(nvc0);
>>
>>      nvc0_bufctx_fence(nvc0, nvc0->bufctx_cp, false);
>>
>> --
>> 2.6.4
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list