summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/common/dri_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/common/dri_util.c')
-rw-r--r--src/mesa/drivers/dri/common/dri_util.c103
1 files changed, 57 insertions, 46 deletions
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index 75c98825b7..8b3d8c27ce 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -31,6 +31,17 @@
#include "dri_util.h"
#include "drm_sarea.h"
#include "utils.h"
+#include "vblank.h"
+#include "xmlpool.h"
+
+PUBLIC const char __dri2ConfigOptions[] =
+ DRI_CONF_BEGIN
+ DRI_CONF_SECTION_PERFORMANCE
+ DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_1)
+ DRI_CONF_SECTION_END
+ DRI_CONF_END;
+
+static const uint __dri2NConfigOptions = 1;
#ifndef GLX_OML_sync_control
typedef GLboolean ( * PFNGLXGETMSCRATEOMLPROC) (__DRIdrawable *drawable, int32_t *numerator, int32_t *denominator);
@@ -47,28 +58,6 @@ const __DRIextension driReadDrawableExtension = {
__DRI_READ_DRAWABLE, __DRI_READ_DRAWABLE_VERSION
};
-/**
- * Print message to \c stderr if the \c LIBGL_DEBUG environment variable
- * is set.
- *
- * Is called from the drivers.
- *
- * \param f \c printf like format string.
- */
-void
-__driUtilMessage(const char *f, ...)
-{
- va_list args;
-
- if (getenv("LIBGL_DEBUG")) {
- fprintf(stderr, "libGL: ");
- va_start(args, f);
- vfprintf(stderr, f, args);
- va_end(args);
- fprintf(stderr, "\n");
- }
-}
-
GLint
driIntersectArea( drm_clip_rect_t rect1, drm_clip_rect_t rect2 )
{
@@ -151,11 +140,6 @@ static int driUnbindContext(__DRIcontext *pcp)
*/
pcp->driDrawablePriv = pcp->driReadablePriv = NULL;
-#if 0
- /* Unbind the drawable */
- pdp->driContextPriv = &psp->dummyContextPriv;
-#endif
-
return GL_TRUE;
}
@@ -455,7 +439,6 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config,
pdp->vblFlags = 0;
pdp->driScreenPriv = psp;
- pdp->driContextPriv = &psp->dummyContextPriv;
if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, &config->modes,
renderType == GLX_PIXMAP_BIT)) {
@@ -495,6 +478,41 @@ dri2CreateNewDrawable(__DRIscreen *screen,
return pdraw;
}
+static int
+dri2ConfigQueryb(__DRIscreen *screen, const char *var, GLboolean *val)
+{
+ if (!driCheckOption(&screen->optionCache, var, DRI_BOOL))
+ return -1;
+
+ *val = driQueryOptionb(&screen->optionCache, var);
+
+ return 0;
+}
+
+static int
+dri2ConfigQueryi(__DRIscreen *screen, const char *var, GLint *val)
+{
+ if (!driCheckOption(&screen->optionCache, var, DRI_INT) &&
+ !driCheckOption(&screen->optionCache, var, DRI_ENUM))
+ return -1;
+
+ *val = driQueryOptioni(&screen->optionCache, var);
+
+ return 0;
+}
+
+static int
+dri2ConfigQueryf(__DRIscreen *screen, const char *var, GLfloat *val)
+{
+ if (!driCheckOption(&screen->optionCache, var, DRI_FLOAT))
+ return -1;
+
+ *val = driQueryOptionf(&screen->optionCache, var);
+
+ return 0;
+}
+
+
static void dri_get_drawable(__DRIdrawable *pdp)
{
pdp->refcount++;
@@ -589,17 +607,6 @@ driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config,
pcp->dri2.draw_stamp = 0;
pcp->dri2.read_stamp = 0;
- /* When the first context is created for a screen, initialize a "dummy"
- * context.
- */
-
- if (!psp->dri2.enabled && !psp->dummyContextPriv.driScreenPriv) {
- psp->dummyContextPriv.hHWContext = psp->pSAREA->dummy_context;
- psp->dummyContextPriv.driScreenPriv = psp;
- psp->dummyContextPriv.driDrawablePriv = NULL;
- psp->dummyContextPriv.driverPrivate = NULL;
- /* No other fields should be used! */
- }
pcp->hHWContext = hwContext;
@@ -756,13 +763,6 @@ driCreateNewScreen(int scrn,
psp->myNum = scrn;
psp->dri2.enabled = GL_FALSE;
- /*
- ** Do not init dummy context here; actual initialization will be
- ** done when the first DRI context is created. Init screen priv ptr
- ** to NULL to let CreateContext routine that it needs to be inited.
- */
- psp->dummyContextPriv.driScreenPriv = NULL;
-
psp->DriverAPI = driDriverAPI;
*driver_modes = driDriverAPI.InitScreen(psp);
@@ -785,6 +785,7 @@ dri2CreateNewScreen(int scrn, int fd,
static const __DRIextension *emptyExtensionList[] = { NULL };
__DRIscreen *psp;
drmVersionPtr version;
+ driOptionCache options;
if (driDriverAPI.InitScreen2 == NULL)
return NULL;
@@ -817,6 +818,9 @@ dri2CreateNewScreen(int scrn, int fd,
psp->DriverAPI = driDriverAPI;
+ driParseOptionInfo(&options, __dri2ConfigOptions, __dri2NConfigOptions);
+ driParseConfigFiles(&psp->optionCache, &options, psp->myNum, "dri2");
+
return psp;
}
@@ -859,6 +863,13 @@ const __DRIdri2Extension driDRI2Extension = {
dri2CreateNewContext,
};
+const __DRI2configQueryExtension dri2ConfigQueryExtension = {
+ { __DRI2_CONFIG_QUERY, __DRI2_CONFIG_QUERY_VERSION },
+ dri2ConfigQueryb,
+ dri2ConfigQueryi,
+ dri2ConfigQueryf,
+};
+
static int
driFrameTracking(__DRIdrawable *drawable, GLboolean enable)
{