All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emil Velikov <emil.l.velikov@gmail.com>
To: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "mesa-dev@lists.freedesktop.org" <mesa-dev@lists.freedesktop.org>,
	emil.l.velikov@gmail.com,
	"10.2 10.3" <mesa-stable@lists.freedesktop.org>,
	"nouveau@lists.freedesktop.org" <nouveau@lists.freedesktop.org>
Subject: Re: [Mesa-stable] [PATCH 2/2] nv50: zero out unbound samplers
Date: Sun, 31 Aug 2014 01:09:31 +0100	[thread overview]
Message-ID: <540267BB.6060900@gmail.com> (raw)
In-Reply-To: <CAKb7Uvj33_6ztqaHiW6ip5J9B93kCUGRw8-gdDzgSdvmc5JYcA@mail.gmail.com>

On 31/08/14 00:34, Ilia Mirkin wrote:
> On Sat, Aug 30, 2014 at 7:30 PM, Emil Velikov <emil.l.velikov@gmail.com> wrote:
>> On 30/08/14 23:02, Ilia Mirkin wrote:
>>> Samplers are only defined up to num_samplers, so set all samplers above
>>> nr to NULL so that we don't try to read them again later.
>>>
>> Would it be worth doing a similar thing with the unlocked samplers below the
>> nr mark ? It seems to me that we might be leaking nv50->samplers[s][i], or
>> perhaps I'm missing something ?
> 
> Can you elaborate? sampler_state_create/delete deal with allocation
> and deallocation. samplers starts out as NULL. I'm just making sure
> that a subsequent call with a larger number of samplers doesn't try to
> unlock potentially-deleted samplers.
> 

   for (i = 0; i < nr; ++i) {
      struct nv50_tsc_entry *old = nv50->samplers[s][i];

      nv50->samplers[s][i] = nv50_tsc_entry(hwcso[i]);
      if (old)
         nv50_screen_tsc_unlock(nv50->screen, old);
   }

In the above hunk we get the old/current tsc, drop in on the floor and assign
the new one in it's place. Does where does the ST keep track of the old one in
order to nuke it via sampler_state_delete, or is it already deleted by the
time we get here ?

-Emil

>   -ilia
> 
>>
>> -Emil
>>
>>> Tested-by: Christian Ruppert <idl0r@qasl.de>
>>> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
>>> Cc: "10.2 10.3" <mesa-stable@lists.freedesktop.org>
>>> ---
>>>  src/gallium/drivers/nouveau/nv50/nv50_state.c | 7 +++++--
>>>  1 file changed, 5 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c b/src/gallium/drivers/nouveau/nv50/nv50_state.c
>>> index 48bc079..cf84f88 100644
>>> --- a/src/gallium/drivers/nouveau/nv50/nv50_state.c
>>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c
>>> @@ -585,9 +585,12 @@ nv50_stage_sampler_states_bind(struct nv50_context *nv50, int s,
>>>           nv50_screen_tsc_unlock(nv50->screen, old);
>>>     }
>>>     assert(nv50->num_samplers[s] <= PIPE_MAX_SAMPLERS);
>>> -   for (; i < nv50->num_samplers[s]; ++i)
>>> -      if (nv50->samplers[s][i])
>>> +   for (; i < nv50->num_samplers[s]; ++i) {
>>> +      if (nv50->samplers[s][i]) {
>>>           nv50_screen_tsc_unlock(nv50->screen, nv50->samplers[s][i]);
>>> +         nv50->samplers[s][i] = NULL;
>>> +      }
>>> +   }
>>>
>>>     nv50->num_samplers[s] = nr;
>>>
>>>
>>

  reply	other threads:[~2014-08-31  0:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-30 22:02 [PATCH 1/2] nvc0/ir: avoid infinite recursion when finding first uses of tex Ilia Mirkin
     [not found] ` <1409436150-5979-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
2014-08-30 22:02   ` [PATCH 2/2] nv50: zero out unbound samplers Ilia Mirkin
     [not found]     ` <1409436150-5979-2-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
2014-08-30 23:30       ` [Mesa-stable] " Emil Velikov
     [not found]         ` <54025E9F.507-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-30 23:34           ` Ilia Mirkin
2014-08-31  0:09             ` Emil Velikov [this message]
     [not found]             ` <CAKb7Uvj33_6ztqaHiW6ip5J9B93kCUGRw8-gdDzgSdvmc5JYcA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-08-31  0:09               ` Emil Velikov
     [not found]                 ` <540267BB.8000309-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-31  0:13                   ` Ilia Mirkin
2014-08-31 18:11                     ` Emil Velikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=540267BB.6060900@gmail.com \
    --to=emil.l.velikov@gmail.com \
    --cc=imirkin@alum.mit.edu \
    --cc=mesa-dev@lists.freedesktop.org \
    --cc=mesa-stable@lists.freedesktop.org \
    --cc=nouveau@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.