[Mesa-dev] [PATCH 14/26] mesa: Connect the generated GL command marshalling code to the build.

Marek Olšák maraeo at gmail.com
Sat Feb 11 10:24:07 UTC 2017


On Fri, Feb 10, 2017 at 7:04 PM, Steven Newbury <steve at snewbury.org.uk> wrote:
> On Fri, 2017-02-10 at 17:15 +0000, Emil Velikov wrote:
>> On 8 February 2017 at 18:03, Marek Olšák <maraeo at gmail.com> wrote:
>> > From: Eric Anholt <eric at anholt.net>
>> >
>> > v2: Rebase on the Begin/End changes, and just disable this feature
>> > on
>> >     non-GL-core.
>> > ---
>> >  src/mapi/glapi/gen/gl_marshal.py | 10 ++++++++++
>> >  src/mesa/Makefile.sources        |  2 ++
>> >  src/mesa/main/glthread.c         | 25 +++++++++++++++++++++++++
>> >  3 files changed, 37 insertions(+)
>> >
>> > diff --git a/src/mapi/glapi/gen/gl_marshal.py
>> > b/src/mapi/glapi/gen/gl_marshal.py
>> > index f8dfa00..e4137f4 100644
>> > --- a/src/mapi/glapi/gen/gl_marshal.py
>> > +++ b/src/mapi/glapi/gen/gl_marshal.py
>> > @@ -59,20 +59,30 @@ def indent(delta = 3):
>> >  class PrintCode(gl_XML.gl_print_base):
>> >      def __init__(self):
>> >          super(PrintCode, self).__init__()
>> >
>> >          self.name = 'gl_marshal.py'
>> >          self.license = license.bsd_license_template % (
>> >              'Copyright (C) 2012 Intel Corporation', 'INTEL
>> > CORPORATION')
>> >
>> >      def printRealHeader(self):
>> >          print header
>> > +        print '#include <X11/Xlib-xcb.h>'
>> > +        print
>> > +        print 'static _X_INLINE int safe_mul(int a, int b)'
>> > +        print '{'
>> > +        print '    if (a < 0 || b < 0) return -1;'
>> > +        print '    if (a == 0 || b == 0) return 0;'
>> > +        print '    if (a > INT_MAX / b) return -1;'
>> > +        print '    return a * b;'
>> > +        print '}'
>> > +        print
>> >
>>
>> Seemingly unrelated hunk ?
>>
>>
>> > --- a/src/mesa/main/glthread.c
>> > +++ b/src/mesa/main/glthread.c
>> > @@ -47,22 +47,30 @@ glthread_allocate_batch(struct gl_context *ctx)
>> >  static void
>> >  glthread_unmarshal_batch(struct gl_context *ctx, struct
>> > glthread_batch *batch)
>> >  {
>> > +   size_t pos = 0;
>> > +
>> >     _glapi_set_dispatch(ctx->CurrentServerDispatch);
>> >
>> > +   while (pos < batch->used) {
>> > +      pos += _mesa_unmarshal_dispatch_cmd(ctx, &batch-
>> > >buffer[pos]);
>> > +   }
>> > +
>>
>> Nit: drop the curly brackets.
>>
>>
>> >  void
>> >  _mesa_glthread_init(struct gl_context *ctx)
>> >  {
>> >     struct glthread_state *glthread = calloc(1, sizeof(*glthread));
>> >
>> >     if (!glthread)
>> >        return;
>> >
>> > +   /* The marshalling dispatch table isn't integrated with the
>> > Begin/End
>> > +    * dispatch table for desktop OpenGL, and the drawing functions
>> > are
>> > +    * synchronous to support user vertex arrays on everything but
>> > GL core
>> > +    * (even GLES 2/3) anyway, which means you'll end up with too
>> > much overhead
>> > +    * from threading.
>> > +    */
>> > +   if (ctx->API != API_OPENGL_CORE)
>> > +      return;
>>
>> Leaking glthread ?
>>
> This is odd, the version I have locally which I rebased from Marek's
> git repo frees glthread.
>
> Marek, what's happened here?  Are these patches different from the ones
> in your git repo?

No, they are the same. Maybe you fixed it locally?

Marek


More information about the mesa-dev mailing list