summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfaith <faith>2000-10-27 20:18:26 +0000
committerfaith <faith>2000-10-27 20:18:26 +0000
commit418fb2ac26bf97f7ae264537a356d2cbae53e911 (patch)
tree3143473fc975435708e1653ab319d8332eaa89db
parenta385046d3ef0b92dc70baef4f145eed772be7f11 (diff)
Optimize a call to glXMakeCurrent so that if a fullscreen drawable is unbound
and then immediately rebound, that no protocol is sent to the X server.
-rw-r--r--xc/lib/GL/glx/glxclient.h2
-rw-r--r--xc/lib/GL/glx/glxext.c5
-rw-r--r--xc/lib/GL/mesa/dri/dri_mesa.c14
3 files changed, 15 insertions, 6 deletions
diff --git a/xc/lib/GL/glx/glxclient.h b/xc/lib/GL/glx/glxclient.h
index fffa57b17..993b0219e 100644
--- a/xc/lib/GL/glx/glxclient.h
+++ b/xc/lib/GL/glx/glxclient.h
@@ -155,7 +155,7 @@ struct __DRIcontextRec {
** Method to unbind a DRI drawable to a DRI graphics context.
*/
Bool (*unbindContext)(Display *dpy, int scrn, GLXDrawable draw,
- GLXContext gc);
+ GLXContext gc, int will_rebind);
/*
** Opaque pointer to private per context direct rendering data.
diff --git a/xc/lib/GL/glx/glxext.c b/xc/lib/GL/glx/glxext.c
index 424365549..8c757ea2a 100644
--- a/xc/lib/GL/glx/glxext.c
+++ b/xc/lib/GL/glx/glxext.c
@@ -819,10 +819,13 @@ Bool glXMakeCurrent(Display *dpy, GLXDrawable draw, GLXContext gc)
/* Unbind the old direct rendering context */
if (oldGC->isDirect) {
if (oldGC->driContext.private) {
+ int will_rebind = (gc && gc->isDirect
+ && draw == oldGC->currentDrawable);
if (!(*oldGC->driContext.unbindContext)(oldGC->currentDpy,
oldGC->screen,
oldGC->currentDrawable,
- oldGC)) {
+ oldGC,
+ will_rebind)) {
/* The make current failed. Just return GL_FALSE. */
return GL_FALSE;
}
diff --git a/xc/lib/GL/mesa/dri/dri_mesa.c b/xc/lib/GL/mesa/dri/dri_mesa.c
index 41fd80a8e..ce19ff62b 100644
--- a/xc/lib/GL/mesa/dri/dri_mesa.c
+++ b/xc/lib/GL/mesa/dri/dri_mesa.c
@@ -51,7 +51,8 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
static Bool driMesaBindContext(Display *dpy, int scrn,
GLXDrawable draw, GLXContext gc);
static Bool driMesaUnbindContext(Display *dpy, int scrn,
- GLXDrawable draw, GLXContext gc);
+ GLXDrawable draw, GLXContext gc,
+ int will_rebind);
/* Drawable methods */
static void *driMesaCreateDrawable(Display *dpy, int scrn, GLXDrawable draw,
@@ -153,7 +154,8 @@ static void driMesaInitAPI(__MesaAPI *MesaAPI)
/*****************************************************************/
static Bool driMesaUnbindContext(Display *dpy, int scrn,
- GLXDrawable draw, GLXContext gc)
+ GLXDrawable draw, GLXContext gc,
+ int will_rebind)
{
__DRIdrawable *pdraw;
__DRIcontextPrivate *pcp;
@@ -184,7 +186,11 @@ static Bool driMesaUnbindContext(Display *dpy, int scrn,
return GL_FALSE;
}
- if (psp->fullscreen) {
+ /* Don't leave fullscreen mode if the
+ drawable will be rebound in the next
+ step -- this avoids a protocol
+ request. */
+ if (!will_rebind && psp->fullscreen) {
psp->MesaAPI.CloseFullScreen(pcp);
XF86DRICloseFullScreen(dpy, scrn, draw);
psp->fullscreen = NULL;
@@ -335,7 +341,7 @@ static Bool driMesaBindContext(Display *dpy, int scrn,
psp->pSAREA->frame.y,
psp->pSAREA->frame.width,
psp->pSAREA->frame.height);
- if (XF86DRIOpenFullScreen(dpy, scrn, draw)) {
+ if (!psp->fullscreen && XF86DRIOpenFullScreen(dpy, scrn, draw)) {
psp->fullscreen = pdp;
psp->MesaAPI.OpenFullScreen(pcp);
}