[PATCH 09/11] glx: Use one function to add a context to all global tables

2011-12-23 Thread Ian Romanick
From: Ian Romanick 

Instead of having separate __glXAddContextToList and AddResource
functions, just have one function that does both steps.

Signed-off-by: Ian Romanick 
---
 glx/glxcmds.c |9 +++--
 glx/glxext.c  |   10 +-
 glx/glxext.h  |2 +-
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 983f21a..0dce420 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -305,16 +305,13 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
 glxc->drawPriv = NULL;
 glxc->readPriv = NULL;
 
-/*
-** Register this context as a resource.
-*/
-if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
+/* Add the new context to the various global tables of GLX contexts.
+ */
+if (!__glXAddContext(glxc)) {
(*glxc->destroy)(glxc);
client->errorValue = gcId;
return BadAlloc;
 }
-
-__glXAddToContextList(glxc);
 
 return Success;
 }
diff --git a/glx/glxext.c b/glx/glxext.c
index f8fe43b..61eb35b 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -152,10 +152,18 @@ static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
 return True;
 }
 
-void __glXAddToContextList(__GLXcontext *cx)
+Bool __glXAddContext(__GLXcontext *cx)
 {
+/*
+** Register this context as a resource.
+*/
+if (!AddResource(cx->id, __glXContextRes, (pointer)cx)) {
+   return False;
+}
+
 cx->next = glxAllContexts;
 glxAllContexts = cx;
+return True;
 }
 
 static void __glXRemoveFromContextList(__GLXcontext *cx)
diff --git a/glx/glxext.h b/glx/glxext.h
index 58cf054..cb1707d 100644
--- a/glx/glxext.h
+++ b/glx/glxext.h
@@ -38,7 +38,7 @@
 extern GLboolean __glXFreeContext(__GLXcontext *glxc);
 extern void __glXFlushContextCache(void);
 
-extern void __glXAddToContextList(__GLXcontext *cx);
+extern Bool __glXAddContext(__GLXcontext *cx);
 extern void __glXErrorCallBack(GLenum code);
 extern void __glXClearErrorOccured(void);
 extern GLboolean __glXErrorOccured(void);
-- 
1.7.6.4

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH 09/11] glx: Use one function to add a context to all global tables

2012-04-13 Thread Ian Romanick
From: Ian Romanick 

Instead of having separate __glXAddContextToList and AddResource
functions, just have one function that does both steps.

Signed-off-by: Ian Romanick 
Reviewed-by: Jesse Barnes 
---
 glx/glxcmds.c |6 ++
 glx/glxext.c  |   11 +--
 glx/glxext.h  |2 +-
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 3d26317..ca06b46 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -310,15 +310,13 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
 glxc->drawPriv = NULL;
 glxc->readPriv = NULL;
 
-/* Register this context as a resource.
+/* Add the new context to the various global tables of GLX contexts.
  */
-if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
+if (!__glXAddContext(glxc)) {
 (*glxc->destroy) (glxc);
 client->errorValue = gcId;
 return BadAlloc;
 }
-
-__glXAddToContextList(glxc);
 
 return Success;
 }
diff --git a/glx/glxext.c b/glx/glxext.c
index 599f029..8d168d8 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -157,11 +157,18 @@ DrawableGone(__GLXdrawable * glxPriv, XID xid)
 return True;
 }
 
-void
-__glXAddToContextList(__GLXcontext * cx)
+Bool
+__glXAddContext(__GLXcontext * cx)
 {
+/* Register this context as a resource.
+ */
+if (!AddResource(cx->id, __glXContextRes, (pointer)cx)) {
+   return False;
+}
+
 cx->next = glxAllContexts;
 glxAllContexts = cx;
+return True;
 }
 
 static void
diff --git a/glx/glxext.h b/glx/glxext.h
index 7cd5cb4..9b0978b 100644
--- a/glx/glxext.h
+++ b/glx/glxext.h
@@ -38,7 +38,7 @@
 extern GLboolean __glXFreeContext(__GLXcontext * glxc);
 extern void __glXFlushContextCache(void);
 
-extern void __glXAddToContextList(__GLXcontext * cx);
+extern Bool __glXAddContext(__GLXcontext * cx);
 extern void __glXErrorCallBack(GLenum code);
 extern void __glXClearErrorOccured(void);
 extern GLboolean __glXErrorOccured(void);
-- 
1.7.6.5

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 09/11] glx: Use one function to add a context to all global tables

2012-01-03 Thread Jesse Barnes
On Fri, 23 Dec 2011 15:18:27 -0800
"Ian Romanick"  wrote:

