[Mesa-dev] [PATCH 1/3] anv: Add anv_outarray

Chad Versace chadversary at chromium.org
Mon Mar 13 21:22:49 UTC 2017


On Wed 08 Mar 2017, Chad Versace wrote:
> On Mon 06 Mar 2017, Jason Ekstrand wrote:
> > On Mon, Mar 6, 2017 at 10:25 AM, Chad Versace <chadversary at chromium.org>
> > wrote:
> > 
> > > anv_outarray is a wrapper for a Vulkan output array. A Vulkan output
> > > array is one that follows the convention of the parameters to
> > > vkGetPhysicalDeviceQueueFamilyProperties().
> > >
> > > In the upcoming dma_buf extensions, anv_outarray will simplify the code
> > > for querying the DRM format modifiers.
> > > ---
> > >  src/intel/vulkan/anv_private.h | 140 ++++++++++++++++++++++++++++++
> > > +++++++++++
> > >  1 file changed, 140 insertions(+)


> > > +static inline bool
> > > +__anv_outarray_is_incomplete(const struct __anv_outarray *a)
> > > +{
> > > +   return *a->filled_len < a->wanted_len;
> > >
> > 
> > We could implement this as
> > 
> > return a->data && *a->filled_len < a->cap

No. VK_INCOMPLETE means "overflow", not "underflow". Comparint to
capacity can't tell you about overflow.

With that realization, I kept the filled_len and wanted_len fields
unchanged in v2.

> > Or, better yet, we could add a "VkResult status" to the outarray struct and
> > set that VK_INCOMPLETE in __anv_outarray_next.  Then the status check is
> > just "return out.status".  How does that sound?
> 
> When I rewrite the patch to remove 'wanted_len', I'll play around with
> that, and see what results in the cleanest code.
> 
> > 
> > Also, this looks like a really good candidate for common Vulkan code.
> 
> Agreed. I'll resend this as a patch to vk_util.h.
> 
> > Thanks for doing this by the way!  I've been wanting someone to figure out
> > how to make output arrays less painful and this seems like a very good way.
> 
> Thanks :)


More information about the mesa-dev mailing list