radeonsi: prepare for driver-specific driconf options
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 29 Jun 2017 15:31:57 +0000 (17:31 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Wed, 2 Aug 2017 07:50:58 +0000 (09:50 +0200)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/Automake.inc
src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
src/gallium/auxiliary/target-helpers/drm_helper.h
src/gallium/auxiliary/target-helpers/drm_helper_public.h
src/gallium/drivers/radeonsi/Makefile.am
src/gallium/drivers/radeonsi/Makefile.sources
src/gallium/drivers/radeonsi/driinfo_radeonsi.h [new file with mode: 0644]
src/gallium/targets/pipe-loader/Makefile.am
src/gallium/targets/pipe-loader/pipe_radeonsi.c

index 48b5a440674bf355ed543488ac94530355c7d06f..3e21aa71b5ca10c8374a6b95fc462f71e7b9a8b5 100644 (file)
@@ -39,6 +39,8 @@ GALLIUM_TARGET_CFLAGS = \
        -I$(top_srcdir)/src/gallium/auxiliary \
        -I$(top_srcdir)/src/gallium/drivers \
        -I$(top_srcdir)/src/gallium/winsys \
+       -I$(top_builddir)/src/util/ \
+       -I$(top_builddir)/src/gallium/drivers/ \
        $(DEFINES) \
        $(PTHREAD_CFLAGS) \
        $(LIBDRM_CFLAGS) \
index d8d3878bcd580629cc3a590e095db9ced2e4bbc8..69a02838cc3bff36bd5d895341cb5de6d36f20b2 100644 (file)
@@ -88,7 +88,7 @@ static const struct drm_driver_descriptor driver_descriptors[] = {
     {
         .driver_name = "radeonsi",
         .create_screen = pipe_radeonsi_create_screen,
-        .configuration = pipe_default_configuration_query,
+        .configuration = pipe_radeonsi_configuration_query,
     },
     {
         .driver_name = "vmwgfx",
index a4fcde385f273c73bfc4b4ef02e70646d8395d70..95b4a27111cb96e01c0df71c5c8935d3e7f4d4d4 100644 (file)
@@ -5,6 +5,7 @@
 #include "target-helpers/inline_debug_helper.h"
 #include "target-helpers/drm_helper_public.h"
 #include "state_tracker/drm_driver.h"
+#include "util/xmlpool.h"
 
 static const struct drm_conf_ret throttle_ret = {
    .type = DRM_CONF_INT,
@@ -175,6 +176,24 @@ pipe_radeonsi_create_screen(int fd, const struct pipe_screen_config *config)
    return rw ? debug_screen_wrap(rw->screen) : NULL;
 }
 
+const struct drm_conf_ret *
+pipe_radeonsi_configuration_query(enum drm_conf conf)
+{
+   static const struct drm_conf_ret xml_options_ret = {
+      .type = DRM_CONF_POINTER,
+      .val.val_pointer =
+#include "radeonsi/si_driinfo.h"
+   };
+
+   switch (conf) {
+   case DRM_CONF_XML_OPTIONS:
+      return &xml_options_ret;
+   default:
+      break;
+   }
+   return pipe_default_configuration_query(conf);
+}
+
 #else
 
 struct pipe_screen *
@@ -184,6 +203,12 @@ pipe_radeonsi_create_screen(int fd, const struct pipe_screen_config *config)
    return NULL;
 }
 
+const struct drm_conf_ret *
+pipe_radeonsi_configuration_query(enum drm_conf conf)
+{
+   return NULL;
+}
+
 #endif
 
 #ifdef GALLIUM_VMWGFX
index c540d7c58a607c3dd69fbad21bf51f61ccc689d5..46819131bda75606b5cdbc2d98068d6f2253bc06 100644 (file)
@@ -24,6 +24,8 @@ pipe_r600_create_screen(int fd, const struct pipe_screen_config *config);
 
 struct pipe_screen *
 pipe_radeonsi_create_screen(int fd, const struct pipe_screen_config *config);
+const struct drm_conf_ret *
+pipe_radeonsi_configuration_query(enum drm_conf conf);
 
 struct pipe_screen *
 pipe_vmwgfx_create_screen(int fd, const struct pipe_screen_config *config);
index 1edbd0fd5dd3759303f612666ee93b4d6b6b2d99..a30077020145054fd6e6ccf751cb43ecd998e637 100644 (file)
@@ -34,3 +34,16 @@ AM_CFLAGS = \
 noinst_LTLIBRARIES = libradeonsi.la
 
 libradeonsi_la_SOURCES = $(C_SOURCES)
+
+GEN_DRIINFO_INPUTS = \
+       $(top_srcdir)/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h \
+       $(srcdir)/driinfo_radeonsi.h
+
+PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
+MERGE_DRIINFO = $(top_srcdir)/src/util/merge_driinfo.py
+
+si_driinfo.h: $(MERGE_DRIINFO) $(GEN_DRIINFO_INPUTS)
+       $(PYTHON_GEN) $(MERGE_DRIINFO) $(GEN_DRIINFO_INPUTS) > $@ || ($(RM) $@; false)
+
+BUILT_SOURCES = $(GENERATED_SOURCES)
+CLEANFILES = $(GENERATED_SOURCES)
index 1587d646215ca2db67cadd672314a6f9be9fd793..6dc6da04e3a0f75ec5f1da74a1f3f731c609fad1 100644 (file)
@@ -1,4 +1,8 @@
+GENERATED_SOURCES := \
+       si_driinfo.h
+
 C_SOURCES := \
+       $(GENERATED_SOURCES) \
        cik_sdma.c \
        si_blit.c \
        si_compute.c \
diff --git a/src/gallium/drivers/radeonsi/driinfo_radeonsi.h b/src/gallium/drivers/radeonsi/driinfo_radeonsi.h
new file mode 100644 (file)
index 0000000..a358f02
--- /dev/null
@@ -0,0 +1 @@
+// DriConf options specific to radeonsi
index 6b116184f5b4861e22c31d844394912f3d45e178..400b198fe29ed4508905f4b073cdaba0ee1d1bcd 100644 (file)
@@ -27,6 +27,7 @@ AM_CPPFLAGS = \
        -I$(top_srcdir)/include \
        -I$(top_srcdir)/src/gallium/drivers \
        -I$(top_srcdir)/src/gallium/winsys \
+       -I$(top_builddir)/src/util \
        $(GALLIUM_PIPE_LOADER_DEFINES) \
        $(LIBDRM_CFLAGS) \
        $(VISIBILITY_CFLAGS) \
index 598baf58da34a634a7919072d83d96a12b8c4775..2d33d0e336cb59a2fb2e58bbec9942132f47f0f4 100644 (file)
@@ -4,6 +4,7 @@
 #include "radeon/radeon_winsys.h"
 #include "amdgpu/drm/amdgpu_public.h"
 #include "radeonsi/si_public.h"
+#include "util/xmlpool.h"
 
 static struct pipe_screen *
 create_screen(int fd, const struct pipe_screen_config *config)
@@ -31,11 +32,19 @@ static const struct drm_conf_ret share_fd_ret = {
 
 static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
 {
+   static const struct drm_conf_ret xml_options_ret = {
+      .type = DRM_CONF_POINTER,
+      .val.val_pointer =
+#include "radeonsi/si_driinfo.h"
+   };
+
    switch (conf) {
    case DRM_CONF_THROTTLE:
       return &throttle_ret;
    case DRM_CONF_SHARE_FD:
       return &share_fd_ret;
+   case DRM_CONF_XML_OPTIONS:
+      return &xml_options_ret;
    default:
       break;
    }