[Mesa-dev] [PATCH] anv: If softpin is supported, use it with hiz clear batch bo

Jordan Justen jordan.l.justen at intel.com
Tue Sep 25 23:25:20 UTC 2018


On 2018-09-25 16:02:28, Nanley Chery wrote:
> On Tue, Sep 25, 2018 at 03:22:11PM -0700, Jordan Justen wrote:
> > Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> > Cc: Nanley Chery <nanley.g.chery at intel.com>
> > ---
> >  src/intel/vulkan/anv_device.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
> > index 0ea8be052fa..4e446c3280a 100644
> > --- a/src/intel/vulkan/anv_device.c
> > +++ b/src/intel/vulkan/anv_device.c
> > @@ -1574,6 +1574,15 @@ static void
> >  anv_device_init_hiz_clear_batch(struct anv_device *device)
> >  {
> >     anv_bo_init_new(&device->hiz_clear_bo, device, 4096);
> > +
> > +   if (device->instance->physicalDevice.has_exec_async)
> > +      device->hiz_clear_bo.flags |= EXEC_OBJECT_ASYNC;
> > +
> > +   if (device->instance->physicalDevice.use_softpin)
> > +      device->hiz_clear_bo.flags |= EXEC_OBJECT_PINNED;
> > +
> > +   anv_vma_alloc(device, &device->hiz_clear_bo);
> > +
> 
> Seems like we should handle the return value of this function.
> Maybe also hook into the block of gotos in anv_CreateDevice()?

I think the anv_gem_mmap call below is more likely to fail, than
anv_vma_alloc, but we don't have an error path for it. It looks like
the anv_vma_alloc call could only fail if the vma range fills, and
during device init I think that is probably impossible.

I also notice that we have a similar unchecked call in
anv_device_init_trivial_batch.

I wouldn't mind adding another potential failure path if it were
remotely possible, but anv_CreateDevice is already pretty gross with
all the labels for potential failure cases. :)

-Jordan

> 
> >     uint32_t *map = anv_gem_mmap(device, device->hiz_clear_bo.gem_handle,
> >                                  0, 4096, 0);
> >  
> > -- 
> > 2.18.0
> > 
> > _______________________________________________
> > 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