/* DRI3+Present together uses microseconds for UST. */
if (priv->previous_ust + interval * 1000000 <= current_ust) {
if (priv->previous_ust) {
- fprintf(stderr, "libGL: FPS = %.1f\n",
+ fprintf(stderr, "libGL: FPS = %.2f\n",
((uint64_t) priv->frames * 1000000) /
(double)(current_ust - priv->previous_ust));
}
return GLXBadContext;
if (dri_draw)
- (*psc->f->invalidate)(dri_draw);
+ psc->f->invalidate(dri_draw);
if (dri_read && dri_read != dri_draw)
- (*psc->f->invalidate)(dri_read);
+ psc->f->invalidate(dri_read);
return Success;
}
&reset, &release, error))
goto error_exit;
+ if (!dri2_check_no_error(flags, shareList, major_ver, error)) {
+ goto error_exit;
+ }
+
/* Check the renderType value */
if (!validate_renderType_against_config(config_base, render_type))
goto error_exit;
* GLX_CONTEXT_*_BIT values.
*/
ctx_attribs[num_ctx_attribs++] = flags;
+
+ if (flags & __DRI_CTX_FLAG_NO_ERROR)
+ pcp->base.noError = GL_TRUE;
}
pcp->driContext =
{
struct dri3_drawable *pdraw;
struct dri3_screen *psc = (struct dri3_screen *) base;
- const struct dri3_display *const pdp = (struct dri3_display *)
- base->display->dri3Display;
__GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) config_base;
bool has_multibuffer = false;
+#ifdef HAVE_DRI3_MODIFIERS
+ const struct dri3_display *const pdp = (struct dri3_display *)
+ base->display->dri3Display;
+#endif
pdraw = calloc(1, sizeof(*pdraw));
if (!pdraw)
pdraw->base.drawable = drawable;
pdraw->base.psc = &psc->base;
+#ifdef HAVE_DRI3_MODIFIERS
if ((psc->image && psc->image->base.version >= 15) &&
- (pdp->dri3Major > 1 || (pdp->dri3Major == 1 && pdp->dri3Minor >= 2)))
+ (pdp->dri3Major > 1 || (pdp->dri3Major == 1 && pdp->dri3Minor >= 2)) &&
+ (pdp->presentMajor > 1 ||
+ (pdp->presentMajor == 1 && pdp->presentMinor >= 2)))
has_multibuffer = true;
+#endif
(void) __glXInitialize(psc->base.dpy);
loader_dri3_flush(draw, __DRI2_FLUSH_DRAWABLE, __DRI2_THROTTLE_FLUSHFRONT);
- (*psc->f->invalidate)(driDrawable);
+ psc->f->invalidate(driDrawable);
loader_dri3_wait_gl(draw);
}
break;
}
- priv->swap_interval = interval;
loader_dri3_set_swap_interval(&priv->loader_drawable, interval);
return 0;
struct dri3_drawable *priv = (struct dri3_drawable *) pdraw;
- return priv->swap_interval;
+ return priv->loader_drawable.swap_interval;
}
static void
if (pdraw != NULL) {
psc = (struct dri3_screen *) base->psc;
- (*psc->f->invalidate)(pdraw->loader_drawable.dri_drawable);
+ psc->f->invalidate(pdraw->loader_drawable.dri_drawable);
XSync(dpy, false);
__glXEnableDirectExtension(&psc->base,
"GLX_ARB_create_context_robustness");
+ if (strcmp(extensions[i]->name, __DRI2_NO_ERROR) == 0)
+ __glXEnableDirectExtension(&psc->base,
+ "GLX_ARB_create_context_no_error");
+
if (strcmp(extensions[i]->name, __DRI2_RENDERER_QUERY) == 0) {
psc->rendererQuery = (__DRI2rendererQueryExtension *) extensions[i];
__glXEnableDirectExtension(&psc->base, "GLX_MESA_query_renderer");
goto handle_error;
}
- psc->driver = driOpenDriver(driverName);
- if (psc->driver == NULL) {
- ErrorMessageF("driver pointer missing\n");
- goto handle_error;
- }
-
- extensions = driGetDriverExtensions(psc->driver, driverName);
+ extensions = driOpenDriver(driverName, &psc->driver);
if (extensions == NULL)
goto handle_error;
return &psc->base;
handle_error:
- CriticalErrorMessageF("failed to load driver: %s\n", driverName);
+ CriticalErrorMessageF("failed to load driver: %s\n", driverName ? driverName : "(null)");
if (configs)
glx_config_destroy_list(configs);
free(dpy);
}
+/* Only request versions of these protocols which we actually support. */
+#define DRI3_SUPPORTED_MAJOR 1
+#define PRESENT_SUPPORTED_MAJOR 1
+
+#ifdef HAVE_DRI3_MODIFIERS
+#define DRI3_SUPPORTED_MINOR 2
+#define PRESENT_SUPPORTED_MINOR 2
+#else
+#define PRESENT_SUPPORTED_MINOR 0
+#define DRI3_SUPPORTED_MINOR 0
+#endif
+
/** dri3_create_display
*
* Allocate, initialize and return a __DRIdisplayPrivate object.
return NULL;
dri3_cookie = xcb_dri3_query_version(c,
- XCB_DRI3_MAJOR_VERSION,
- XCB_DRI3_MINOR_VERSION);
-
-
+ DRI3_SUPPORTED_MAJOR,
+ DRI3_SUPPORTED_MINOR);
present_cookie = xcb_present_query_version(c,
- XCB_PRESENT_MAJOR_VERSION,
- XCB_PRESENT_MINOR_VERSION);
+ PRESENT_SUPPORTED_MAJOR,
+ PRESENT_SUPPORTED_MINOR);
pdp = malloc(sizeof *pdp);
if (pdp == NULL)