> From: Ian Romanick 
> 
> Instead of having separate __glXAddContextToList and AddResource
> functions, just have one function that does both steps.
> 
> Signed-off-by: Ian Romanick 
> ---
>  glx/glxcmds.c |9 +++--
>  glx/glxext.c  |   10 +-
>  glx/glxext.h  |2 +-
>  3 files changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/glx/glxcmds.c b/glx/glxcmds.c
> index 983f21a..0dce420 100644
> --- a/glx/glxcmds.c
> +++ b/glx/glxcmds.c
> @@ -305,16 +305,13 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
>  glxc->drawPriv = NULL;
>  glxc->readPriv = NULL;
>  
> -/*
> -** Register this context as a resource.
> -*/
> -if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
> +/* Add the new context to the various global tables of GLX contexts.
> + */
> +if (!__glXAddContext(glxc)) {
>   (*glxc->destroy)(glxc);
>   client->errorValue = gcId;
>   return BadAlloc;
>  }
> -
> -__glXAddToContextList(glxc);
>  
>  return Success;
>  }
> diff --git a/glx/glxext.c b/glx/glxext.c
> index f8fe43b..61eb35b 100644
> --- a/glx/glxext.c
> +++ b/glx/glxext.c
> @@ -152,10 +152,18 @@ static Bool DrawableGone(__GLXdrawable *glxPriv, XID 
> xid)
>  return True;
>  }
>  
> -void __glXAddToContextList(__GLXcontext *cx)
> +Bool __glXAddContext(__GLXcontext *cx)
>  {
> +/*
> +** Register this context as a resource.
> +*/
> +if (!AddResource(cx->id, __glXContextRes, (pointer)cx)) {
> + return False;
> +}
> +
>  cx->next = glxAllContexts;
>  glxAllContexts = cx;
> +return True;
>  }
>  
>  static void __glXRemoveFromContextList(__GLXcontext *cx)
> diff --git a/glx/glxext.h b/glx/glxext.h
> index 58cf054..cb1707d 100644
> --- a/glx/glxext.h
> +++ b/glx/glxext.h
> @@ -38,7 +38,7 @@
>  extern GLboolean __glXFreeContext(__GLXcontext *glxc);
>  extern void __glXFlushContextCache(void);
>  
> -extern void __glXAddToContextList(__GLXcontext *cx);
> +extern Bool __glXAddContext(__GLXcontext *cx);
>  extern void __glXErrorCallBack(GLenum code);
>  extern void __glXClearErrorOccured(void);
>  extern GLboolean __glXErrorOccured(void);

Seems ok, but should you update the corresponding DMX code too?

-- 
Jesse Barnes, Intel Open Source Technology Center
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 09/11] glx: Use one function to add a context to all global tables

2012-01-03 Thread Ian Romanick

On 01/03/2012 04:28 PM, Jesse Barnes wrote:

On Fri, 23 Dec 2011 15:18:27 -0800
"Ian Romanick"  wrote:


From: Ian Romanick

Instead of having separate __glXAddContextToList and AddResource
functions, just have one function that does both steps.

Signed-off-by: Ian Romanick
---
  glx/glxcmds.c |9 +++--
  glx/glxext.c  |   10 +-
  glx/glxext.h  |2 +-
  3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 983f21a..0dce420 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -305,16 +305,13 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId,
  glxc->drawPriv = NULL;
  glxc->readPriv = NULL;

-/*
-** Register this context as a resource.
-*/
-if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
+/* Add the new context to the various global tables of GLX contexts.
+ */
+if (!__glXAddContext(glxc)) {
(*glxc->destroy)(glxc);
client->errorValue = gcId;
return BadAlloc;
  }
-
-__glXAddToContextList(glxc);

  return Success;
  }
diff --git a/glx/glxext.c b/glx/glxext.c
index f8fe43b..61eb35b 100644
--- a/glx/glxext.c
+++ b/glx/glxext.c
@@ -152,10 +152,18 @@ static Bool DrawableGone(__GLXdrawable *glxPriv, XID xid)
  return True;
  }

-void __glXAddToContextList(__GLXcontext *cx)
+Bool __glXAddContext(__GLXcontext *cx)
  {
+/*
+** Register this context as a resource.
+*/
+if (!AddResource(cx->id, __glXContextRes, (pointer)cx)) {
+   return False;
+}
+
  cx->next = glxAllContexts;
  glxAllContexts = cx;
+return True;
  }

  static void __glXRemoveFromContextList(__GLXcontext *cx)
