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

Emil Velikov emil.l.velikov at gmail.com
Fri Feb 10 17:15:59 UTC 2017


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 ?

-Emil


More information about the mesa-dev mailing list