On Tue, May 12, 2015 at 11:24 AM, Samuel Pitoiset
<samuel.pitoi...@gmail.com> wrote:
>
>
> On 05/12/2015 05:21 PM, Ilia Mirkin wrote:
>>
>> On Tue, May 12, 2015 at 11:13 AM, Samuel Pitoiset
>> <samuel.pitoi...@gmail.com> wrote:
>>>
>>> This has been detected by Clang 3.6 which displays a warning message
>>> because variable 'nv30' is uninitialized when used here. According to
>>> the description of container_of, 'sample' must be initialized, otherwise
>>> the result is undefined.
>>>
>>> This patch gets rid of container_of() which is not required here like
>>> for nv50 and nvc0 drivers.
>>>
>>> Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
>>> ---
>>>   src/gallium/drivers/nouveau/nv30/nv30_context.c | 15 ++++++---------
>>>   1 file changed, 6 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_context.c
>>> b/src/gallium/drivers/nouveau/nv30/nv30_context.c
>>> index 617b088..74ff395 100644
>>> --- a/src/gallium/drivers/nouveau/nv30/nv30_context.c
>>> +++ b/src/gallium/drivers/nouveau/nv30/nv30_context.c
>>> @@ -36,29 +36,26 @@
>>>   static void
>>>   nv30_context_kick_notify(struct nouveau_pushbuf *push)
>>>   {
>>> -   struct nouveau_screen *screen;
>>> -   struct nv30_context *nv30;
>>> +   struct nv30_screen *screen = push->user_priv;
>>
>> That's not what's stored in user_priv though... the context's bufctx
>> pointer is. This will make it fail.
>
>
> You're right here.
> But this is quite strange in comparison to the code of nv50/nvc0....

Yes, quite. But I didn't particularly feel like changing it for no reason.

>
>
>>> -   if (!push->user_priv)
>>> +   if (!screen)
>>>         return;
>>> -   nv30 = container_of(push->user_priv, nv30, bufctx);
>>> -   screen = &nv30->screen->base;
>>>
>>> -   nouveau_fence_next(screen);
>>> -   nouveau_fence_update(screen, TRUE);
>>> +   nouveau_fence_next(&screen->base);
>>> +   nouveau_fence_update(&screen->base, TRUE);
>>>
>>>      if (push->bufctx) {
>>>         struct nouveau_bufref *bref;
>>>         LIST_FOR_EACH_ENTRY(bref, &push->bufctx->current, thead) {
>>>            struct nv04_resource *res = bref->priv;
>>>            if (res && res->mm) {
>>> -            nouveau_fence_ref(screen->fence.current, &res->fence);
>>> +            nouveau_fence_ref(screen->base.fence.current, &res->fence);
>>>
>>>               if (bref->flags & NOUVEAU_BO_RD)
>>>                  res->status |= NOUVEAU_BUFFER_STATUS_GPU_READING;
>>>
>>>               if (bref->flags & NOUVEAU_BO_WR) {
>>> -               nouveau_fence_ref(screen->fence.current, &res->fence_wr);
>>> +               nouveau_fence_ref(screen->base.fence.current,
>>> &res->fence_wr);
>>>                  res->status |= NOUVEAU_BUFFER_STATUS_GPU_WRITING |
>>>                     NOUVEAU_BUFFER_STATUS_DIRTY;
>>>               }
>>> --
>>> 2.4.0
>>>
>>> _______________________________________________
>>> mesa-dev mailing list
>>> mesa-dev@lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to