[Mesa-dev] [PATCH v4 2/2] glx: apple specific occurences of dummyContext check

Jeremy Huddleston Sequoia jeremyhu at apple.com
Sat Aug 13 10:41:18 UTC 2016


> On Aug 12, 2016, at 05:11, Tapani Pälli <tapani.palli at intel.com> wrote:
> 
> 
> 
> On 08/12/2016 01:31 PM, Jeremy Huddleston Sequoia wrote:
>> 
>>> On Aug 12, 2016, at 00:41, Tapani Pälli <tapani.palli at intel.com> wrote:
>>> 
>>> 
>>> On 07/18/2016 07:07 PM, Jeremy Huddleston Sequoia wrote:
>>>> Will do.  Thanks for pinging me.  Early June was very busy and I didn't see this come through.  I'll get back to you within a couple days.
>>> 
>>> a couple days passed, ping! :)
>> 
>> Sorry.
>> 
>> Go ahead and land it, and if there's fallout, I'll deal with it later.
> 
> r-b?

Yep, thanks.

Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>

> 
>> One suggestion that I have is to leave the check for gc != NULL in there to prevent a NULL deref if __glXGetCurrentContext() returns NULL (unless __glXGetCurrentContext() is also now annotated as __NonNull).
> 
> __glXGetCurrentContext() cannot return NULL, it'll always return dummyContext or actual real context, this was the original purpose of the patchset, there were cases where we checked for NULL but not dummyContext and never returned error because of this.
> 
> 
> 
>> --Jeremy
>> 
>>> 
>>>> --Jeremy
>>>> 
>>>>> On Jul 18, 2016, at 01:12, Tapani Pälli <tapani.palli at intel.com> wrote:
>>>>> 
>>>>> Jeremy, would you have time to test these changes? Patch 1 was already reviewed by Emil.
>>>>> 
>>>>> // Tapani
>>>>> 
>>>>> 
>>>>> On 06/07/2016 01:33 PM, Tapani Pälli wrote:
>>>>>> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
>>>>>> Cc: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
>>>>>> ---
>>>>>> src/glx/apple/apple_xgl_api_stereo.c   | 4 ++--
>>>>>> src/glx/apple/apple_xgl_api_viewport.c | 2 +-
>>>>>> src/glx/glxcmds.c                      | 2 +-
>>>>>> 3 files changed, 4 insertions(+), 4 deletions(-)
>>>>>> 
>>>>>> diff --git a/src/glx/apple/apple_xgl_api_stereo.c b/src/glx/apple/apple_xgl_api_stereo.c
>>>>>> index 4b21aaf..0d2f6fa 100644
>>>>>> --- a/src/glx/apple/apple_xgl_api_stereo.c
>>>>>> +++ b/src/glx/apple/apple_xgl_api_stereo.c
>>>>>> @@ -54,7 +54,7 @@ __applegl_glDrawBuffer(GLenum mode)
>>>>>> {
>>>>>>  struct glx_context * gc = __glXGetCurrentContext();
>>>>>> 
>>>>>> -   if (gc && apple_glx_context_uses_stereo(gc->driContext)) {
>>>>>> +   if (gc != &dummyContext && apple_glx_context_uses_stereo(gc->driContext)) {
>>>>>>     GLenum buf[2];
>>>>>>     GLsizei n = 0;
>>>>>> 
>>>>>> @@ -89,7 +89,7 @@ __applegl_glDrawBuffers(GLsizei n, const GLenum * bufs)
>>>>>> {
>>>>>>  struct glx_context * gc = __glXGetCurrentContext();
>>>>>> 
>>>>>> -   if (gc && apple_glx_context_uses_stereo(gc->driContext)) {
>>>>>> +   if (gc != &dummyContext && apple_glx_context_uses_stereo(gc->driContext)) {
>>>>>>     GLenum newbuf[n + 2];
>>>>>>     GLsizei i, outi = 0;
>>>>>>     bool have_back = false;
>>>>>> diff --git a/src/glx/apple/apple_xgl_api_viewport.c b/src/glx/apple/apple_xgl_api_viewport.c
>>>>>> index 281c90c..c40061d 100644
>>>>>> --- a/src/glx/apple/apple_xgl_api_viewport.c
>>>>>> +++ b/src/glx/apple/apple_xgl_api_viewport.c
>>>>>> @@ -41,7 +41,7 @@ __applegl_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
>>>>>>  struct glx_context *gc = __glXGetCurrentContext();
>>>>>>  Display *dpy = glXGetCurrentDisplay();
>>>>>> 
>>>>>> -   if (gc && gc->driContext)
>>>>>> +   if (gc != &dummyContext && gc->driContext)
>>>>>>     apple_glx_context_update(dpy, gc->driContext);
>>>>>> 
>>>>>>  __ogl_framework_api->Viewport(x, y, width, height);
>>>>>> diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
>>>>>> index 2420fef..5dce982 100644
>>>>>> --- a/src/glx/glxcmds.c
>>>>>> +++ b/src/glx/glxcmds.c
>>>>>> @@ -820,7 +820,7 @@ glXSwapBuffers(Display * dpy, GLXDrawable drawable)
>>>>>> {
>>>>>> #ifdef GLX_USE_APPLEGL
>>>>>>  struct glx_context * gc = __glXGetCurrentContext();
>>>>>> -   if(gc && apple_glx_is_current_drawable(dpy, gc->driContext, drawable)) {
>>>>>> +   if(gc != &DummyContext && apple_glx_is_current_drawable(dpy, gc->driContext, drawable)) {
>>>>>>     apple_glx_swap_buffers(gc->driContext);
>>>>>>  } else {
>>>>>>     __glXSendError(dpy, GLXBadCurrentWindow, 0, X_GLXSwapBuffers, false);
>>>>>> 
>>>> 
>> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4465 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160813/720c646c/attachment.bin>


More information about the mesa-dev mailing list