From faa52e328e3edf9b4596073eee3360aa29fd7252 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Thu, 18 Apr 2019 22:13:41 -0700 Subject: [PATCH] iris: Add mechanism for iris-specific driconf options Based on Nicolai's 0f8c5de8690e7c87aa2e24383065efaca7e6fe78. Reviewed-by: Dylan Baker --- .../auxiliary/pipe-loader/pipe_loader_drm.c | 2 +- .../auxiliary/target-helpers/drm_helper.h | 26 ++++++++++++++++++- .../target-helpers/drm_helper_public.h | 2 ++ src/gallium/drivers/iris/Android.mk | 18 +++++++++++++ src/gallium/drivers/iris/Makefile.sources | 5 ++++ src/gallium/drivers/iris/driinfo_iris.h | 1 + src/gallium/drivers/iris/iris_screen.c | 2 +- src/gallium/drivers/iris/iris_screen.h | 3 ++- src/gallium/drivers/iris/meson.build | 16 +++++++++++- src/gallium/winsys/iris/drm/iris_drm_public.h | 4 ++- src/gallium/winsys/iris/drm/iris_drm_winsys.c | 4 +-- 11 files changed, 75 insertions(+), 8 deletions(-) create mode 100644 src/gallium/drivers/iris/driinfo_iris.h diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c index a9028394d4d..7aa733d5f59 100644 --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c @@ -74,7 +74,7 @@ static const struct drm_driver_descriptor driver_descriptors[] = { { .driver_name = "iris", .create_screen = pipe_iris_create_screen, - .configuration = pipe_default_configuration_query, + .configuration = pipe_iris_configuration_query, }, { .driver_name = "nouveau", diff --git a/src/gallium/auxiliary/target-helpers/drm_helper.h b/src/gallium/auxiliary/target-helpers/drm_helper.h index 3280312729e..b98e17c3d9a 100644 --- a/src/gallium/auxiliary/target-helpers/drm_helper.h +++ b/src/gallium/auxiliary/target-helpers/drm_helper.h @@ -68,10 +68,28 @@ pipe_iris_create_screen(int fd, const struct pipe_screen_config *config) { struct pipe_screen *screen; - screen = iris_drm_screen_create(fd); + screen = iris_drm_screen_create(fd, config); return screen ? debug_screen_wrap(screen) : NULL; } +const struct drm_conf_ret * +pipe_iris_configuration_query(enum drm_conf conf) +{ + static const struct drm_conf_ret xml_options_ret = { + .type = DRM_CONF_POINTER, + .val.val_pointer = +#include "iris/iris_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 * @@ -81,6 +99,12 @@ pipe_iris_create_screen(int fd, const struct pipe_screen_config *config) return NULL; } +const struct drm_conf_ret * +pipe_iris_configuration_query(enum drm_conf conf) +{ + return NULL; +} + #endif #ifdef GALLIUM_NOUVEAU diff --git a/src/gallium/auxiliary/target-helpers/drm_helper_public.h b/src/gallium/auxiliary/target-helpers/drm_helper_public.h index 2cf05eb4577..4b34d274926 100644 --- a/src/gallium/auxiliary/target-helpers/drm_helper_public.h +++ b/src/gallium/auxiliary/target-helpers/drm_helper_public.h @@ -12,6 +12,8 @@ pipe_i915_create_screen(int fd, const struct pipe_screen_config *config); struct pipe_screen * pipe_iris_create_screen(int fd, const struct pipe_screen_config *config); +const struct drm_conf_ret * +pipe_iris_configuration_query(enum drm_conf conf); struct pipe_screen * pipe_nouveau_create_screen(int fd, const struct pipe_screen_config *config); diff --git a/src/gallium/drivers/iris/Android.mk b/src/gallium/drivers/iris/Android.mk index ba59eb566bb..f80f34f4b77 100644 --- a/src/gallium/drivers/iris/Android.mk +++ b/src/gallium/drivers/iris/Android.mk @@ -125,6 +125,24 @@ include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := libmesa_pipe_iris +LOCAL_MODULE_CLASS := STATIC_LIBRARIES + +intermediates := $(call local-generated-sources-dir) + +LOCAL_GENERATED_SOURCES := $(addprefix $(intermediates)/iris/,$(GENERATED_SOURCES)) + +GEN_DRIINFO_INPUTS := \ + $(MESA_TOP)/src/gallium/auxiliary/pipe-loader/driinfo_gallium.h \ + $(LOCAL_PATH)/driinfo_iris.h + +MERGE_DRIINFO := $(MESA_TOP)/src/util/merge_driinfo.py + +$(intermediates)/iris/si_driinfo.h: $(MERGE_DRIINFO) $(GEN_DRIINFO_INPUTS) + @mkdir -p $(dir $@) + @echo "Gen Header: $(PRIVATE_MODULE) <= $(notdir $(@))" + $(hide) $(MESA_PYTHON2) $(MERGE_DRIINFO) $(GEN_DRIINFO_INPUTS) > $@ || ($(RM) $@; false) + +LOCAL_EXPORT_C_INCLUDE_DIRS := $(intermediates) LOCAL_SRC_FILES := \ $(IRIS_C_SOURCES) diff --git a/src/gallium/drivers/iris/Makefile.sources b/src/gallium/drivers/iris/Makefile.sources index 7ea5896e976..6876935b99f 100644 --- a/src/gallium/drivers/iris/Makefile.sources +++ b/src/gallium/drivers/iris/Makefile.sources @@ -20,7 +20,12 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. +GENERATED_SOURCES := \ + iris_driinfo.h + IRIS_C_SOURCES = \ + $(GENERATED_SOURCES) \ + driinfo_iris.h \ iris_batch.c \ iris_batch.h \ iris_binder.c \ diff --git a/src/gallium/drivers/iris/driinfo_iris.h b/src/gallium/drivers/iris/driinfo_iris.h new file mode 100644 index 00000000000..0d513bc0468 --- /dev/null +++ b/src/gallium/drivers/iris/driinfo_iris.h @@ -0,0 +1 @@ +// iris specific driconf options diff --git a/src/gallium/drivers/iris/iris_screen.c b/src/gallium/drivers/iris/iris_screen.c index 6dff3a47b65..3e1cabafb70 100644 --- a/src/gallium/drivers/iris/iris_screen.c +++ b/src/gallium/drivers/iris/iris_screen.c @@ -552,7 +552,7 @@ iris_shader_perf_log(void *data, const char *fmt, ...) } struct pipe_screen * -iris_screen_create(int fd) +iris_screen_create(int fd, const struct pipe_screen_config *config) { struct iris_screen *screen = rzalloc(NULL, struct iris_screen); if (!screen) diff --git a/src/gallium/drivers/iris/iris_screen.h b/src/gallium/drivers/iris/iris_screen.h index 475975747c3..8a75374429f 100644 --- a/src/gallium/drivers/iris/iris_screen.h +++ b/src/gallium/drivers/iris/iris_screen.h @@ -74,7 +74,8 @@ struct iris_screen { struct iris_bo *workaround_bo; }; -struct pipe_screen *iris_screen_create(int fd); +struct pipe_screen * +iris_screen_create(int fd, const struct pipe_screen_config *config); boolean iris_is_format_supported(struct pipe_screen *pscreen, diff --git a/src/gallium/drivers/iris/meson.build b/src/gallium/drivers/iris/meson.build index 30c317fe481..673b2170e1a 100644 --- a/src/gallium/drivers/iris/meson.build +++ b/src/gallium/drivers/iris/meson.build @@ -19,6 +19,7 @@ # SOFTWARE. files_libiris = files( + 'driinfo_iris.h', 'iris_batch.c', 'iris_batch.h', 'iris_binder.c', @@ -46,6 +47,17 @@ files_libiris = files( 'iris_screen.h', ) +iris_driinfo_h = custom_target( + 'iris_driinfo.h', + input : files( + '../../../util/merge_driinfo.py', + '../../auxiliary/pipe-loader/driinfo_gallium.h', 'driinfo_iris.h' + ), + output : 'iris_driinfo.h', + command : [prog_python, '@INPUT@'], + capture : true, +) + iris_gen_libs = [] foreach v : ['80', '90', '100', '110'] iris_gen_libs += static_library( @@ -62,7 +74,8 @@ endforeach libiris = static_library( 'iris', - [files_libiris, gen_xml_pack, nir_opcodes_h, nir_builder_opcodes_h], + [files_libiris, gen_xml_pack, nir_opcodes_h, nir_builder_opcodes_h, + iris_driinfo_h], include_directories : [ inc_src, inc_include, inc_gallium, inc_gallium_aux, inc_intel, inc_nir, inc_gallium_drivers, @@ -80,5 +93,6 @@ libiris = static_library( driver_iris = declare_dependency( compile_args : '-DGALLIUM_IRIS', + sources : iris_driinfo_h, link_with : [libiris, libiriswinsys], ) diff --git a/src/gallium/winsys/iris/drm/iris_drm_public.h b/src/gallium/winsys/iris/drm/iris_drm_public.h index 17c0b2e1a8f..f942e05ad8b 100644 --- a/src/gallium/winsys/iris/drm/iris_drm_public.h +++ b/src/gallium/winsys/iris/drm/iris_drm_public.h @@ -25,7 +25,9 @@ #define IRIS_DRM_PUBLIC_H struct pipe_screen; +struct pipe_screen_config; -struct pipe_screen *iris_drm_screen_create(int drm_fd); +struct pipe_screen * +iris_drm_screen_create(int drm_fd, const struct pipe_screen_config *config); #endif /* IRIS_DRM_PUBLIC_H */ diff --git a/src/gallium/winsys/iris/drm/iris_drm_winsys.c b/src/gallium/winsys/iris/drm/iris_drm_winsys.c index 49c7c0f41e2..9903f40a843 100644 --- a/src/gallium/winsys/iris/drm/iris_drm_winsys.c +++ b/src/gallium/winsys/iris/drm/iris_drm_winsys.c @@ -28,7 +28,7 @@ #include "iris/iris_screen.h" struct pipe_screen * -iris_drm_screen_create(int fd) +iris_drm_screen_create(int fd, const struct pipe_screen_config *config) { - return iris_screen_create(fcntl(fd, F_DUPFD_CLOEXEC, 3)); + return iris_screen_create(fcntl(fd, F_DUPFD_CLOEXEC, 3), config); } -- 2.30.2