gallium/virgl: Add code path for virgl to read driconf
authorGert Wollny <gert.wollny@collabora.com>
Wed, 10 Apr 2019 11:54:14 +0000 (13:54 +0200)
committerGert Wollny <gert.wollny@collabora.com>
Thu, 20 Jun 2019 06:50:38 +0000 (08:50 +0200)
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 <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com> (v1)
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
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/auxiliary/target-helpers/inline_sw_helper.h
src/gallium/auxiliary/target-helpers/sw_helper.h
src/gallium/drivers/virgl/virgl_public.h
src/gallium/drivers/virgl/virgl_screen.c
src/gallium/winsys/virgl/drm/virgl_drm_public.h
src/gallium/winsys/virgl/drm/virgl_drm_winsys.c

index 9d75a9868e2f9eb1b3ea82946a1b48efe246f480..960d63b2c31fa0d6f4123dea685058df7b4ce3d8 100644 (file)
@@ -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",
index 6bdd1a008db0d22dd9b444c10a523b5944cb6571..6c5902d3c27982266a690841520d4db6f9aa9fd0 100644 (file)
@@ -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
index a3cb9279fd5cf6d502282aa4af625343a6e1b036..99018f0df88dcd48a3e127a754a0ea20b6b0d8e1 100644 (file)
@@ -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);
index 5bb77a5bde23f35348a4bb3ea66cc915bc05f8ee..36146cf1e37196c68366fbe1a429ce0388d862dd 100644 (file)
@@ -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
 
index 5e4e9f78af6f313294cbfd661f11076c1274bb19..953412a3ff5cc1ec6050d49ee9971321c0aea396 100644 (file)
@@ -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
 
index a3ea560df7b8528f3cca9240031cfeab6652fd92..36bfb56eb3da40fd195515898b823caf65622110 100644 (file)
@@ -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
index 5d4374bf3dd3bfb67b3d2727162fedb7403dccd8..7d09ecc1bd8afbff0b6796dc36d40a627cfbc0a0 100644 (file)
@@ -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);
 
index f70f0e50448f1035e1d75edfc7d1cb2199f585f0..32df3945ff41652f67eb2b38f1fd7eb6dfe8517e 100644 (file)
@@ -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
index 41e47837acfe4c70a7f40bcb438916127abd0056..9eec92f573632b7adf6f8e564213ac74543e58df 100644 (file)
@@ -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);