glthread: declare marshal and unmarshal functions as non-static
authorMarek Olšák <marek.olsak@amd.com>
Thu, 5 Mar 2020 21:21:00 +0000 (16:21 -0500)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 24 Mar 2020 20:28:30 +0000 (16:28 -0400)
Declare them in the header file. Then we can split marshal_generated.c
into multiple files.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4270>

src/mapi/glapi/gen/gl_marshal.py
src/mapi/glapi/gen/gl_marshal_h.py

index 9f19c914300103cc6d349d6f95550d42948fe0e4..d2704e43db20f7027d37df80871ed68f8c7f03f9 100644 (file)
@@ -94,7 +94,7 @@ class PrintCode(gl_XML.gl_print_base):
 
     def print_sync_body(self, func):
         out('/* {0}: marshalled synchronously */'.format(func.name))
 
     def print_sync_body(self, func):
         out('/* {0}: marshalled synchronously */'.format(func.name))
-        out('static {0} GLAPIENTRY'.format(func.return_type))
+        out('{0} GLAPIENTRY'.format(func.return_type))
         out('_mesa_marshal_{0}({1})'.format(func.name, func.get_parameter_string()))
         out('{')
         with indent():
         out('_mesa_marshal_{0}({1})'.format(func.name, func.get_parameter_string()))
         out('{')
         with indent():
@@ -172,7 +172,7 @@ class PrintCode(gl_XML.gl_print_base):
         out('};')
 
     def print_async_unmarshal(self, func):
         out('};')
 
     def print_async_unmarshal(self, func):
-        out('static void')
+        out('void')
         out(('_mesa_unmarshal_{0}(struct gl_context *ctx, '
              'const struct marshal_cmd_{0} *cmd)').format(func.name))
         out('{')
         out(('_mesa_unmarshal_{0}(struct gl_context *ctx, '
              'const struct marshal_cmd_{0} *cmd)').format(func.name))
         out('{')
@@ -240,7 +240,7 @@ class PrintCode(gl_XML.gl_print_base):
         out('}')
 
     def print_async_marshal(self, func):
         out('}')
 
     def print_async_marshal(self, func):
-        out('static void GLAPIENTRY')
+        out('void GLAPIENTRY')
         out('_mesa_marshal_{0}({1})'.format(
                 func.name, func.get_parameter_string()))
         out('{')
         out('_mesa_marshal_{0}({1})'.format(
                 func.name, func.get_parameter_string()))
         out('{')
index 8a23b146e0e7a80a3d77a76b42492db647825e88..6372e4a5602f2f97e8042a71f55ad032d573025a 100644 (file)
@@ -30,12 +30,12 @@ import sys
 
 
 header = """
 
 
 header = """
-#ifndef MARSHAL_GENERATABLE_H
-#define MARSHAL_GENERATABLE_H
+#ifndef MARSHAL_GENERATED_H
+#define MARSHAL_GENERATED_H
 """
 
 footer = """
 """
 
 footer = """
-#endif /* MARSHAL_GENERATABLE_H */
+#endif /* MARSHAL_GENERATED_H */
 """
 
 
 """
 
 
@@ -54,6 +54,8 @@ class PrintCode(gl_XML.gl_print_base):
         print(footer)
 
     def printBody(self, api):
         print(footer)
 
     def printBody(self, api):
+        print('#include "GL/gl.h"')
+        print('')
         print('enum marshal_dispatch_cmd_id')
         print('{')
         for func in api.functionIterateAll():
         print('enum marshal_dispatch_cmd_id')
         print('{')
         for func in api.functionIterateAll():
@@ -67,11 +69,13 @@ class PrintCode(gl_XML.gl_print_base):
 
         for func in api.functionIterateAll():
             flavor = func.marshal_flavor()
 
         for func in api.functionIterateAll():
             flavor = func.marshal_flavor()
-            if flavor == 'custom':
+            if flavor in ('custom', 'async'):
                 print('struct marshal_cmd_{0};'.format(func.name))
                 print(('void _mesa_unmarshal_{0}(struct gl_context *ctx, '
                        'const struct marshal_cmd_{0} *cmd);').format(func.name))
                 print('void GLAPIENTRY _mesa_marshal_{0}({1});'.format(func.name, func.get_parameter_string()))
                 print('struct marshal_cmd_{0};'.format(func.name))
                 print(('void _mesa_unmarshal_{0}(struct gl_context *ctx, '
                        'const struct marshal_cmd_{0} *cmd);').format(func.name))
                 print('void GLAPIENTRY _mesa_marshal_{0}({1});'.format(func.name, func.get_parameter_string()))
+            elif flavor == 'sync':
+                print('{0} GLAPIENTRY _mesa_marshal_{1}({2});'.format(func.return_type, func.name, func.get_parameter_string()))
 
 
 def show_usage():
 
 
 def show_usage():