[Mesa-dev] [PATCH 3/6] nvc0: add nvc0_screen_resize_text_area() helper

Samuel Pitoiset samuel.pitoiset at gmail.com
Thu Sep 1 16:28:40 UTC 2016



On 09/01/2016 06:22 PM, Ilia Mirkin wrote:
> On Thu, Sep 1, 2016 at 12:14 PM, Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>>
>>
>> On 08/31/2016 11:36 PM, Ilia Mirkin wrote:
>>>
>>> On Wed, Aug 31, 2016 at 4:52 PM, Samuel Pitoiset
>>> <samuel.pitoiset at gmail.com> wrote:
>>>>
>>>> This function will be helpful for resizing the code segment
>>>> area when we need to evict all shaders.
>>>>
>>>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>>>> ---
>>>>  src/gallium/drivers/nouveau/nvc0/nvc0_context.h |  1 +
>>>>  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c  | 47
>>>> +++++++++++++++++++------
>>>>  src/gallium/drivers/nouveau/nvc0/nvc0_screen.h  |  2 ++
>>>>  3 files changed, 40 insertions(+), 10 deletions(-)
>>>>
>>>> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
>>>> b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
>>>> index ae65f8a..6499f3e 100644
>>>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
>>>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.h
>>>> @@ -27,6 +27,7 @@
>>>>  #include "nv50/nv50_2d.xml.h"
>>>>  #include "nvc0/nvc0_m2mf.xml.h"
>>>>  #include "nvc0/nve4_p2mf.xml.h"
>>>> +#include "nvc0/nvc0_compute.xml.h"
>>>>  #include "nvc0/nvc0_macros.h"
>>>>
>>>>  /* NOTE: must keep NVC0_NEW_3D_...PROG in consecutive bits in this order
>>>> */
>>>> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>>>> b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>>>> index a4f1605..6c6d177 100644
>>>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>>>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>>>> @@ -701,6 +701,42 @@ nvc0_screen_resize_tls_area(struct nvc0_screen
>>>> *screen,
>>>>     return 0;
>>>>  }
>>>>
>>>> +int
>>>> +nvc0_screen_resize_text_area(struct nvc0_screen *screen, uint64_t size)
>>>> +{
>>>> +   struct nouveau_pushbuf *push = screen->base.pushbuf;
>>>> +   struct nouveau_bo *bo;
>>>
>>>
>>> I'm about 30% sure you need to do bo = null, otherwise it'll try to
>>> free the old value of bo.
>>
>>
>> Err, what do you mean?
>
> You later do nouveau_bo_new(..., &bo).
>
> I wouldn't at all be surprised if nouveau_bo_new had code like
>
> if (bo) {
>   nouveau_bo_destroy(bo);
>   bo = NULL;
> }
>
> But ... double-check. I didn't actually look.

Makes more sense, but actually no.

https://cgit.freedesktop.org/mesa/drm/tree/nouveau/nouveau.c#n626

>
>   -ilia
>


More information about the mesa-dev mailing list