From 30eb1fdc51d96d443a755138acc425da9e949466 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Wed, 10 Apr 2019 13:54:14 +0200 Subject: [PATCH] gallium/virgl: Add code path for virgl to read driconf This works only for the drm variant of virgl and not for the vtest variant. v2: Rebase, replace the configuration query function by a pointer to the configuration data. Signed-off-by: Gert Wollny Reviewed-by: Emil Velikov (v1) Reviewed-by: Gurchetan Singh --- src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c | 1 + src/gallium/auxiliary/target-helpers/drm_helper.h | 8 +++++++- src/gallium/auxiliary/target-helpers/drm_helper_public.h | 1 + src/gallium/auxiliary/target-helpers/inline_sw_helper.h | 2 +- src/gallium/auxiliary/target-helpers/sw_helper.h | 2 +- src/gallium/drivers/virgl/virgl_public.h | 3 ++- src/gallium/drivers/virgl/virgl_screen.c | 2 +- src/gallium/winsys/virgl/drm/virgl_drm_public.h | 2 +- src/gallium/winsys/virgl/drm/virgl_drm_winsys.c | 4 ++-- 9 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c index 9d75a98..960d63b 100644 --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c @@ -107,6 +107,7 @@ static const struct drm_driver_descriptor driver_descriptors[] = { { .driver_name = "virtio_gpu", .create_screen = pipe_virgl_create_screen, + .driconf_xml = &virgl_driconf_xml, }, { .driver_name = "v3d", diff --git a/src/gallium/auxiliary/target-helpers/drm_helper.h b/src/gallium/auxiliary/target-helpers/drm_helper.h index 6bdd1a0..6c5902d 100644 --- a/src/gallium/auxiliary/target-helpers/drm_helper.h +++ b/src/gallium/auxiliary/target-helpers/drm_helper.h @@ -249,10 +249,14 @@ pipe_virgl_create_screen(int fd, const struct pipe_screen_config *config) { struct pipe_screen *screen; - screen = virgl_drm_screen_create(fd); + screen = virgl_drm_screen_create(fd, config); return screen ? debug_screen_wrap(screen) : NULL; } +const char *virgl_driconf_xml = + #include "virgl/virgl_driinfo.h" + ; + #else struct pipe_screen * @@ -262,6 +266,8 @@ pipe_virgl_create_screen(int fd, const struct pipe_screen_config *config) return NULL; } +const char *virgl_driconf_xml = NULL; + #endif #ifdef GALLIUM_VC4 diff --git a/src/gallium/auxiliary/target-helpers/drm_helper_public.h b/src/gallium/auxiliary/target-helpers/drm_helper_public.h index a3cb927..99018f0 100644 --- a/src/gallium/auxiliary/target-helpers/drm_helper_public.h +++ b/src/gallium/auxiliary/target-helpers/drm_helper_public.h @@ -7,6 +7,7 @@ struct pipe_screen_config; const char *iris_driconf_xml; const char *radeonsi_driconf_xml; const char *v3d_driconf_xml; +const char *virgl_driconf_xml; struct pipe_screen * pipe_i915_create_screen(int fd, const struct pipe_screen_config *config); diff --git a/src/gallium/auxiliary/target-helpers/inline_sw_helper.h b/src/gallium/auxiliary/target-helpers/inline_sw_helper.h index 5bb77a5..36146cf 100644 --- a/src/gallium/auxiliary/target-helpers/inline_sw_helper.h +++ b/src/gallium/auxiliary/target-helpers/inline_sw_helper.h @@ -41,7 +41,7 @@ sw_screen_create_named(struct sw_winsys *winsys, const char *driver) if (screen == NULL && strcmp(driver, "virpipe") == 0) { struct virgl_winsys *vws; vws = virgl_vtest_winsys_wrap(winsys); - screen = virgl_create_screen(vws); + screen = virgl_create_screen(vws, NULL); } #endif diff --git a/src/gallium/auxiliary/target-helpers/sw_helper.h b/src/gallium/auxiliary/target-helpers/sw_helper.h index 5e4e9f7..953412a 100644 --- a/src/gallium/auxiliary/target-helpers/sw_helper.h +++ b/src/gallium/auxiliary/target-helpers/sw_helper.h @@ -43,7 +43,7 @@ sw_screen_create_named(struct sw_winsys *winsys, const char *driver) if (screen == NULL && strcmp(driver, "virpipe") == 0) { struct virgl_winsys *vws; vws = virgl_vtest_winsys_wrap(winsys); - screen = virgl_create_screen(vws); + screen = virgl_create_screen(vws, NULL); } #endif diff --git a/src/gallium/drivers/virgl/virgl_public.h b/src/gallium/drivers/virgl/virgl_public.h index a3ea560..36bfb56 100644 --- a/src/gallium/drivers/virgl/virgl_public.h +++ b/src/gallium/drivers/virgl/virgl_public.h @@ -25,7 +25,8 @@ struct pipe_screen; struct virgl_winsys; +struct pipe_screen_config; struct pipe_screen * -virgl_create_screen(struct virgl_winsys *vws); +virgl_create_screen(struct virgl_winsys *vws, const struct pipe_screen_config *config); #endif diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c index 5d4374b..7d09ecc 100644 --- a/src/gallium/drivers/virgl/virgl_screen.c +++ b/src/gallium/drivers/virgl/virgl_screen.c @@ -822,7 +822,7 @@ fixup_readback_format(union virgl_caps *caps) } struct pipe_screen * -virgl_create_screen(struct virgl_winsys *vws) +virgl_create_screen(struct virgl_winsys *vws, const struct pipe_screen_config *config) { struct virgl_screen *screen = CALLOC_STRUCT(virgl_screen); diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_public.h b/src/gallium/winsys/virgl/drm/virgl_drm_public.h index f70f0e5..32df394 100644 --- a/src/gallium/winsys/virgl/drm/virgl_drm_public.h +++ b/src/gallium/winsys/virgl/drm/virgl_drm_public.h @@ -25,6 +25,6 @@ struct pipe_screen; -struct pipe_screen *virgl_drm_screen_create(int fd); +struct pipe_screen *virgl_drm_screen_create(int fd, const struct pipe_screen_config *config); #endif diff --git a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c index 41e4783..9eec92f 100644 --- a/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c +++ b/src/gallium/winsys/virgl/drm/virgl_drm_winsys.c @@ -1057,7 +1057,7 @@ static int compare_fd(void *key1, void *key2) } struct pipe_screen * -virgl_drm_screen_create(int fd) +virgl_drm_screen_create(int fd, const struct pipe_screen_config *config) { struct pipe_screen *pscreen = NULL; @@ -1081,7 +1081,7 @@ virgl_drm_screen_create(int fd) goto unlock; } - pscreen = virgl_create_screen(vws); + pscreen = virgl_create_screen(vws, config); if (pscreen) { util_hash_table_set(fd_tab, intptr_to_pointer(dup_fd), pscreen); -- 2.7.4