+ gc->currentDrawable = None;
+ gc->currentReadable = None;
+
+}
+
+_X_HIDDEN bool
+dri2_convert_glx_attribs(unsigned num_attribs, const uint32_t *attribs,
+ unsigned *major_ver, unsigned *minor_ver,
+ uint32_t *render_type, uint32_t *flags, unsigned *api,
+ int *reset, int *release, unsigned *error)
+{
+ unsigned i;
+ bool got_profile = false;
+ uint32_t profile;
+
+ *major_ver = 1;
+ *minor_ver = 0;
+ *render_type = GLX_RGBA_TYPE;
+ *reset = __DRI_CTX_RESET_NO_NOTIFICATION;
+ *release = __DRI_CTX_RELEASE_BEHAVIOR_FLUSH;
+ *flags = 0;
+ *api = __DRI_API_OPENGL;
+
+ if (num_attribs == 0) {
+ return true;
+ }
+
+ /* This is actually an internal error, but what the heck.
+ */
+ if (attribs == NULL) {
+ *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
+ return false;
+ }
+
+ for (i = 0; i < num_attribs; i++) {
+ switch (attribs[i * 2]) {
+ case GLX_CONTEXT_MAJOR_VERSION_ARB:
+ *major_ver = attribs[i * 2 + 1];
+ break;
+ case GLX_CONTEXT_MINOR_VERSION_ARB:
+ *minor_ver = attribs[i * 2 + 1];
+ break;
+ case GLX_CONTEXT_FLAGS_ARB:
+ *flags = attribs[i * 2 + 1];
+ break;
+ case GLX_CONTEXT_PROFILE_MASK_ARB:
+ profile = attribs[i * 2 + 1];
+ got_profile = true;
+ break;
+ case GLX_RENDER_TYPE:
+ *render_type = attribs[i * 2 + 1];
+ break;
+ case GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB:
+ switch (attribs[i * 2 + 1]) {
+ case GLX_NO_RESET_NOTIFICATION_ARB:
+ *reset = __DRI_CTX_RESET_NO_NOTIFICATION;
+ break;
+ case GLX_LOSE_CONTEXT_ON_RESET_ARB:
+ *reset = __DRI_CTX_RESET_LOSE_CONTEXT;
+ break;
+ default:
+ *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
+ return false;
+ }
+ break;
+ case GLX_CONTEXT_RELEASE_BEHAVIOR_ARB:
+ switch (attribs[i * 2 + 1]) {
+ case GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB:
+ *release = __DRI_CTX_RELEASE_BEHAVIOR_NONE;
+ break;
+ case GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB:
+ *release = __DRI_CTX_RELEASE_BEHAVIOR_FLUSH;
+ break;
+ default:
+ *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
+ return false;
+ }
+ break;
+ default:
+ /* If an unknown attribute is received, fail.
+ */
+ *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
+ return false;