[Mesa-dev] [PATCH 18/23] anv: Add field anv_image::mem_is_owned

Chad Versace chadversary at chromium.org
Mon Sep 11 23:26:54 UTC 2017


On Sat 02 Sep 2017, Jason Ekstrand wrote:
> On Sat, Sep 2, 2017 at 1:17 AM, Chad Versace <[1]chadversary at chromium.org>
> wrote:
> 
>     If this flag is set, then the image and it's device memory have the same
>     lifetime.  vkDestroyImage will free its anv_device_memory.
> 
>     We need this for VK_ANDROID_native_buffer, because that extension
>     creates the VkImage and imports its memory in the same call,
>     vkCreateImage.
> 
> 
> So, this got me thinking... VK_ANDROID_native_buffer doesn't actually return
> the VkDeviceMemory object to the client.  Why does anv_image need to own an
> anv_device_memory?  It's just a wrapper around a pointer and a map anyway.  Why
> not just have it own a reference to the BO?  We still need the logic here to
> release said BO but that sounds like it would shrink the reach of
> VK_ANDROID_native_buffer down a bit.

I originally wrote the patches to do what you said: just let anv_image
own a reference to the bo. But the resultant code in anv_device.c that
imported the fd was too messy, in my opinion. Owning an
anv_device_memory instead of anv_bo make the code cleaner.

I'll revisit this, and try what you suggest again. Maybe I can keep it
clean on the second try.


More information about the mesa-dev mailing list