[Mesa-dev] [PATCH] [AMD] dri3: Add adaptive_sync_enable driconf option

Michel Dänzer michel at daenzer.net
Tue Oct 17 10:07:35 UTC 2017


On 17/10/17 11:33 AM, Nicolai Hähnle wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
> 
> When enabled, this will request FreeSync via the hybrid amdgpu DDX's
> AMDGPU X11 protocol extension.
> 
> Due to limitations in the DDX this will only work for applications
> that cover the entire X screen (which is important to keep in mind when
> you have a multi-monitor setup).

This limitation already applies to page flipping in general, it's not
specific to FreeSync.


> @@ -269,25 +315,32 @@ loader_dri3_drawable_init(xcb_connection_t *conn,
>     draw->drawable = drawable;
>     draw->dri_screen = dri_screen;
>     draw->is_different_gpu = is_different_gpu;
>  
>     draw->have_back = 0;
>     draw->have_fake_front = 0;
>     draw->first_init = true;
>  
>     draw->cur_blit_source = -1;
>     draw->back_format = __DRI_IMAGE_FORMAT_NONE;
> +   draw->adaptive_sync = false;
>  
> -   if (draw->ext->config)
> +   if (draw->ext->config) {
>        draw->ext->config->configQueryi(draw->dri_screen,
>                                        "vblank_mode", &vblank_mode);
>  
> +      unsigned char adaptive_sync_enable = 1;

Adaptive sync shouldn't be enabled by default. (Maybe that effectively
isn't the case, but then initializing this variable to 1 is just
confusing :)


> @@ -767,20 +820,25 @@ loader_dri3_swap_buffers_msc(struct loader_dri3_drawable *draw,
>                               bool force_copy)
>  {
>     struct loader_dri3_buffer *back;
>     int64_t ret = 0;
>     uint32_t options = XCB_PRESENT_OPTION_NONE;
>  
>     draw->vtable->flush_drawable(draw, flush_flags);
>  
>     back = dri3_find_back_alloc(draw);
>  
> +   if (draw->adaptive_sync) {
> +      if (!loader_dri3_amdgpu_freesync_enable(draw->conn, draw->drawable))
> +         draw->adaptive_sync = false;
> +   }

The AMDGPUFreesyncCapability request only has to be submitted once per
window, not for every buffer swap.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the mesa-dev mailing list