diff options
-rw-r--r-- | src/egl/drivers/dri2/platform_x11_dri3.c | 19 | ||||
-rw-r--r-- | src/glx/dri3_glx.c | 19 | ||||
-rw-r--r-- | src/loader/loader_dri3_helper.c | 10 | ||||
-rw-r--r-- | src/loader/loader_dri3_helper.h | 3 |
4 files changed, 7 insertions, 44 deletions
diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c b/src/egl/drivers/dri2/platform_x11_dri3.c index 9548a249347..3a0efc6ccc9 100644 --- a/src/egl/drivers/dri2/platform_x11_dri3.c +++ b/src/egl/drivers/dri2/platform_x11_dri3.c @@ -45,22 +45,6 @@ loader_drawable_to_egl_surface(struct loader_dri3_drawable *draw) { return (struct dri3_egl_surface *)(((void*) draw) - offset); } -static int -egl_dri3_get_swap_interval(struct loader_dri3_drawable *draw) -{ - struct dri3_egl_surface *dri3_surf = loader_drawable_to_egl_surface(draw); - - return dri3_surf->base.SwapInterval; -} - -static void -egl_dri3_set_swap_interval(struct loader_dri3_drawable *draw, int interval) -{ - struct dri3_egl_surface *dri3_surf = loader_drawable_to_egl_surface(draw); - - dri3_surf->base.SwapInterval = interval; -} - static void egl_dri3_set_drawable_size(struct loader_dri3_drawable *draw, int width, int height) @@ -112,8 +96,6 @@ egl_dri3_flush_drawable(struct loader_dri3_drawable *draw, unsigned flags) } static const struct loader_dri3_vtable egl_dri3_vtable = { - .get_swap_interval = egl_dri3_get_swap_interval, - .set_swap_interval = egl_dri3_set_swap_interval, .set_drawable_size = egl_dri3_set_drawable_size, .in_current_context = egl_dri3_in_current_context, .get_dri_context = egl_dri3_get_dri_context, @@ -142,6 +124,7 @@ dri3_set_swap_interval(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, { struct dri3_egl_surface *dri3_surf = dri3_egl_surface(surf); + dri3_surf->base.SwapInterval = interval; loader_dri3_set_swap_interval(&dri3_surf->loader_drawable, interval); return EGL_TRUE; diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c index 64c0b9e7b9c..024e8ab0479 100644 --- a/src/glx/dri3_glx.c +++ b/src/glx/dri3_glx.c @@ -86,22 +86,6 @@ loader_drawable_to_dri3_drawable(struct loader_dri3_drawable *draw) { return (struct dri3_drawable *)(((void*) draw) - offset); } -static int -glx_dri3_get_swap_interval(struct loader_dri3_drawable *draw) -{ - struct dri3_drawable *priv = loader_drawable_to_dri3_drawable(draw); - - return priv->swap_interval; -} - -static void -glx_dri3_set_swap_interval(struct loader_dri3_drawable *draw, int interval) -{ - struct dri3_drawable *priv = loader_drawable_to_dri3_drawable(draw); - - priv->swap_interval = interval; -} - static void glx_dri3_set_drawable_size(struct loader_dri3_drawable *draw, int width, int height) @@ -173,8 +157,6 @@ glx_dri3_show_fps(struct loader_dri3_drawable *draw, uint64_t current_ust) } static const struct loader_dri3_vtable glx_dri3_vtable = { - .get_swap_interval = glx_dri3_get_swap_interval, - .set_swap_interval = glx_dri3_set_swap_interval, .set_drawable_size = glx_dri3_set_drawable_size, .in_current_context = glx_dri3_in_current_context, .get_dri_context = glx_dri3_get_dri_context, @@ -637,6 +619,7 @@ dri3_set_swap_interval(__GLXDRIdrawable *pdraw, int interval) break; } + priv->swap_interval = interval; loader_dri3_set_swap_interval(&priv->loader_drawable, interval); return 0; diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c index 1f666fcb8d4..9d241302918 100644 --- a/src/loader/loader_dri3_helper.c +++ b/src/loader/loader_dri3_helper.c @@ -77,7 +77,7 @@ dri3_update_num_back(struct loader_dri3_drawable *draw) void loader_dri3_set_swap_interval(struct loader_dri3_drawable *draw, int interval) { - draw->vtable->set_swap_interval(draw, interval); + draw->swap_interval = interval; dri3_update_num_back(draw); } @@ -164,7 +164,7 @@ loader_dri3_drawable_init(xcb_connection_t *conn, swap_interval = 1; break; } - draw->vtable->set_swap_interval(draw, swap_interval); + draw->swap_interval = swap_interval; dri3_update_num_back(draw); @@ -634,10 +634,8 @@ loader_dri3_swap_buffers_msc(struct loader_dri3_drawable *draw, __DRIcontext *dri_context; int64_t ret = 0; uint32_t options = XCB_PRESENT_OPTION_NONE; - int swap_interval; dri_context = draw->vtable->get_dri_context(draw); - swap_interval = draw->vtable->get_swap_interval(draw); draw->vtable->flush_drawable(draw, flush_flags); @@ -673,7 +671,7 @@ loader_dri3_swap_buffers_msc(struct loader_dri3_drawable *draw, */ ++draw->send_sbc; if (target_msc == 0 && divisor == 0 && remainder == 0) - target_msc = draw->msc + swap_interval * + target_msc = draw->msc + draw->swap_interval * (draw->send_sbc - draw->recv_sbc); else if (divisor == 0 && remainder > 0) { /* From the GLX_OML_sync_control spec: @@ -697,7 +695,7 @@ loader_dri3_swap_buffers_msc(struct loader_dri3_drawable *draw, * behaviour by not using XCB_PRESENT_OPTION_ASYNC, but this should not be * the default. */ - if (swap_interval == 0) + if (draw->swap_interval == 0) options |= XCB_PRESENT_OPTION_ASYNC; if (force_copy) options |= XCB_PRESENT_OPTION_COPY; diff --git a/src/loader/loader_dri3_helper.h b/src/loader/loader_dri3_helper.h index 90ee2007afb..af42425df7f 100644 --- a/src/loader/loader_dri3_helper.h +++ b/src/loader/loader_dri3_helper.h @@ -97,8 +97,6 @@ struct loader_dri3_extensions { struct loader_dri3_drawable; struct loader_dri3_vtable { - int (*get_swap_interval)(struct loader_dri3_drawable *); - void (*set_swap_interval)(struct loader_dri3_drawable *, int); void (*set_drawable_size)(struct loader_dri3_drawable *, int, int); bool (*in_current_context)(struct loader_dri3_drawable *); __DRIcontext *(*get_dri_context)(struct loader_dri3_drawable *); @@ -156,6 +154,7 @@ struct loader_dri3_drawable { xcb_special_event_t *special_event; bool first_init; + int swap_interval; struct loader_dri3_extensions *ext; const struct loader_dri3_vtable *vtable; |