[Mesa-dev] [PATCH 09/11] vulkan/wsi: Return VK_SUBOPTIMAL_KHR for X11

Daniel Stone daniel at fooishbar.org
Fri Feb 16 11:05:40 UTC 2018


On 15 February 2018 at 21:38, Jason Ekstrand <jason at jlekstrand.net> wrote:
> On Thu, Feb 15, 2018 at 7:57 AM, Daniel Stone <daniels at collabora.com> wrote:
>> @@ -138,7 +140,7 @@ wsi_x11_connection_create(const VkAllocationCallbacks
>> *alloc,
>>        return NULL;
>>
>>     dri3_cookie = xcb_query_extension(conn, 4, "DRI3");
>> -   pres_cookie = xcb_query_extension(conn, 7, "PRESENT");
>> +   pres_cookie = xcb_query_extension(conn, 7, "Present");
>
>
> This seems a bit odd.  Did we just not use it before?  Looking through
> things, it appears we didn't.

Yep, I had to do a double take as well, but I checked it and it is correct.

>> @@ -699,6 +717,10 @@ x11_handle_dri3_present_event(struct x11_swapchain
>> *chain,
>>        xcb_present_complete_notify_event_t *complete = (void *) event;
>>        if (complete->kind == XCB_PRESENT_COMPLETE_KIND_PIXMAP)
>>           chain->last_present_msc = complete->msc;
>> +#if XCB_PRESENT_MAJOR_VERSION > 1 || XCB_PRESENT_MINOR_VERSION >= 1
>> +      if (complete->mode == XCB_PRESENT_COMPLETE_MODE_SUBOPTIMAL_COPY)
>> +         chain->suboptimal = true;
>
> I think I like the approach taken in GLX better.  Here, we'll properly
> reallocate when we go from not flipping to flipping but, what happens if we
> stop flipping?  In that case, we can do better if we reallocate again.

Sure, I'm happy to try to do the same here and send out v11 later.

> Also, I find "chain->suboptimal" and "chain->realloc_suboptimal" to be very
> confusing.  chain->suboptimal has an obvious meaning but the other doesn't.
> At the very least we need better documentation as to what they mean.

Yeah, I think a rename could help clarify. Maybe renaming
realloc_suboptimal to suboptimal_armed or something? It's effectively
should_we_tell_the_user_if_its_suboptimal_or_no: since the WSI spec is
very clear that returning SUBOPTIMAL from QueuePresent means the
client should reallocate, we try to avoid returning that constantly
for the cases where we _can't_ allocate optimally.

Cheers,
Daniel


More information about the mesa-dev mailing list