[Mesa-dev] [PATCH] dri: Make classic drivers allow __DRI_CTX_FLAG_NO_ERROR.

Grigori Goronzy greg at chown.ath.cx
Tue Jul 18 20:40:33 UTC 2017


On 2017-07-18 20:25, Ian Romanick wrote:
> On 07/14/2017 04:10 PM, Kenneth Graunke wrote:
>> Grigori recently added EGL_KHR_create_context_no_error support,
>> which causes EGL to pass a new __DRI_CTX_FLAG_NO_ERROR flag to
>> drivers when requesting an appropriate context mode.
>> 
>> driContextSetFlags() will already handle it properly for us, but the
>> classic drivers all have code to explicitly balk at unknown flags.  We
>> need to let it through or they'll fail to create a no_error context.
> 
> I'm almost afraid to ask... are there tests that try to create a
> no_error context?
> 

I don't think there are any yet. I have a piglit test for this which 
creates a context with EGL_khr_create_context_no_error and verifies that 
glGetError() behaves correctly in error conditions. I've used it to test 
my no_error series, but it's super hacky. Let me finish it up and I'll 
submit it in a few days.

Grigori

>> ---
>>  src/mesa/drivers/dri/i915/intel_screen.c       | 2 +-
>>  src/mesa/drivers/dri/i965/brw_context.c        | 5 +++--
>>  src/mesa/drivers/dri/nouveau/nouveau_context.c | 2 +-
>>  src/mesa/drivers/dri/r200/r200_context.c       | 2 +-
>>  src/mesa/drivers/dri/radeon/radeon_context.c   | 2 +-
>>  5 files changed, 7 insertions(+), 6 deletions(-)
>> 
>> Drivers other than i965 have not been tested.
>> 
>> diff --git a/src/mesa/drivers/dri/i915/intel_screen.c 
>> b/src/mesa/drivers/dri/i915/intel_screen.c
>> index 9e23552b998..1ac72e14a15 100644
>> --- a/src/mesa/drivers/dri/i915/intel_screen.c
>> +++ b/src/mesa/drivers/dri/i915/intel_screen.c
>> @@ -972,7 +972,7 @@ intelCreateContext(gl_api api,
>>     __DRIscreen *sPriv = driContextPriv->driScreenPriv;
>>     struct intel_screen *intelScreen = sPriv->driverPrivate;
>> 
>> -   if (flags & ~__DRI_CTX_FLAG_DEBUG) {
>> +   if (flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_NO_ERROR)) {
>>        *error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
>>        return false;
>>     }
>> diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
>> b/src/mesa/drivers/dri/i965/brw_context.c
>> index b23e811f305..bd26e2332c7 100644
>> --- a/src/mesa/drivers/dri/i965/brw_context.c
>> +++ b/src/mesa/drivers/dri/i965/brw_context.c
>> @@ -813,8 +813,9 @@ brwCreateContext(gl_api api,
>>     /* Only allow the __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS flag if the 
>> kernel
>>      * provides us with context reset notifications.
>>      */
>> -   uint32_t allowed_flags = __DRI_CTX_FLAG_DEBUG
>> -      | __DRI_CTX_FLAG_FORWARD_COMPATIBLE;
>> +   uint32_t allowed_flags = __DRI_CTX_FLAG_DEBUG |
>> +                            __DRI_CTX_FLAG_FORWARD_COMPATIBLE |
>> +                            __DRI_CTX_FLAG_NO_ERROR;
>> 
>>     if (screen->has_context_reset_notification)
>>        allowed_flags |= __DRI_CTX_FLAG_ROBUST_BUFFER_ACCESS;
>> diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c 
>> b/src/mesa/drivers/dri/nouveau/nouveau_context.c
>> index 6ddcadce1f0..d6f9e533848 100644
>> --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
>> +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
>> @@ -63,7 +63,7 @@ nouveau_context_create(gl_api api,
>>  	struct nouveau_context *nctx;
>>  	struct gl_context *ctx;
>> 
>> -	if (flags & ~__DRI_CTX_FLAG_DEBUG) {
>> +	if (flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_NO_ERROR)) {
>>  		*error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
>>  		return false;
>>  	}
>> diff --git a/src/mesa/drivers/dri/r200/r200_context.c 
>> b/src/mesa/drivers/dri/r200/r200_context.c
>> index aaa9b9317df..5a7f33499b1 100644
>> --- a/src/mesa/drivers/dri/r200/r200_context.c
>> +++ b/src/mesa/drivers/dri/r200/r200_context.c
>> @@ -189,7 +189,7 @@ GLboolean r200CreateContext( gl_api api,
>>     int i;
>>     int tcl_mode;
>> 
>> -   if (flags & ~__DRI_CTX_FLAG_DEBUG) {
>> +   if (flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_NO_ERROR)) {
>>        *error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
>>        return false;
>>     }
>> diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c 
>> b/src/mesa/drivers/dri/radeon/radeon_context.c
>> index 11afe20c6a0..5ef3467ac17 100644
>> --- a/src/mesa/drivers/dri/radeon/radeon_context.c
>> +++ b/src/mesa/drivers/dri/radeon/radeon_context.c
>> @@ -155,7 +155,7 @@ r100CreateContext( gl_api api,
>>     int i;
>>     int tcl_mode, fthrottle_mode;
>> 
>> -   if (flags & ~__DRI_CTX_FLAG_DEBUG) {
>> +   if (flags & ~(__DRI_CTX_FLAG_DEBUG | __DRI_CTX_FLAG_NO_ERROR)) {
>>        *error = __DRI_CTX_ERROR_UNKNOWN_FLAG;
>>        return false;
>>     }
>> 


More information about the mesa-dev mailing list