From: Keith Packard <keithp@keithp.com>
To: mesa-dev@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Subject: [PATCH] dri3: Support GLX_INTEL_swap_event
Date: Thu, 21 Nov 2013 22:58:09 -0800 [thread overview]
Message-ID: <1385103489-24727-1-git-send-email-keithp@keithp.com> (raw)
The easy part is turning on the extension, now that the X server has a patch
to send the events.
The only trick was making sure the Present extension reliably provided the
right 'sbc' count back in the event, and that's done by making sure the sbc
count is always the same as the sequence number that we send in the
PresentPixmap requests, and that's done by using the same variable for both
roles.
Signed-off-by: Keith Packard <keithp@keithp.com>
---
This passes the piglet glx-swap-event test.
src/glx/dri3_glx.c | 27 ++++++---------------------
src/glx/dri3_priv.h | 3 +--
2 files changed, 7 insertions(+), 23 deletions(-)
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index 669f0bb..a7bf318 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -423,7 +423,7 @@ dri3_wait_for_msc(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
*ust = priv->ust;
*msc = priv->msc;
- *sbc = priv->sbc;
+ *sbc = priv->present_count;
return 1;
}
@@ -450,7 +450,7 @@ dri3_wait_for_sbc(__GLXDRIdrawable *pdraw, int64_t target_sbc, int64_t *ust,
{
struct dri3_drawable *priv = (struct dri3_drawable *) pdraw;
- while (priv->sbc < target_sbc) {
+ while (priv->present_count < target_sbc) {
sleep(1);
}
return dri3_wait_for_msc(pdraw, 0, 0, 0, ust, msc, sbc);
@@ -1282,7 +1282,8 @@ dri3_swap_buffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
/* Compute when we want the frame shown by taking the last known successful
* MSC and adding in a swap interval for each outstanding swap request
*/
- ++priv->present_request_serial;
+ ++priv->present_count;
+ priv->present_request_serial = (uint32_t) priv->present_count;
if (target_msc == 0)
target_msc = priv->msc + priv->swap_interval * (priv->present_request_serial - priv->present_event_serial);
@@ -1302,7 +1303,7 @@ dri3_swap_buffers(__GLXDRIdrawable *pdraw, int64_t target_msc, int64_t divisor,
target_msc,
divisor,
remainder, 0, NULL);
- ret = ++priv->sbc;
+ ret = priv->present_count;
/* If there's a fake front, then copy the source back buffer
* to the fake front to keep it up to date. This needs
@@ -1494,23 +1495,7 @@ dri3_bind_extensions(struct dri3_screen *psc, struct glx_display * priv,
__glXEnableDirectExtension(&psc->base, "GLX_SGI_swap_control");
__glXEnableDirectExtension(&psc->base, "GLX_MESA_swap_control");
__glXEnableDirectExtension(&psc->base, "GLX_SGI_make_current_read");
-
- /*
- * GLX_INTEL_swap_event is broken on the server side, where it's
- * currently unconditionally enabled. This completely breaks
- * systems running on drivers which don't support that extension.
- * There's no way to test for its presence on this side, so instead
- * of disabling it unconditionally, just disable it for drivers
- * which are known to not support it, or for DDX drivers supporting
- * only an older (pre-ScheduleSwap) version of DRI2.
- *
- * This is a hack which is required until:
- * http://lists.x.org/archives/xorg-devel/2013-February/035449.html
- * is merged and updated xserver makes it's way into distros:
- */
-// if (pdp->swapAvailable && strcmp(driverName, "vmwgfx") != 0) {
-// __glXEnableDirectExtension(&psc->base, "GLX_INTEL_swap_event");
-// }
+ __glXEnableDirectExtension(&psc->base, "GLX_INTEL_swap_event");
mask = psc->image_driver->getAPIMask(psc->driScreen);
diff --git a/src/glx/dri3_priv.h b/src/glx/dri3_priv.h
index 05f66cf..cdf986d 100644
--- a/src/glx/dri3_priv.h
+++ b/src/glx/dri3_priv.h
@@ -183,11 +183,10 @@ struct dri3_drawable {
uint8_t have_fake_front;
uint8_t is_pixmap;
+ uint64_t present_count;
uint32_t present_request_serial;
uint32_t present_event_serial;
- uint64_t sbc;
-
uint64_t ust, msc;
/* For WaitMSC */
--
1.8.4.2
next reply other threads:[~2013-11-22 6:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-22 6:58 Keith Packard [this message]
2013-11-25 21:48 ` [PATCH] dri3: Support GLX_INTEL_swap_event Eric Anholt
2013-11-25 22:44 ` Keith Packard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1385103489-24727-1-git-send-email-keithp@keithp.com \
--to=keithp@keithp.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=mesa-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox