pipe-loader: remove config from pipe_loader_create_screen
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 3 Aug 2017 13:02:09 +0000 (15:02 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 4 Aug 2017 08:46:24 +0000 (10:46 +0200)
The config passed into the screen should be independent from the state
tracker, because at least in the case of radeonsi, the screen structure
can be shared between different state trackers.

Incidentally, this also fixes crashes that were recently introduced.

Fixes: a35a9e7c ("gallium: add driconf options to pipe_screen_config")
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
13 files changed:
src/gallium/auxiliary/pipe-loader/pipe_loader.c
src/gallium/auxiliary/pipe-loader/pipe_loader.h
src/gallium/auxiliary/vl/vl_winsys_dri.c
src/gallium/auxiliary/vl/vl_winsys_dri3.c
src/gallium/auxiliary/vl/vl_winsys_drm.c
src/gallium/state_trackers/clover/core/device.cpp
src/gallium/state_trackers/dri/dri2.c
src/gallium/state_trackers/dri/drisw.c
src/gallium/state_trackers/xa/xa_tracker.c
src/gallium/targets/d3dadapter9/drm.c
src/gallium/tests/trivial/compute.c
src/gallium/tests/trivial/quad-tex.c
src/gallium/tests/trivial/tri.c

index 6d9acebdb684abdf68b55453d219de704f7b4c6c..926db49fd24b92ae35d475319be4e2844b061922 100644 (file)
@@ -123,13 +123,14 @@ pipe_loader_get_driinfo_xml(const char *driver_name)
 }
 
 struct pipe_screen *
-pipe_loader_create_screen(struct pipe_loader_device *dev,
-                          struct pipe_screen_config *config)
+pipe_loader_create_screen(struct pipe_loader_device *dev)
 {
+   struct pipe_screen_config config;
+
    pipe_loader_load_options(dev);
-   config->options = &dev->option_cache;
+   config.options = &dev->option_cache;
 
-   return dev->ops->create_screen(dev, config);
+   return dev->ops->create_screen(dev, &config);
 }
 
 struct util_dl_library *
index b6e81cf39153b736977522cd3a2ad3ed1c6ff48b..b50114310b4a43e58658adf2e2633e4dda9e22f7 100644 (file)
@@ -86,12 +86,9 @@ pipe_loader_probe(struct pipe_loader_device **devs, int ndev);
  * Create a pipe_screen for the specified device.
  *
  * \param dev Device the screen will be created for.
- * \param config Configuration options. The lifetime of this structure and its
- *               elements may be limited to the duration of this call.
  */
 struct pipe_screen *
