[Mesa-dev] [PATCH 1/2] intel: aubinator: generate a standalone binary
Ben Widawsky
ben at bwidawsk.net
Tue Oct 4 16:54:33 UTC 2016
On 16-10-04 09:50:55, Kenneth Graunke wrote:
>On Tuesday, October 4, 2016 9:26:39 AM PDT Ben Widawsky wrote:
>> On 16-10-04 15:38:52, Lionel Landwerlin wrote:
>> >Embed the xml files into the binary, so aubinator can be used from any
>> >location.
>> >
>> >Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
>> >Cc: Sirisha Gandikota <Sirisha.Gandikota at intel.com>
>> >---
>> > src/intel/Makefile.am | 1 +
>> > src/intel/Makefile.aubinator.am | 36 +++++++++++++++
>> > src/intel/Makefile.sources | 7 +++
>> > src/intel/tools/.gitignore | 5 +++
>> > src/intel/tools/aubinator.c | 97 +++++++++++++++++------------------------
>> > src/intel/tools/decoder.c | 82 ++++++++++++++++++++--------------
>> > src/intel/tools/decoder.h | 4 +-
>> > 7 files changed, 141 insertions(+), 91 deletions(-)
>> > create mode 100644 src/intel/Makefile.aubinator.am
>> >
>> >diff --git a/src/intel/Makefile.am b/src/intel/Makefile.am
>> >index 9186b5c..c3cb9fb 100644
>> >--- a/src/intel/Makefile.am
>> >+++ b/src/intel/Makefile.am
>> >@@ -52,6 +52,7 @@ BUILT_SOURCES =
>> > CLEANFILES =
>> > EXTRA_DIST =
>> >
>> >+include Makefile.aubinator.am
>> > include Makefile.blorp.am
>> > include Makefile.common.am
>> > include Makefile.genxml.am
>> >diff --git a/src/intel/Makefile.aubinator.am b/src/intel/Makefile.aubinator.am
>> >new file mode 100644
>> >index 0000000..9772700
>> >--- /dev/null
>> >+++ b/src/intel/Makefile.aubinator.am
>> >@@ -0,0 +1,36 @@
>> >+# Copyright © 2016 Intel Corporation
>> >+#
>> >+# 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.
>> >+
>> >+BUILT_SOURCES += $(AUBINATOR_GENERATED_FILES)
>> >+
>> >+SUFFIXES = _aubinator_xml.h .xml
>> >+
>> >+tools/gen6_aubinator_xml.h: genxml/gen6.xml
>> >+tools/gen7_aubinator_xml.h: genxml/gen7.xml
>> >+tools/gen75_aubinator_xml.h: genxml/gen75.xml
>> >+tools/gen8_aubinator_xml.h: genxml/gen8.xml
>> >+tools/gen9_aubinator_xml.h: genxml/gen9.xml
>> >+
>> >+$(AUBINATOR_GENERATED_FILES): Makefile
>> >+
>> >+%_aubinator_xml.h:
>> >+ $(MKDIR_GEN)
>> >+ $(AM_V_GEN) xxd -i $< > $@
>> >diff --git a/src/intel/Makefile.sources b/src/intel/Makefile.sources
>> >index 94073d2..a5c2bf0 100644
>> >--- a/src/intel/Makefile.sources
>> >+++ b/src/intel/Makefile.sources
>> >@@ -1,3 +1,10 @@
>> >+AUBINATOR_GENERATED_FILES = \
>> >+ tools/gen6_aubinator_xml.h \
>> >+ tools/gen7_aubinator_xml.h \
>> >+ tools/gen75_aubinator_xml.h \
>> >+ tools/gen8_aubinator_xml.h \
>> >+ tools/gen9_aubinator_xml.h
>> >+
>> > BLORP_FILES = \
>> > blorp/blorp.c \
>> > blorp/blorp.h \
>> >diff --git a/src/intel/tools/.gitignore b/src/intel/tools/.gitignore
>> >index 0c80a6f..c4eebde 100644
>> >--- a/src/intel/tools/.gitignore
>> >+++ b/src/intel/tools/.gitignore
>> >@@ -1 +1,6 @@
>> > /aubinator
>> >+gen6_aubinator_xml.h
>> >+gen75_aubinator_xml.h
>> >+gen7_aubinator_xml.h
>> >+gen8_aubinator_xml.h
>> >+gen9_aubinator_xml.h
>> >diff --git a/src/intel/tools/aubinator.c b/src/intel/tools/aubinator.c
>> >index a31dcb2..83328b5 100644
>> >--- a/src/intel/tools/aubinator.c
>> >+++ b/src/intel/tools/aubinator.c
>> >@@ -35,6 +35,8 @@
>> > #include <sys/wait.h>
>> > #include <sys/mman.h>
>> >
>> >+#include "util/macros.h"
>> >+
>> > #include "decoder.h"
>> > #include "intel_aub.h"
>> > #include "gen_disasm.h"
>> >@@ -1059,11 +1061,24 @@ int main(int argc, char *argv[])
>> > {
>> > struct gen_spec *spec;
>> > struct aub_file *file;
>> >- int i, pci_id = 0;
>> >+ int i;
>> > bool found_arg_gen = false, pager = true;
>> >- int gen_major, gen_minor;
>> >- const char *value;
>> >- char gen_file[256], gen_val[24];
>> >+ const char *value, *input_file = NULL;
>> >+ char gen_val[24];
>> >+ const struct {
>> >+ const char *name;
>> >+ int pci_id;
>> >+ } gens[] = {
>> >+ { "ivb", 0x0166 }, /* Intel(R) Ivybridge Mobile GT2 */
>> >+ { "hsw", 0x0416 }, /* Intel(R) Haswell Mobile GT2 */
>> >+ { "byt", 0x0155 }, /* Intel(R) Bay Trail */
>> >+ { "bdw", 0x1616 }, /* Intel(R) HD Graphics 5500 (Broadwell GT2) */
>> >+ { "chv", 0x22B3 }, /* Intel(R) HD Graphics (Cherryview) */
>> >+ { "skl", 0x1912 }, /* Intel(R) HD Graphics 530 (Skylake GT2) */
>> >+ { "kbl", 0x591D }, /* Intel(R) Kabylake GT2 */
>> >+ { "bxt", 0x0A84 } /* Intel(R) HD Graphics (Broxton) */
>> >+ }, *gen = NULL;
>> >+ struct gen_device_info devinfo;
>> >
>> > if (argc == 1) {
>> > print_help(argv[0], stderr);
>> >@@ -1081,8 +1096,6 @@ int main(int argc, char *argv[])
>> > exit(EXIT_FAILURE);
>> > }
>> > found_arg_gen = true;
>> >- gen_major = 0;
>> >- gen_minor = 0;
>> > snprintf(gen_val, sizeof(gen_val), "%s", value);
>> > } else if (strcmp(argv[i], "--headers") == 0) {
>> > option_full_decode = false;
>> >@@ -1105,6 +1118,7 @@ int main(int argc, char *argv[])
>> > fprintf(stderr, "unknown option %s\n", argv[i]);
>> > exit(EXIT_FAILURE);
>> > }
>> >+ input_file = argv[i];
>> > break;
>> > }
>> > }
>> >@@ -1114,52 +1128,26 @@ int main(int argc, char *argv[])
>> > exit(EXIT_FAILURE);
>> > }
>> >
>> >- if (strstr(gen_val, "ivb") != NULL) {
>> >- /* Intel(R) Ivybridge Mobile GT2 */
>> >- pci_id = 0x0166;
>> >- gen_major = 7;
>> >- gen_minor = 0;
>> >- } else if (strstr(gen_val, "hsw") != NULL) {
>> >- /* Intel(R) Haswell Mobile GT2 */
>> >- pci_id = 0x0416;
>> >- gen_major = 7;
>> >- gen_minor = 5;
>> >- } else if (strstr(gen_val, "byt") != NULL) {
>> >- /* Intel(R) Bay Trail */
>> >- pci_id = 0x0155;
>> >- gen_major = 7;
>> >- gen_minor = 5;
>> >- } else if (strstr(gen_val, "bdw") != NULL) {
>> >- /* Intel(R) HD Graphics 5500 (Broadwell GT2) */
>> >- pci_id = 0x1616;
>> >- gen_major = 8;
>> >- gen_minor = 0;
>> >- } else if (strstr(gen_val, "chv") != NULL) {
>> >- /* Intel(R) HD Graphics (Cherryview) */
>> >- pci_id = 0x22B3;
>> >- gen_major = 8;
>> >- gen_minor = 0;
>> >- } else if (strstr(gen_val, "skl") != NULL) {
>> >- /* Intel(R) HD Graphics 530 (Skylake GT2) */
>> >- pci_id = 0x1912;
>> >- gen_major = 9;
>> >- gen_minor = 0;
>> >- } else if (strstr(gen_val, "kbl") != NULL) {
>> >- /* Intel(R) Kabylake GT2 */
>> >- pci_id = 0x591D;
>> >- gen_major = 9;
>> >- gen_minor = 0;
>> >- } else if (strstr(gen_val, "bxt") != NULL) {
>> >- /* Intel(R) HD Graphics (Broxton) */
>> >- pci_id = 0x0A84;
>> >- gen_major = 9;
>> >- gen_minor = 0;
>> >- } else {
>> >+ for (i = 0; i < ARRAY_SIZE(gens); i++) {
>> >+ if (!strcmp(gen_val, gens[i].name)) {
>> >+ gen = &gens[i];
>> >+ break;
>> >+ }
>> >+ }
>> >+
>> >+ if (gen == NULL) {
>>
>> Since we're redoing this, I'm wondering if it makes sense to use "name" at all.
>> Maybe just the actual gen major/minor would be better? Just a thought.
>
>I believe Matt requested this because it occasionally matters. For
>example, Cherryview has different compaction tables than Broadwell.
>
>--Ken
We shouldn't be calling CHV GEN 8 though (nor should BXT be GEN 9). I don't care
much though...
More information about the mesa-dev
mailing list