[PATCH 4/4] glx: Reject creations of indirect contexts with unsupportable versions.

Ian Romanick idr at freedesktop.org
Tue Jun 12 12:50:49 PDT 2012


On 06/10/2012 11:13 AM, Dave Airlie wrote:
> On Fri, Jun 8, 2012 at 9:10 PM, Ian Romanick<idr at freedesktop.org>  wrote:
>> From: Ian Romanick<ian.d.romanick at intel.com>
>>
>> Signed-off-by: Ian Romanick<ian.d.romanick at intel.com>
>
> Looks like a piglit test for this would be good, if there isn't one,
> if there is it would be good to mention it.

I've been putting together some piglit tests for 
GLX_ARB_create_context_profile and GLX_EXT_create_context_es2_profile. 
These should go out to the piglit list today.

One difficulty with this particular change is that a vendor could, 
hypothetically, make their protocol for later GL versions.  I believe 
that NVIDIA has protocol for up to 2.1 and possibly later.  In that 
case, creating an indirect rendering context would succeed.

> but it looks fine,
>
> Reviewed-by: Dave Airlie<airlied at redhat.com>
>> ---
>>   glx/createcontext.c |   17 +++++++++++++++++
>>   1 files changed, 17 insertions(+), 0 deletions(-)
>>
>> diff --git a/glx/createcontext.c b/glx/createcontext.c
>> index 8f7dc05..4a6e1b5 100644
>> --- a/glx/createcontext.c
>> +++ b/glx/createcontext.c
>> @@ -270,6 +270,23 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
>>          return __glXError(GLXBadProfileARB);
>>      }
>>
>> +    /* There is no GLX protocol for desktop OpenGL versions after 1.4.  There
>> +     * is no GLX protocol for any version of OpenGL ES.  If the application is
>> +     * requested an indirect rendering context for a version that cannot be
>> +     * satisfied, reject it.
>> +     *
>> +     * The GLX_ARB_create_context spec says:
>> +     *
>> +     *     "* If<config>  does not support compatible OpenGL contexts
>> +     *        providing the requested API major and minor version,
>> +     *        forward-compatible flag, and debug context flag, GLXBadFBConfig
>> +     *        is generated."
>> +     */
>> +    if (!req->isDirect&&  (major_version>  1 || minor_version>  4
>> +                           || profile == GLX_CONTEXT_ES2_PROFILE_BIT_EXT)) {
>> +        return __glXError(GLXBadFBConfig);
>> +    }
>> +
>>      /* Allocate memory for the new context
>>       */
>>      if (req->isDirect) {
>> --
>> 1.7.6.5


More information about the xorg-devel mailing list