Last bit to make the generated files directly usable in i915.

Cc: Mika Kuoppala <mika.kuopp...@intel.com>
Signed-off-by: Oscar Mateo <oscar.ma...@intel.com>
---
 tools/null_state_gen/intel_null_state_gen.c | 41 +++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/tools/null_state_gen/intel_null_state_gen.c 
b/tools/null_state_gen/intel_null_state_gen.c
index 7d5887e..06eb954 100644
--- a/tools/null_state_gen/intel_null_state_gen.c
+++ b/tools/null_state_gen/intel_null_state_gen.c
@@ -29,9 +29,12 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <assert.h>
+#include <time.h>
 
 #include "intel_renderstate.h"
 #include "intel_batchbuffer.h"
+#include "lib/version.h"
+#include "config.h"
 
 static int debug = 0;
 
@@ -42,6 +45,42 @@ static void print_usage(char *s)
                s);
 }
 
+static void print_copyright(void)
+{
+       time_t time_raw;
+       struct tm *time_local;
+       char year[6]; // avoid the year 10000 effect!
+
+       time(&time_raw);
+       time_local = localtime(&time_raw);
+       strftime(year, sizeof(year), "%Y", time_local);
+
+       printf("/*\n");
+       printf(" * Copyright © %s Intel Corporation\n", year);
+       printf(" *\n");
+       printf(" * Permission is hereby granted, free of charge, to any person 
obtaining a\n");
+       printf(" * copy of this software and associated documentation files 
(the \"Software\"),\n");
+       printf(" * to deal in the Software without restriction, including 
without limitation\n");
+       printf(" * the rights to use, copy, modify, merge, publish, distribute, 
sublicense,\n");
+       printf(" * and/or sell copies of the Software, and to permit persons to 
whom the\n");
+       printf(" * Software is furnished to do so, subject to the following 
conditions:\n");
+       printf(" *\n");
+       printf(" * The above copyright notice and this permission notice 
(including the next\n");
+       printf(" * paragraph) shall be included in all copies or substantial 
portions of the\n");
+       printf(" * Software.\n");
+       printf(" *\n");
+       printf(" * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY 
KIND, EXPRESS OR\n");
+       printf(" * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
MERCHANTABILITY,\n");
+       printf(" * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO 
EVENT SHALL\n");
+       printf(" * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
DAMAGES OR OTHER\n");
+       printf(" * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
OTHERWISE, ARISING\n");
+       printf(" * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 
OR OTHER\n");
+       printf(" * DEALINGS IN THE SOFTWARE.\n");
+       printf(" *\n");
+       printf(" * Generated by: intel-gpu-tools-%s-%s\n", PACKAGE_VERSION, 
IGT_GIT_SHA1);
+       printf(" */\n\n");
+}
+
 /* Creates the intel_renderstate_genX.c file for the particular
  * GEN product
  */
@@ -52,6 +91,8 @@ static int print_state(int gen, struct intel_batchbuffer 
*batch)
 
        fprintf(stderr, "Generating for gen%d\n", gen);
 
+       print_copyright();
+
        printf("#include \"intel_renderstate.h\"\n\n");
 
        /* Relocation offsets.  These are byte offsets in the golden context
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to