[Mesa-dev] [PATCH 27/28] swr: [rasterizer codegen] Fix generation of knobs

Tim Rowley timothy.o.rowley at intel.com
Thu Mar 16 00:13:21 UTC 2017


---
 src/gallium/drivers/swr/Makefile.am                | 10 ++--
 .../drivers/swr/rasterizer/codegen/gen_backends.py |  2 +
 .../drivers/swr/rasterizer/codegen/gen_knobs.py    |  2 +
 .../swr/rasterizer/codegen/gen_llvm_ir_macros.py   |  2 +
 .../codegen/templates/backend_template.cpp         | 61 ++++++++++++----------
 .../codegen/templates/gen_builder_template.hpp     |  3 ++
 .../{knobs.template => knobs_template.cpp}         |  5 +-
 7 files changed, 50 insertions(+), 35 deletions(-)
 rename src/gallium/drivers/swr/rasterizer/codegen/templates/{knobs.template => knobs_template.cpp} (98%)

diff --git a/src/gallium/drivers/swr/Makefile.am b/src/gallium/drivers/swr/Makefile.am
index f9fda31..771f1a8 100644
--- a/src/gallium/drivers/swr/Makefile.am
+++ b/src/gallium/drivers/swr/Makefile.am
@@ -71,19 +71,19 @@ swr_context_llvm.h: rasterizer/codegen/gen_llvm_types.py swr_context.h
 		--input $(srcdir)/swr_context.h \
 		--output swr_context_llvm.h
 
-rasterizer/codegen/gen_knobs.cpp: rasterizer/codegen/gen_knobs.py rasterizer/codegen/knob_defs.py rasterizer/codegen/templates/knobs.template
+rasterizer/codegen/gen_knobs.cpp: rasterizer/codegen/gen_knobs.py rasterizer/codegen/knob_defs.py rasterizer/codegen/templates/knobs_template.cpp
 	$(MKDIR_GEN)
 	$(PYTHON_GEN) \
 		$(srcdir)/rasterizer/codegen/gen_knobs.py \
-		--input $(srcdir)/rasterizer/codegen/templates/knobs.template \
+		--input $(srcdir)/rasterizer/codegen/templates/knobs_template.cpp \
 		--output rasterizer/codegen/gen_knobs.cpp \
 		--gen_cpp
 
-rasterizer/codegen/gen_knobs.h: rasterizer/codegen/gen_knobs.py rasterizer/codegen/knob_defs.py rasterizer/codegen/templates/knobs.template
+rasterizer/codegen/gen_knobs.h: rasterizer/codegen/gen_knobs.py rasterizer/codegen/knob_defs.py rasterizer/codegen/templates/knobs_template.cpp
 	$(MKDIR_GEN)
 	$(PYTHON_GEN) \
 		$(srcdir)/rasterizer/codegen/gen_knobs.py \
-		--input $(srcdir)/rasterizer/codegen/templates/knobs.template \
+		--input $(srcdir)/rasterizer/codegen/templates/knobs_template.cpp \
 		--output rasterizer/codegen/gen_knobs.h \
 		--gen_h
 
@@ -258,7 +258,7 @@ EXTRA_DIST = \
 	rasterizer/codegen/mako/runtime.py \
 	rasterizer/codegen/mako/template.py \
 	rasterizer/codegen/mako/util.py \
-	rasterizer/codegen/templates/knobs.template \
+	rasterizer/codegen/templates/knobs_template.cpp \
 	rasterizer/codegen/templates/ar_event_h.template \
 	rasterizer/codegen/templates/ar_event_cpp.template \
 	rasterizer/codegen/templates/ar_eventhandler_h.template \
diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_backends.py b/src/gallium/drivers/swr/rasterizer/codegen/gen_backends.py
index d6367ca..c889ea5 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/gen_backends.py
+++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_backends.py
@@ -103,6 +103,7 @@ def main(args=sys.argv[1:]):
             write_template_to_file(
                 templateCpp,
                 baseCppName % str(fileNum),
+                cmdline=sys.argv,
                 fileNum=fileNum,
                 funcList=chunkedList[fileNum])
 
@@ -114,6 +115,7 @@ def main(args=sys.argv[1:]):
         write_template_to_file(
             templateCmake,
             cmakeFile,
+            cmdline=sys.argv,
             numFiles=numFiles,
             baseCppName=baseCppName.replace('\\','/'))
 
diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_knobs.py b/src/gallium/drivers/swr/rasterizer/codegen/gen_knobs.py
index 225082e..50afdcd 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/gen_knobs.py
+++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_knobs.py
@@ -62,6 +62,7 @@ def main(args=sys.argv[1:]):
         if args.gen_h:
             write_template_to_file(args.input,
                                    args.output,
+                                   cmdline=sys.argv,
                                    filename='gen_knobs',
                                    knobs=knob_defs.KNOBS,
                                    includes=['core/knobs_init.h', 'common/os.h', 'sstream', 'iomanip'],
@@ -70,6 +71,7 @@ def main(args=sys.argv[1:]):
         if args.gen_cpp:
             write_template_to_file(args.input,
                                    args.output,
+                                   cmdline=sys.argv,
                                    filename='gen_knobs',
                                    knobs=knob_defs.KNOBS,
                                    includes=['core/knobs_init.h', 'common/os.h', 'sstream', 'iomanip'],
diff --git a/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py b/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py
index 202dada..cfd6394 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py
+++ b/src/gallium/drivers/swr/rasterizer/codegen/gen_llvm_ir_macros.py
@@ -218,6 +218,7 @@ def generate_gen_h(functions, output_dir):
     write_template_to_file(
         template,
         output_filename,
+        cmdline=sys.argv,
         comment='Builder IR Wrappers',
         filename=filename,
         functions=templfuncs,
@@ -244,6 +245,7 @@ def generate_x86_h(output_dir):
     write_template_to_file(
         template,
         output_filename,
+        cmdline=sys.argv,
         comment='x86 intrinsics',
         filename=filename,
         functions=functions,
diff --git a/src/gallium/drivers/swr/rasterizer/codegen/templates/backend_template.cpp b/src/gallium/drivers/swr/rasterizer/codegen/templates/backend_template.cpp
index c22a3ec..2b558cd 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/templates/backend_template.cpp
+++ b/src/gallium/drivers/swr/rasterizer/codegen/templates/backend_template.cpp
@@ -1,32 +1,35 @@
-/****************************************************************************
-* Copyright (C) 2017 Intel Corporation.   All Rights Reserved.
-*
-* Permission is hereby granted, free of charge, to any person obtaining a
-* copy of this software and associated documentation files (the "Software"),
-* to deal in the Software without restriction, including without limitation
-* the rights to use, copy, modify, merge, publish, distribute, sublicense,
-* and/or sell copies of the Software, and to permit persons to whom the
-* Software is furnished to do so, subject to the following conditions:
-*
-* The above copyright notice and this permission notice (including the next
-* paragraph) shall be included in all copies or substantial portions of the
-* Software.
-*
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-* IN THE SOFTWARE.
-* 
-* @file BackendPixelRate${fileNum}.cpp
-* 
-* @brief auto-generated file
-* 
-* DO NOT EDIT
-* 
-******************************************************************************/
+//============================================================================
+// Copyright (C) 2017 Intel Corporation.   All Rights Reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice (including the next
+// paragraph) shall be included in all copies or substantial portions of the
+// Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+// 
+// @file BackendPixelRate${fileNum}.cpp
+// 
+// @brief auto-generated file
+// 
+// DO NOT EDIT
+//
+// Generation Command Line:
+//  ${'\n//    '.join(cmdline)}
+//
+//============================================================================
 
 #include "core/backend.h"
 
diff --git a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder_template.hpp b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder_template.hpp
index 6a56eb1..2e95758 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder_template.hpp
+++ b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder_template.hpp
@@ -26,6 +26,9 @@
 //
 // DO NOT EDIT
 //
+// Generation Command Line:
+//  ${'\n//    '.join(cmdline)}
+//
 //============================================================================
 #pragma once
 
diff --git a/src/gallium/drivers/swr/rasterizer/codegen/templates/knobs.template b/src/gallium/drivers/swr/rasterizer/codegen/templates/knobs_template.cpp
similarity index 98%
rename from src/gallium/drivers/swr/rasterizer/codegen/templates/knobs.template
rename to src/gallium/drivers/swr/rasterizer/codegen/templates/knobs_template.cpp
index 1ae45e5..99294d2 100644
--- a/src/gallium/drivers/swr/rasterizer/codegen/templates/knobs.template
+++ b/src/gallium/drivers/swr/rasterizer/codegen/templates/knobs_template.cpp
@@ -24,7 +24,7 @@
 
 %>/******************************************************************************
 *
-* Copyright 2015-2016
+* Copyright 2015-2017
 * Intel Corporation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -49,6 +49,9 @@
 *
 * ======================= AUTO GENERATED: DO NOT EDIT !!! ====================
 *
+* Generation Command Line:
+*  ${'\n*    '.join(cmdline)}
+*
 ******************************************************************************/
 %if gen_header:
 #pragma once
-- 
2.7.4



More information about the mesa-dev mailing list