-pipe_loader_create_screen(struct pipe_loader_device *dev,
-                          struct pipe_screen_config *config);
+pipe_loader_create_screen(struct pipe_loader_device *dev);
 
 /**
  * Query the configuration parameters for the specified device.
index 7a0fc3c3bf29241d5830431f61359026d04a6254..b4fb47ea8e46243c8ac99f75e6227f1131596307 100644 (file)
@@ -406,7 +406,7 @@ vl_dri2_screen_create(Display *display, int screen)
       goto free_authenticate;
 
    if (pipe_loader_drm_probe_fd(&scrn->base.dev, fd))
-      scrn->base.pscreen = pipe_loader_create_screen(scrn->base.dev, NULL);
+      scrn->base.pscreen = pipe_loader_create_screen(scrn->base.dev);
 
    if (!scrn->base.pscreen)
       goto release_pipe;
index fbb729ae1764b1c1bf0652507afa792a7aa6768b..8251087f3f90c92656d7c2ab72c344259c1db7fb 100644 (file)
@@ -817,7 +817,7 @@ vl_dri3_screen_create(Display *display, int screen)
    free(geom_reply);
 
    if (pipe_loader_drm_probe_fd(&scrn->base.dev, fd))
-      scrn->base.pscreen = pipe_loader_create_screen(scrn->base.dev, NULL);
+      scrn->base.pscreen = pipe_loader_create_screen(scrn->base.dev);
 
    if (!scrn->base.pscreen)
       goto release_pipe;
index 07ce380ef559afe236491bbda43072a4cc7b5f03..df8809c501cb70de2883a7ccb5498a30e75b9cfb 100644 (file)
@@ -52,7 +52,7 @@ vl_drm_screen_create(int fd)
       goto free_screen;
 
    if (pipe_loader_drm_probe_fd(&vscreen->dev, new_fd))
-      vscreen->pscreen = pipe_loader_create_screen(vscreen->dev, NULL);
+      vscreen->pscreen = pipe_loader_create_screen(vscreen->dev);
 
    if (!vscreen->pscreen)
       goto release_pipe;
index bd07670f3843e9997b92d612358965e1ef75f3a3..8dfba1ad9fd9882b7c28d7cf021d519ffd34633b 100644 (file)
@@ -42,7 +42,7 @@ namespace {
 
 device::device(clover::platform &platform, pipe_loader_device *ldev) :
    platform(platform), ldev(ldev) {
-   pipe = pipe_loader_create_screen(ldev, NULL);
+   pipe = pipe_loader_create_screen(ldev);
    if (!pipe || !pipe->get_param(pipe, PIPE_CAP_COMPUTE)) {
       if (pipe)
          pipe->destroy(pipe);
index 0f36e1bf8943c6fb82e3fa8a12c918def18fcb16..3555107856c8dd813f475c22004e7e974c60d14f 100644 (file)
@@ -2071,11 +2071,9 @@ dri2_init_screen(__DRIscreen * sPriv)
 
 
    if (pipe_loader_drm_probe_fd(&screen->dev, fd)) {
-      struct pipe_screen_config config = {};
-
       dri_init_options(screen);
 
-      pscreen = pipe_loader_create_screen(screen->dev, &config);
+      pscreen = pipe_loader_create_screen(screen->dev);
    }
 
    if (!pscreen)
@@ -2166,12 +2164,10 @@ dri_kms_init_screen(__DRIscreen * sPriv)
    if (screen->fd < 0 || (fd = fcntl(screen->fd, F_DUPFD_CLOEXEC, 3)) < 0)
       goto free_screen;
 
-   struct pipe_screen_config config = {};
-
    dri_init_options(screen);
 
    if (pipe_loader_sw_probe_kms(&screen->dev, fd))
-      pscreen = pipe_loader_create_screen(screen->dev, &config);
+      pscreen = pipe_loader_create_screen(screen->dev);
 
    if (!pscreen)
        goto release_pipe;
index ad40e2f837ba43e1fd45b044c5b8d9a0ba51eaa0..46ec95c69069eb6e6a57261df33e967dcf3e0304 100644 (file)
@@ -401,10 +401,9 @@ drisw_init_screen(__DRIscreen * sPriv)
    sPriv->extensions = drisw_screen_extensions;
 
    if (pipe_loader_sw_probe_dri(&screen->dev, &drisw_lf)) {
-      struct pipe_screen_config config;
       dri_init_options(screen);
 
-      pscreen = pipe_loader_create_screen(screen->dev, &config);
+      pscreen = pipe_loader_create_screen(screen->dev);
    }
 
    if (!pscreen)
index d4114ab5591447578f1460a385b6fb814dbecf7e..03a3abf6835ad193bac997e2b99f0f9e75824c27 100644 (file)
@@ -162,7 +162,7 @@ xa_tracker_create(int drm_fd)
        goto out_no_fd;
 
     if (pipe_loader_drm_probe_fd(&xa->dev, fd))
-       xa->screen = pipe_loader_create_screen(xa->dev, NULL);
+       xa->screen = pipe_loader_create_screen(xa->dev);
 
     if (!xa->screen)
        goto out_no_screen;
index e6e71448a282a719332dba007746f5a41c42d206..9c5bd8a15b22471cd773a4fe4317a6f59bcba0d1 100644 (file)
@@ -229,7 +229,7 @@ drm_create_adapter( int fd,
         return D3DERR_DRIVERINTERNALERROR;
     }
 
-    ctx->base.hal = pipe_loader_create_screen(ctx->dev, NULL);
+    ctx->base.hal = pipe_loader_create_screen(ctx->dev);
     if (!ctx->base.hal) {
         ERR("Unable to load requested driver.\n");
         drm_destroy(&ctx->base);
@@ -312,7 +312,7 @@ drm_create_adapter( int fd,
 
     /* wrap it to create a software screen that can share resources */
     if (pipe_loader_sw_probe_wrapped(&ctx->swdev, ctx->base.hal))
-        ctx->base.ref = pipe_loader_create_screen(ctx->swdev, NULL);
+        ctx->base.ref = pipe_loader_create_screen(ctx->swdev);
 
     if (!ctx->base.ref) {
         ERR("Couldn't wrap drm screen to swrast screen. Software devices "
index 49fefd84b4bac41d7df007701c6dcf83967b8820..443451e13d2417a64df36e6b3a14df9075b62259 100644 (file)
@@ -76,7 +76,7 @@ static void init_ctx(struct context *ctx)
         ret = pipe_loader_probe(&ctx->dev, 1);
         assert(ret);
 
-        ctx->screen = pipe_loader_create_screen(ctx->dev, NULL);
+        ctx->screen = pipe_loader_create_screen(ctx->dev);
         assert(ctx->screen);
 
         ctx->pipe = ctx->screen->context_create(ctx->screen, NULL, 0);
index f6232d5dc3af50a7d7fec35afc2ee6d03bf7386d..2ee544a41294399f82ab0cd228aa936468652315 100644 (file)
@@ -96,7 +96,7 @@ static void init_prog(struct program *p)
        assert(ret);
 
        /* init a pipe screen */
-       p->screen = pipe_loader_create_screen(p->dev, NULL);
+       p->screen = pipe_loader_create_screen(p->dev);
        assert(p->screen);
 
        /* create the pipe driver context and cso context */
index b45a408d4252e544b127b893970ed2d579c21cac..a2031696f029a7dd5324bcae4bdfec37e3c88b2c 100644 (file)
@@ -91,7 +91,7 @@ static void init_prog(struct program *p)
        assert(ret);
 
        /* init a pipe screen */
-       p->screen = pipe_loader_create_screen(p->dev, NULL);
+       p->screen = pipe_loader_create_screen(p->dev);
        assert(p->screen);
 
        /* create the pipe driver context and cso context */