diff --git a/glx/glxext.h b/glx/glxext.h
index 58cf054..cb1707d 100644
--- a/glx/glxext.h
+++ b/glx/glxext.h
@@ -38,7 +38,7 @@
  extern GLboolean __glXFreeContext(__GLXcontext *glxc);
  extern void __glXFlushContextCache(void);

-extern void __glXAddToContextList(__GLXcontext *cx);
+extern Bool __glXAddContext(__GLXcontext *cx);
  extern void __glXErrorCallBack(GLenum code);
  extern void __glXClearErrorOccured(void);
  extern GLboolean __glXErrorOccured(void);


Seems ok, but should you update the corresponding DMX code too?


I don't think so.  glxproxy never used __glXAddToContextList, and, as 
far as I can tell, it has it's own __glXContextRes (in global.c).  I 
don't think there should be any interactions here.


___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH 09/11] glx: Use one function to add a context to all global tables

2012-01-04 Thread Jesse Barnes
On Tue, 03 Jan 2012 17:00:32 -0800
Ian Romanick  wrote:

> On 01/03/2012 04:28 PM, Jesse Barnes wrote:
> > On Fri, 23 Dec 2011 15:18:27 -0800
> > "Ian Romanick"  wrote:
> >
> >> From: Ian Romanick
> >>
> >> Instead of having separate __glXAddContextToList and AddResource
> >> functions, just have one function that does both steps.
> >>
> >> Signed-off-by: Ian Romanick
> >> ---
> >>   glx/glxcmds.c |9 +++--
> >>   glx/glxext.c  |   10 +-
> >>   glx/glxext.h  |2 +-
> >>   3 files changed, 13 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/glx/glxcmds.c b/glx/glxcmds.c
> >> index 983f21a..0dce420 100644
> >> --- a/glx/glxcmds.c
> >> +++ b/glx/glxcmds.c
> >> @@ -305,16 +305,13 @@ DoCreateContext(__GLXclientState *cl, GLXContextID 
> >> gcId,
> >>   glxc->drawPriv = NULL;
> >>   glxc->readPriv = NULL;
> >>
> >> -/*
> >> -** Register this context as a resource.
> >> -*/
> >> -if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) {
> >> +/* Add the new context to the various global tables of GLX contexts.
> >> + */
> >> +if (!__glXAddContext(glxc)) {
> >>(*glxc->destroy)(glxc);
> >>client->errorValue = gcId;
> >>return BadAlloc;
> >>   }
> >> -
> >> -__glXAddToContextList(glxc);
> >>
> >>   return Success;
> >>   }
> >> diff --git a/glx/glxext.c b/glx/glxext.c
> >> index f8fe43b..61eb35b 100644
> >> --- a/glx/glxext.c
> >> +++ b/glx/glxext.c
> >> @@ -152,10 +152,18 @@ static Bool DrawableGone(__GLXdrawable *glxPriv, XID 
> >> xid)
> >>   return True;
> >>   }
> >>
> >> -void __glXAddToContextList(__GLXcontext *cx)
> >> +Bool __glXAddContext(__GLXcontext *cx)
> >>   {
> >> +/*
> >> +** Register this context as a resource.
> >> +*/
> >> +if (!AddResource(cx->id, __glXContextRes, (pointer)cx)) {
> >> +  return False;
> >> +}
> >> +
> >>   cx->next = glxAllContexts;
> >>   glxAllContexts = cx;
> >> +return True;
> >>   }
> >>
> >>   static void __glXRemoveFromContextList(__GLXcontext *cx)
> >> diff --git a/glx/glxext.h b/glx/glxext.h
> >> index 58cf054..cb1707d 100644
> >> --- a/glx/glxext.h
> >> +++ b/glx/glxext.h
> >> @@ -38,7 +38,7 @@
> >>   extern GLboolean __glXFreeContext(__GLXcontext *glxc);
> >>   extern void __glXFlushContextCache(void);
> >>
> >> -extern void __glXAddToContextList(__GLXcontext *cx);
> >> +extern Bool __glXAddContext(__GLXcontext *cx);
> >>   extern void __glXErrorCallBack(GLenum code);
> >>   extern void __glXClearErrorOccured(void);
> >>   extern GLboolean __glXErrorOccured(void);
> >
> > Seems ok, but should you update the corresponding DMX code too?
> 
> I don't think so.  glxproxy never used __glXAddToContextList, and, as 
> far as I can tell, it has it's own __glXContextRes (in global.c).  I 
> don't think there should be any interactions here.

Ok I just saw the call to AddResource there using the __glXContextRes,
but if the semantics are different and you checked, this gets my:

Reviewed-by: Jesse Barnes 

Thanks,
-- 
Jesse Barnes, Intel Open Source Technology Center


signature.asc
Description: PGP signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel