Commit bcd4228a authored by Bas Nieuwenhuizen's avatar Bas Nieuwenhuizen
Browse files

HACK: vulkan/wsi: enable freesync.

v2: sizeof->strlen (Michel)
parent 58376c6b
......@@ -1297,6 +1297,31 @@ x11_swapchain_destroy(struct wsi_swapchain *anv_chain,
return VK_SUCCESS;
static void
x11_set_adaptive_sync_property(xcb_connection_t *conn, xcb_drawable_t drawable,
uint32_t state)
static char const name[] = "_VARIABLE_REFRESH";
xcb_intern_atom_cookie_t cookie;
xcb_intern_atom_reply_t* reply;
xcb_void_cookie_t check;
cookie = xcb_intern_atom(conn, 0, strlen(name), name);
reply = xcb_intern_atom_reply(conn, cookie, NULL);
if (reply == NULL)
if (state)
check = xcb_change_property_checked(conn, XCB_PROP_MODE_REPLACE,
drawable, reply->atom,
XCB_ATOM_CARDINAL, 32, 1, &state);
check = xcb_delete_property_checked(conn, drawable, reply->atom);
xcb_discard_reply(conn, check.sequence);
static VkResult
x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
VkDevice device,
......@@ -1447,6 +1472,8 @@ x11_surface_create_swapchain(VkIcdSurfaceBase *icd_surface,
x11_set_adaptive_sync_property(conn, window, true);
for (int i = 0; i < ARRAY_SIZE(modifiers); i++)
vk_free(pAllocator, modifiers[i]);
*swapchain_out = &chain->base;
  • This patch works fine and I hope it will be merged soon to the mainline Mesa. I tested with 2 Linux games and 2 windows games that works with freesync. Video:

    The Shadow of the Tomb Raider Benchmark has a fps meter and it proves that RADV freesync works fine.

  • Change is successful: refresh rate of the monitor matches the framerate of the applications.

    Note that it is necessary to explicilty tell the Xorg server amdgpu module that we wish to enable adaptive sync via Option "VariableRefresh" "true"


    • Radeon RX Vega 64
    • Asus XG32VQ
    • Displayport Cable


    Applications Tested:

    • DOTA via Steam
    • Serious Sam Fusion 2017 (beta)

    I'll be sticking with my custom mesa build until this is merged :)

    Edited by Alexander Courtis
  • mentioned in merge request mesa/mesa!596 (closed)

    Toggle commit list
  • mentioned in merge request mesa/mesa!672 (merged)

    Toggle commit list
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment