#define __DRI_CTX_RESET_LOSE_CONTEXT 1
/*@}*/
+#define __DRI_CTX_ATTRIB_PRIORITY 4
+
+#define __DRI_CTX_PRIORITY_LOW 0
+#define __DRI_CTX_PRIORITY_MEDIUM 1
+#define __DRI_CTX_PRIORITY_HIGH 2
+
/**
* \name Reasons that __DRIdri2Extension::createContextAttribs might fail
*/
#define DRM_FORMAT_MOD_INVALID ((1ULL<<56) - 1)
#endif
+#define NUM_ATTRIBS 10
+
static void
dri_set_background_context(void *loaderPrivate)
{
{
int pos = 0;
- assert(*num_attribs >= 8);
+ assert(*num_attribs >= NUM_ATTRIBS);
ctx_attribs[pos++] = __DRI_CTX_ATTRIB_MAJOR_VERSION;
ctx_attribs[pos++] = dri2_ctx->base.ClientMajorVersion;
ctx_attribs[pos++] = __DRI_CTX_RESET_LOSE_CONTEXT;
}
+ if (dri2_ctx->base.ContextPriority != EGL_CONTEXT_PRIORITY_MEDIUM_IMG) {
+ unsigned val;
+
+ switch (dri2_ctx->base.ContextPriority) {
+ case EGL_CONTEXT_PRIORITY_HIGH_IMG:
+ val = __DRI_CTX_PRIORITY_HIGH;
+ break;
+ case EGL_CONTEXT_PRIORITY_MEDIUM_IMG:
+ val = __DRI_CTX_PRIORITY_MEDIUM;
+ break;
+ case EGL_CONTEXT_PRIORITY_LOW_IMG:
+ val = __DRI_CTX_PRIORITY_LOW;
+ break;
+ default:
+ _eglError(EGL_BAD_CONFIG, "eglCreateContext");
+ return false;
+ }
+
+ ctx_attribs[pos++] = __DRI_CTX_ATTRIB_PRIORITY;
+ ctx_attribs[pos++] = val;
+ }
+
*num_attribs = pos;
return true;
if (dri2_dpy->image_driver) {
unsigned error;
- unsigned num_attribs = 8;
- uint32_t ctx_attribs[8];
+ unsigned num_attribs = NUM_ATTRIBS;
+ uint32_t ctx_attribs[NUM_ATTRIBS];
if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
&num_attribs))
} else if (dri2_dpy->dri2) {
if (dri2_dpy->dri2->base.version >= 3) {
unsigned error;
- unsigned num_attribs = 8;
- uint32_t ctx_attribs[8];
+ unsigned num_attribs = NUM_ATTRIBS;
+ uint32_t ctx_attribs[NUM_ATTRIBS];
if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
&num_attribs))
assert(dri2_dpy->swrast);
if (dri2_dpy->swrast->base.version >= 3) {
unsigned error;
- unsigned num_attribs = 8;
- uint32_t ctx_attribs[8];
+ unsigned num_attribs = NUM_ATTRIBS;
+ uint32_t ctx_attribs[NUM_ATTRIBS];
if (!dri2_fill_context_attribs(dri2_ctx, dri2_dpy, ctx_attribs,
&num_attribs))
unsigned minor_version,
uint32_t flags,
bool notify_reset,
+ unsigned priority,
unsigned *error,
void *sharedContextPrivate)
{
unsigned minor_version,
uint32_t flags,
bool notify_reset,
+ unsigned priority,
unsigned *error,
void *sharedContextPrivate);
unsigned minor_version = 0;
uint32_t flags = 0;
bool notify_reset = false;
+ unsigned priority = __DRI_CTX_PRIORITY_MEDIUM;
assert((num_attribs == 0) || (attribs != NULL));
notify_reset = (attribs[i * 2 + 1]
!= __DRI_CTX_RESET_NO_NOTIFICATION);
break;
+ case __DRI_CTX_ATTRIB_PRIORITY:
+ priority = attribs[i * 2 + 1];
+ break;
default:
/* We can't create a context that satisfies the requirements of an
* attribute that we don't understand. Return failure.
if (!screen->driver->CreateContext(mesa_api, modes, context,
major_version, minor_version,
- flags, notify_reset, error, shareCtx)) {
+ flags, notify_reset, priority,
+ error, shareCtx)) {
free(context);
return NULL;
}
GLboolean (*CreateContext)(gl_api api,
const struct gl_config *glVis,
__DRIcontext *driContextPriv,
- unsigned major_version,
- unsigned minor_version,
- uint32_t flags,
+ unsigned major_version,
+ unsigned minor_version,
+ uint32_t flags,
bool notify_reset,
- unsigned *error,
+ unsigned priority,
+ unsigned *error,
void *sharedContextPrivate);
void (*DestroyContext)(__DRIcontext *driContextPriv);
static GLboolean
intelCreateContext(gl_api api,
- const struct gl_config * mesaVis,
+ const struct gl_config * mesaVis,
__DRIcontext * driContextPriv,
- unsigned major_version,
- unsigned minor_version,
- uint32_t flags,
+ unsigned major_version,
+ unsigned minor_version,
+ uint32_t flags,
bool notify_reset,
- unsigned *error,
+ unsigned priority,
+ unsigned *error,
void *sharedContextPrivate)
{
bool success = false;
GLboolean
brwCreateContext(gl_api api,
- const struct gl_config *mesaVis,
- __DRIcontext *driContextPriv,
+ const struct gl_config *mesaVis,
+ __DRIcontext *driContextPriv,
unsigned major_version,
unsigned minor_version,
uint32_t flags,
bool notify_reset,
+ unsigned priority,
unsigned *dri_ctx_error,
- void *sharedContextPrivate)
+ void *sharedContextPrivate)
{
struct gl_context *shareCtx = (struct gl_context *) sharedContextPrivate;
struct intel_screen *screen = driContextPriv->driScreenPriv->driverPrivate;
__DRIdrawable *drawable);
GLboolean brwCreateContext(gl_api api,
- const struct gl_config *mesaVis,
- __DRIcontext *driContextPriv,
- unsigned major_version,
- unsigned minor_version,
- uint32_t flags,
- bool notify_reset,
- unsigned *error,
- void *sharedContextPrivate);
+ const struct gl_config *mesaVis,
+ __DRIcontext *driContextPriv,
+ unsigned major_version,
+ unsigned minor_version,
+ uint32_t flags,
+ bool notify_reset,
+ unsigned priority,
+ unsigned *error,
+ void *sharedContextPrivate);
/*======================================================================
* brw_misc_state.c
unsigned minor_version,
uint32_t flags,
bool notify_reset,
+ unsigned priority,
unsigned *error,
void *share_ctx)
{
nouveau_context_create(gl_api api,
const struct gl_config *visual, __DRIcontext *dri_ctx,
unsigned major_version, unsigned minor_version,
- uint32_t flags, bool notify_reset, unsigned *error,
- void *share_ctx);
+ uint32_t flags, bool notify_reset, unsigned priority,
+ unsigned *error, void *share_ctx);
GLboolean
nouveau_context_init(struct gl_context *ctx, gl_api api,
unsigned minor_version,
uint32_t flags,
bool notify_reset,
+ unsigned priority,
unsigned *error,
void *sharedContextPrivate)
{
unsigned minor_version,
uint32_t flags,
bool notify_reset,
+ unsigned priority,
unsigned *error,
void *sharedContextPrivate);
extern GLboolean r200MakeCurrent( __DRIcontext *driContextPriv,
unsigned minor_version,
uint32_t flags,
bool notify_reset,
+ unsigned priority,
unsigned *error,
void *sharedContextPrivate)
{
unsigned minor_version,
uint32_t flags,
bool notify_reset,
+ unsigned priority,
unsigned *error,
void *sharedContextPrivate);
unsigned minor_version,
uint32_t flags,
bool notify_reset,
+ unsigned priority,
unsigned *error,
void *sharedContextPrivate)
{