<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Feb 14, 2018 at 4:13 AM, Daniel Stone <span dir="ltr"><<a href="mailto:daniel@fooishbar.org" target="_blank">daniel@fooishbar.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<span class=""><br>
On 13 February 2018 at 22:29, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
> On Tue, Feb 13, 2018 at 10:55 AM, Daniel Stone <<a href="mailto:daniel@fooishbar.org">daniel@fooishbar.org</a>> wrote:<br>
</span><span class="">>> > +   uint64_t modifiers[] = {<br>
>> > +      DRM_FORMAT_MOD_LINEAR,<br>
>> > +      I915_FORMAT_MOD_X_TILED,<br>
>> > +      I915_FORMAT_MOD_Y_TILED,<br>
>> > +      I915_FORMAT_MOD_Y_TILED_CCS,<br>
>> > +   };<br>
>><br>
>> Can this please be inverted to preferred-first? Most of the other APIs<br>
>> do this, so you can pop the head off the list.<br>
><br>
> If someone is popping the head of the list, they're using modifiers wrong.<br>
> When we get Chad's extension in full, they're going to have to also call<br>
> vkGetPhysicalDeviceImageFormat<wbr>Properties to verify that your parameters<br>
> actually work with the modifier.  There may be other restrictions.  For<br>
> instance, we're likely to disallow CCS for storage images.<br>
<br>
</span>Yeah, that makes sense.<br>
<span class=""><br>
>> > +static uint32_t<br>
>> > +score_drm_format_mod(uint64_t modifier)<br>
>> > +{<br>
>> > +   switch (modifier) {<br>
>> > +   case DRM_FORMAT_MOD_LINEAR: return 1;<br>
>> > +   case I915_FORMAT_MOD_X_TILED: return 2;<br>
>> > +   case I915_FORMAT_MOD_Y_TILED: return 3;<br>
>> > +   case I915_FORMAT_MOD_Y_TILED_CCS: return 4;<br>
>> > +   default: unreachable("bad DRM format modifier");<br>
>> > +   }<br>
>> > +}<br>
>><br>
>> If the array previously could be shared, you could just score based on<br>
>> the modifier's index in the array, rather than explicit scoring as<br>
>> here.<br>
><br>
> True.  It's really too bad that they're in different files.  I'm not<br>
> entirely happy that anv_image and anv_format are split up.  I've also<br>
> thought about trying to move some of it into ISL but that's a bit sticky<br>
> because the list of supported modifiers needs to be per-driver since things<br>
> like Y_TILED_CCS takes a little extra work in each driver.  All in all, it's<br>
> not a lot of code duplication so meh?<br>
<br>
</span>Yeah, I don't actually really feel at all strongly about it tbh.<br>
<span class=""><br>
>> > @@ -367,13 +367,9 @@ wsi_create_native_image(const struct wsi_swapchain<br>
>> > *chain,<br>
>> >     if (result != VK_SUCCESS)<br>
>> >        goto fail;<br>
>> ><br>
>> > -   if (wsi->supports_modifiers)<br>
>> > +   if (image_modifier_count > 0) {<br>
>> >        image->drm_modifier = wsi->image_get_modifier(image-<wbr>>image);<br>
>> > -   else<br>
>> > -      image->drm_modifier = DRM_FORMAT_MOD_INVALID;<br>
>><br>
>> Belongs in a previous patch, and also going along the right lines but<br>
>> not quite correct. ;) The other hunks also need to be squashed into<br>
>> some other patch.<br>
><br>
> I'm not sure what you mean by "not quite correct".  I've moved it into<br>
> "vulkan/wsi: Add modifiers support to wsi_create_native_image"<br>
<br>
</span>Suggested fixup: <a href="https://hastebin.com/zaheyoriwa" rel="noreferrer" target="_blank">https://hastebin.com/<wbr>zaheyoriwa</a><br>
<br>
This makes sure we only try to allocate with modifiers when _both_<br>
winsys and driver support it.<br>
</blockquote></div><br></div><div class="gmail_extra">Ok, we clearly have different philosophies here so we should get that sorted.  My philosophy is that the winsys code will look at the wsi_device::supports_modifiers flag and not ask for modifiers if it's false.  You seem to think that the winsys code should just go ahead and ask for modifiers all the time and we will try to deal with it in wsi_create_native.  Thoughts?  Arguments?  Strong opinions?<br><br></div><div class="gmail_extra">If we keep my philosophy, we should add asserts to better document and enforce it.<br></div></div>