[Mesa-dev] [PATCH 4/7] main: rework the compatibility check of visuals in glXMakeCurrent

Miklós Máté mtmkls at gmail.com
Tue Mar 15 22:16:19 UTC 2016


On 03/04/2016 12:11 AM, Miklós Máté wrote:
> On 02/25/2016 08:20 PM, Ian Romanick wrote:
>> On 02/25/2016 07:48 AM, Brian Paul wrote:
>>> On 02/25/2016 08:26 AM, Miklós Máté wrote:
>>>> On 02/25/2016 02:37 AM, Brian Paul wrote:
>>>>> On 02/24/2016 04:35 PM, Miklós Máté wrote:
>>>>>> Now it follows the GLX 1.4 specification.
>>>>> Can you elaborate on that a bit?
>>>> Section 2.1 of the GLX spec lists a few criteria for a context and a
>>>> drawable to be compatible.
>>>>
>>>>>
>>>>>> This fixes post-processing in SW:KotOR.
>>>>>>
>>>>>> Signed-off-by: Miklós Máté <mtmkls at gmail.com>
>>>>>> ---
>>>>>>    src/mesa/main/context.c | 42
>>>>>> ++++++++++++------------------------------
>>>>>>    1 file changed, 12 insertions(+), 30 deletions(-)
>>>>>>
>>>>>> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
>>>>>> index 26eee28..6c16229 100644
>>>>>> --- a/src/mesa/main/context.c
>>>>>> +++ b/src/mesa/main/context.c
>>>>>> @@ -1525,10 +1525,6 @@ _mesa_copy_context( const struct gl_context
>>>>>> *src, struct gl_context *dst,
>>>>>>     * Check if the given context can render into the given 
>>>>>> framebuffer
>>>>>>     * by checking visual attributes.
>>>>>>     *
>>>>>> - * Most of these tests could go away because Mesa is now pretty
>>>>>> flexible
>>>>>> - * in terms of mixing rendering contexts with framebuffers.  As 
>>>>>> long
>>>>>> - * as RGB vs. CI mode agree, we're probably good.
>>>>>> - *
>>>>>>     * \return GL_TRUE if compatible, GL_FALSE otherwise.
>>>>>>     */
>>>>>>    static GLboolean
>>>>>> @@ -1541,32 +1537,18 @@ check_compatible(const struct gl_context 
>>>>>> *ctx,
>>>>>>       if (buffer == _mesa_get_incomplete_framebuffer())
>>>>>>          return GL_TRUE;
>>>>>>
>>>>>> -#if 0
>>>>>> -   /* disabling this fixes the fgl_glxgears pbuffer demo */
>>>>>> -   if (ctxvis->doubleBufferMode && !bufvis->doubleBufferMode)
>>>>>> -      return GL_FALSE;
>>>>>> -#endif
>>>>>> -   if (ctxvis->stereoMode && !bufvis->stereoMode)
>>>>>> -      return GL_FALSE;
>>>>>> -   if (ctxvis->haveAccumBuffer && !bufvis->haveAccumBuffer)
>>>>>> -      return GL_FALSE;
>>>>>> -   if (ctxvis->haveDepthBuffer && !bufvis->haveDepthBuffer)
>>>>>> -      return GL_FALSE;
>>>>>> -   if (ctxvis->haveStencilBuffer && !bufvis->haveStencilBuffer)
>>>>>> -      return GL_FALSE;
>>>>>> -   if (ctxvis->redMask && ctxvis->redMask != bufvis->redMask)
>>>>>> -      return GL_FALSE;
>>>>>> -   if (ctxvis->greenMask && ctxvis->greenMask != bufvis->greenMask)
>>>>>> -      return GL_FALSE;
>>>>>> -   if (ctxvis->blueMask && ctxvis->blueMask != bufvis->blueMask)
>>>>>> -      return GL_FALSE;
>>>>>> -#if 0
>>>>>> -   /* disabled (see bug 11161) */
>>>>>> -   if (ctxvis->depthBits && ctxvis->depthBits != bufvis->depthBits)
>>>>>> -      return GL_FALSE;
>>>>>> -#endif
>>>>>> -   if (ctxvis->stencilBits && ctxvis->stencilBits !=
>>>>>> bufvis->stencilBits)
>>>>>> -      return GL_FALSE;
>>>>>> +#define check_component(foo)           \
>>>>>> +   if (ctxvis->foo && bufvis->foo &&   \
>>>>>> +       ctxvis->foo != bufvis->foo)     \
>>>>>> +      return GL_FALSE
>>>>>> +
>>>>>> +   check_component(redMask);
>>>>>> +   check_component(greenMask);
>>>>>> +   check_component(blueMask);
>>>>>> +   check_component(depthBits);
>>>>>> +   check_component(stencilBits);
>>>>>> +
>>>>>> +#undef check_component
>>>>> IIRC, Ian had some comments on this so he should re-review.  But 
>>>>> since
>>>>> Mesa doesn't actually used the red/green/blueMask fields (AFAIK), I'm
>>>>> not sure what those checks are good for.
>>>> Yes, my original intention was to remove this function entirely, 
>>>> but Ian
>>>> convinced me that GLX mandates at least these checks.
>>> I wonder if those checks could be moved into the GLX code.
>> Maybe?  That would mean that the checks would need to be replicated in
>> the GLX code and EGL code.  Let me poke around in that code a little,
>> and let me double check both the specs.
>>
>>> For Windows, the wglMakeCurrent docs say "The hdc parameter must refer
>>> to a drawing surface supported by OpenGL. It need not be the same hdc
>>> that was passed to wglCreateContext when hglrc was created, but it must
>>> be on the same device and have the same pixel format."  We check for
>>> that in our stw_make_current() in the WGL code.
>>>
>>> -Brian
>>>
>>> _______________________________________________
>>> mesa-dev mailing list
>>> mesa-dev at lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
> Hi, is there any news on this?
>
> MM

Hi,

I really don't want to divert attention away from the impending 11.2 
release, but I'm ready to post
the updated version of this series, except that I need a verdict on this 
patch. And maybe on 6/7 too.

MM


More information about the mesa-dev mailing list