[Mesa-dev] [PATCH] glx/dri: Initialize reset to __DRI_CTX_RESET_NO_NOTIFICATION.

Ian Romanick idr at freedesktop.org
Wed Aug 8 10:04:35 PDT 2012


On 08/06/2012 04:49 PM, Kenneth Graunke wrote:
> I noticed that we have a bit of inconsistency in how we handle context
> defaults.  In some cases, we initialize variables with default values in
> dri{2,sw}_create_context_attribs.  In other cases, we rely on
> dri2_convert_glx_attribs to do that for us.
>
> For example, in dri2_convert_glx_attribs:
>
>      uint32_t minor_ver = 1;
>      uint32_t major_ver = 2;
>      uint32_t flags = 0;
>      unsigned api;
>      int reset;

Oh... that's broken.  I had intended to default to 1.2 because the Linux 
ABI requires at least version 1.2.

>
> we default the version to 2.1.  Whereas in dri_convert_glx_attribs we have:
>
>     if (num_attribs == 0) {
>        *api = __DRI_API_OPENGL;
>        return true;
>     }
>     ...
>     *major_ver = 1;
>     *minor_ver = 0;
>     *reset = __DRI_CTX_RESET_NO_NOTIFICATION;
>
> So if they try to create a context with _no_ attributes, we pick 2.1.
> If they specify _some_ attributes, but not version attributes, we hit
> this code and pick 1.0.  drisw_create_context_attribs also defaults to 1.0.
>
> My feeling is that we should either make dri2_convert_glx_attribs not
> short-circuit on num_attribs == 0, so it fully initializes all the
> defaults, or we should make both the callers fully specify defaults and
> remove the block that makes it set them.  Either would work, but it'd be
> nice to pick one.

I'd lean towards the former... with a unit test to make sure.


More information about the mesa-dev mailing list