summaryrefslogtreecommitdiff
path: root/src/loader
diff options
context:
space:
mode:
authorEmil Velikov <emil.velikov@collabora.com>2017-08-02 00:59:26 +0100
committerEmil Velikov <emil.l.velikov@gmail.com>2017-08-04 23:57:22 +0100
commit9777c4234b0e78bf79455ff7081068fe3c71a2de (patch)
tree15fd1d4467ed049ac3e967b5bd1ab4b7eba9bd95 /src/loader
parentc961b679fe16fc98c3d04d611abc287f1bcc07b5 (diff)
loader: drop the [gs]et_swap_interval callbacks
Having two callbacks to manage a single int seems like an overkill. Use a cached copy and update that when needed. Signed-off-by: Emil Velikov <emil.velikov@collabora.com> --- Might want to look if the dimensions dance in .query_surface ... speaking of which close to nobody implements that ...
Diffstat (limited to 'src/loader')
-rw-r--r--src/loader/loader_dri3_helper.c10
-rw-r--r--src/loader/loader_dri3_helper.h3
2 files changed, 5 insertions, 8 deletions
diff --git a/src/loader/loader_dri3_helper.c b/src/loader/loader_dri3_helper.c
index 1f666fcb8d..9d24130291 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 90ee2007af..af42425df7 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;