[Mesa-dev] [PATCH 07/16] gallium: add pipe_screen_config to screen_create functions

Nicolai Hähnle nhaehnle at gmail.com
Fri Jun 30 12:45:48 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

This allows a more generic mechanism for passing user configurations
into drivers by accessing the dri options directly.
---
 src/gallium/auxiliary/pipe-loader/pipe_loader.c    |  5 +-
 src/gallium/auxiliary/pipe-loader/pipe_loader.h    |  5 +-
 .../auxiliary/pipe-loader/pipe_loader_drm.c        |  5 +-
 .../auxiliary/pipe-loader/pipe_loader_priv.h       |  2 +-
 src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c |  2 +-
 src/gallium/auxiliary/target-helpers/drm_helper.h  | 56 +++++++++++-----------
 .../auxiliary/target-helpers/drm_helper_public.h   | 27 ++++++-----
 src/gallium/auxiliary/vl/vl_winsys_dri.c           |  2 +-
 src/gallium/auxiliary/vl/vl_winsys_dri3.c          |  2 +-
 src/gallium/auxiliary/vl/vl_winsys_drm.c           |  2 +-
 src/gallium/drivers/r300/r300_public.h             |  4 +-
 src/gallium/drivers/r300/r300_screen.c             |  3 +-
 src/gallium/drivers/r600/r600_pipe.c               |  5 +-
 src/gallium/drivers/r600/r600_public.h             |  4 +-
 src/gallium/drivers/radeonsi/si_pipe.c             |  4 +-
 src/gallium/drivers/radeonsi/si_public.h           |  2 +-
 src/gallium/include/pipe/p_screen.h                |  8 ++++
 src/gallium/include/state_tracker/drm_driver.h     |  4 +-
 src/gallium/state_trackers/clover/core/device.cpp  |  2 +-
 src/gallium/state_trackers/dri/dri2.c              | 12 +++--
 src/gallium/state_trackers/dri/drisw.c             |  6 ++-
 src/gallium/state_trackers/xa/xa_tracker.c         |  2 +-
 src/gallium/targets/d3dadapter9/drm.c              |  4 +-
 src/gallium/targets/pipe-loader/pipe_i915.c        |  2 +-
 src/gallium/targets/pipe-loader/pipe_msm.c         |  2 +-
 src/gallium/targets/pipe-loader/pipe_nouveau.c     |  2 +-
 src/gallium/targets/pipe-loader/pipe_r300.c        |  2 +-
 src/gallium/targets/pipe-loader/pipe_r600.c        |  2 +-
 src/gallium/targets/pipe-loader/pipe_radeonsi.c    |  2 +-
 src/gallium/targets/pipe-loader/pipe_vmwgfx.c      |  2 +-
 src/gallium/tests/trivial/compute.c                |  2 +-
 src/gallium/tests/trivial/quad-tex.c               |  2 +-
 src/gallium/tests/trivial/tri.c                    |  2 +-
 src/gallium/winsys/amdgpu/drm/amdgpu_public.h      |  5 +-
 src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c      |  4 +-
 src/gallium/winsys/radeon/drm/radeon_drm_public.h  |  5 +-
 src/gallium/winsys/radeon/drm/radeon_drm_winsys.c  |  4 +-
 37 files changed, 118 insertions(+), 88 deletions(-)

diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.c b/src/gallium/auxiliary/pipe-loader/pipe_loader.c
index 0857a2c..cd93648 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.c
@@ -67,23 +67,24 @@ pipe_loader_release(struct pipe_loader_device **devs, int ndev)
 }
 
 const struct drm_conf_ret *
 pipe_loader_configuration(struct pipe_loader_device *dev,
                           enum drm_conf conf)
 {
    return dev->ops->configuration(dev, conf);
 }
 
 struct pipe_screen *
-pipe_loader_create_screen(struct pipe_loader_device *dev, unsigned flags)
+pipe_loader_create_screen(struct pipe_loader_device *dev,
+                          struct pipe_screen_config *config)
 {
-   return dev->ops->create_screen(dev, flags);
+   return dev->ops->create_screen(dev, config);
 }
 
 struct util_dl_library *
 pipe_loader_find_module(struct pipe_loader_device *dev,
                         const char *library_paths)
 {
    struct util_dl_library *lib;
    const char *next;
    char path[PATH_MAX];
    int len, ret;
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.h b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
index 73b7558..969feac 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader.h
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
@@ -75,23 +75,26 @@ struct pipe_loader_device {
  * \param ndev Maximum number of devices to return.
  * \return Number of devices available in the system.
  */
 int
 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, unsigned flags);
+pipe_loader_create_screen(struct pipe_loader_device *dev,
+                          struct pipe_screen_config *config);
 
 /**
  * Query the configuration parameters for the specified device.
  *
  * \param dev Device that will be queried.
  * \param conf The drm_conf id of the option to be queried.
  */
 const struct drm_conf_ret *
 pipe_loader_configuration(struct pipe_loader_device *dev,
                           enum drm_conf conf);
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
index ef446b6..385d814 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
@@ -274,22 +274,23 @@ pipe_loader_drm_configuration(struct pipe_loader_device *dev,
 {
    struct pipe_loader_drm_device *ddev = pipe_loader_drm_device(dev);
 
    if (!ddev->dd->configuration)
       return NULL;
 
    return ddev->dd->configuration(conf);
 }
 
 static struct pipe_screen *
-pipe_loader_drm_create_screen(struct pipe_loader_device *dev, unsigned flags)
+pipe_loader_drm_create_screen(struct pipe_loader_device *dev,
+                              const struct pipe_screen_config *config)
 {
    struct pipe_loader_drm_device *ddev = pipe_loader_drm_device(dev);
 
-   return ddev->dd->create_screen(ddev->fd, flags);
+   return ddev->dd->create_screen(ddev->fd, config);
 }
 
 static const struct pipe_loader_ops pipe_loader_drm_ops = {
    .create_screen = pipe_loader_drm_create_screen,
    .configuration = pipe_loader_drm_configuration,
    .release = pipe_loader_drm_release
 };
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h b/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h
index 58ab992..7708455 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_priv.h
@@ -25,21 +25,21 @@
  *
  **************************************************************************/
 
 #ifndef PIPE_LOADER_PRIV_H
 #define PIPE_LOADER_PRIV_H
 
 #include "pipe_loader.h"
 
 struct pipe_loader_ops {
    struct pipe_screen *(*create_screen)(struct pipe_loader_device *dev,
-                                        unsigned flags);
+                                        const struct pipe_screen_config *config);
 
    const struct drm_conf_ret *(*configuration)(struct pipe_loader_device *dev,
                                                enum drm_conf conf);
 
    void (*release)(struct pipe_loader_device **dev);
 };
 
 /**
  * Open the pipe driver module that handles a specified device.
  */
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
index 46c6604..3c8e0c2 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c
@@ -288,21 +288,21 @@ pipe_loader_sw_release(struct pipe_loader_device **dev)
 
 static const struct drm_conf_ret *
 pipe_loader_sw_configuration(struct pipe_loader_device *dev,
                              enum drm_conf conf)
 {
    return NULL;
 }
 
 static struct pipe_screen *
 pipe_loader_sw_create_screen(struct pipe_loader_device *dev,
-                             unsigned flags)
+                             const struct pipe_screen_config *config)
 {
    struct pipe_loader_sw_device *sdev = pipe_loader_sw_device(dev);
    struct pipe_screen *screen;
 
    screen = sdev->dd->create_screen(sdev->ws);
    if (!screen)
       sdev->ws->destroy(sdev->ws);
 
    return screen;
 }
diff --git a/src/gallium/auxiliary/target-helpers/drm_helper.h b/src/gallium/auxiliary/target-helpers/drm_helper.h
index 0027ede..2a2f57d 100644
--- a/src/gallium/auxiliary/target-helpers/drm_helper.h
+++ b/src/gallium/auxiliary/target-helpers/drm_helper.h
@@ -3,308 +3,308 @@
 
 #include <stdio.h>
 #include "target-helpers/inline_debug_helper.h"
 #include "target-helpers/drm_helper_public.h"
 
 #ifdef GALLIUM_I915
 #include "i915/drm/i915_drm_public.h"
 #include "i915/i915_public.h"
 
 struct pipe_screen *
-pipe_i915_create_screen(int fd, unsigned flags)
+pipe_i915_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct i915_winsys *iws;
    struct pipe_screen *screen;
 
    iws = i915_drm_winsys_create(fd);
    if (!iws)
       return NULL;
 
    screen = i915_screen_create(iws);
    return screen ? debug_screen_wrap(screen) : NULL;
 }
 
 #else
 
 struct pipe_screen *
-pipe_i915_create_screen(int fd, unsigned flags)
+pipe_i915_create_screen(int fd, const struct pipe_screen_config *config)
 {
    fprintf(stderr, "i915g: driver missing\n");
    return NULL;
 }
 
 #endif
 
 #ifdef GALLIUM_NOUVEAU
 #include "nouveau/drm/nouveau_drm_public.h"
 
 struct pipe_screen *
-pipe_nouveau_create_screen(int fd, unsigned flags)
+pipe_nouveau_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
 
    screen = nouveau_drm_screen_create(fd);
    return screen ? debug_screen_wrap(screen) : NULL;
 }
 
 #else
 
 struct pipe_screen *
-pipe_nouveau_create_screen(int fd, unsigned flags)
+pipe_nouveau_create_screen(int fd, const struct pipe_screen_config *config)
 {
    fprintf(stderr, "nouveau: driver missing\n");
    return NULL;
 }
 
 #endif
 
 #ifdef GALLIUM_PL111
 #include "pl111/drm/pl111_drm_public.h"
 
 struct pipe_screen *
-pipe_pl111_create_screen(int fd, unsigned flags)
+pipe_pl111_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
 
    screen = pl111_drm_screen_create(fd);
    return screen ? debug_screen_wrap(screen) : NULL;
 }
 
 #else
 
 struct pipe_screen *
-pipe_pl111_create_screen(int fd, unsigned flags)
+pipe_pl111_create_screen(int fd, const struct pipe_screen_config *config)
 {
    fprintf(stderr, "pl111: driver missing\n");
    return NULL;
 }
 
 #endif
 
 #ifdef GALLIUM_R300
 #include "radeon/radeon_winsys.h"
 #include "radeon/drm/radeon_drm_public.h"
 #include "r300/r300_public.h"
 
 struct pipe_screen *
-pipe_r300_create_screen(int fd, unsigned flags)
+pipe_r300_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct radeon_winsys *rw;
 
-   rw = radeon_drm_winsys_create(fd, flags, r300_screen_create);
+   rw = radeon_drm_winsys_create(fd, config, r300_screen_create);
    return rw ? debug_screen_wrap(rw->screen) : NULL;
 }
 
 #else
 
 struct pipe_screen *
-pipe_r300_create_screen(int fd, unsigned flags)
+pipe_r300_create_screen(int fd, const struct pipe_screen_config *config)
 {
    fprintf(stderr, "r300: driver missing\n");
    return NULL;
 }
 
 #endif
 
 #ifdef GALLIUM_R600
 #include "radeon/radeon_winsys.h"
 #include "radeon/drm/radeon_drm_public.h"
 #include "r600/r600_public.h"
 
 struct pipe_screen *
-pipe_r600_create_screen(int fd, unsigned flags)
+pipe_r600_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct radeon_winsys *rw;
 
-   rw = radeon_drm_winsys_create(fd, flags, r600_screen_create);
+   rw = radeon_drm_winsys_create(fd, config, r600_screen_create);
    return rw ? debug_screen_wrap(rw->screen) : NULL;
 }
 
 #else
 
 struct pipe_screen *
-pipe_r600_create_screen(int fd, unsigned flags)
+pipe_r600_create_screen(int fd, const struct pipe_screen_config *config)
 {
    fprintf(stderr, "r600: driver missing\n");
    return NULL;
 }
 
 #endif
 
 #ifdef GALLIUM_RADEONSI
 #include "radeon/radeon_winsys.h"
 #include "radeon/drm/radeon_drm_public.h"
 #include "amdgpu/drm/amdgpu_public.h"
 #include "radeonsi/si_public.h"
 
 struct pipe_screen *
-pipe_radeonsi_create_screen(int fd, unsigned flags)
+pipe_radeonsi_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct radeon_winsys *rw;
 
    /* First, try amdgpu. */
-   rw = amdgpu_winsys_create(fd, flags, radeonsi_screen_create);
+   rw = amdgpu_winsys_create(fd, config, radeonsi_screen_create);
 
    if (!rw)
-      rw = radeon_drm_winsys_create(fd, flags, radeonsi_screen_create);
+      rw = radeon_drm_winsys_create(fd, config, radeonsi_screen_create);
 
    return rw ? debug_screen_wrap(rw->screen) : NULL;
 }
 
 #else
 
 struct pipe_screen *
-pipe_radeonsi_create_screen(int fd, unsigned flags)
+pipe_radeonsi_create_screen(int fd, const struct pipe_screen_config *config)
 {
    fprintf(stderr, "radeonsi: driver missing\n");
    return NULL;
 }
 
 #endif
 
 #ifdef GALLIUM_VMWGFX
 #include "svga/drm/svga_drm_public.h"
 #include "svga/svga_public.h"
 
 struct pipe_screen *
-pipe_vmwgfx_create_screen(int fd, unsigned flags)
+pipe_vmwgfx_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct svga_winsys_screen *sws;
    struct pipe_screen *screen;
 
    sws = svga_drm_winsys_screen_create(fd);
    if (!sws)
       return NULL;
 
    screen = svga_screen_create(sws);
    return screen ? debug_screen_wrap(screen) : NULL;
 }
 
 #else
 
 struct pipe_screen *
-pipe_vmwgfx_create_screen(int fd, unsigned flags)
+pipe_vmwgfx_create_screen(int fd, const struct pipe_screen_config *config)
 {
    fprintf(stderr, "svga: driver missing\n");
    return NULL;
 }
 
 #endif
 
 #ifdef GALLIUM_FREEDRENO
 #include "freedreno/drm/freedreno_drm_public.h"
 
 struct pipe_screen *
-pipe_freedreno_create_screen(int fd, unsigned flags)
+pipe_freedreno_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
 
    screen = fd_drm_screen_create(fd);
    return screen ? debug_screen_wrap(screen) : NULL;
 }
 
 #else
 
 struct pipe_screen *
-pipe_freedreno_create_screen(int fd, unsigned flags)
+pipe_freedreno_create_screen(int fd, const struct pipe_screen_config *config)
 {
    fprintf(stderr, "freedreno: driver missing\n");
    return NULL;
 }
 
 #endif
 
 #ifdef GALLIUM_VIRGL
 #include "virgl/drm/virgl_drm_public.h"
 #include "virgl/virgl_public.h"
 
 struct pipe_screen *
-pipe_virgl_create_screen(int fd, unsigned flags)
+pipe_virgl_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
 
    screen = virgl_drm_screen_create(fd);
    return screen ? debug_screen_wrap(screen) : NULL;
 }
 
 #else
 
 struct pipe_screen *
-pipe_virgl_create_screen(int fd, unsigned flags)
+pipe_virgl_create_screen(int fd, const struct pipe_screen_config *config)
 {
    fprintf(stderr, "virgl: driver missing\n");
    return NULL;
 }
 
 #endif
 
 #ifdef GALLIUM_VC4
 #include "vc4/drm/vc4_drm_public.h"
 
 struct pipe_screen *
-pipe_vc4_create_screen(int fd, unsigned flags)
+pipe_vc4_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
 
    screen = vc4_drm_screen_create(fd);
    return screen ? debug_screen_wrap(screen) : NULL;
 }
 
 #else
 
 struct pipe_screen *
-pipe_vc4_create_screen(int fd, unsigned flags)
+pipe_vc4_create_screen(int fd, const struct pipe_screen_config *config)
 {
    fprintf(stderr, "vc4: driver missing\n");
    return NULL;
 }
 
 #endif
 
 #ifdef GALLIUM_ETNAVIV
 #include "etnaviv/drm/etnaviv_drm_public.h"
 
 struct pipe_screen *
-pipe_etna_create_screen(int fd, unsigned flags)
+pipe_etna_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
 
    screen = etna_drm_screen_create(fd);
    return screen ? debug_screen_wrap(screen) : NULL;
 }
 
 #else
 
 struct pipe_screen *
-pipe_etna_create_screen(int fd, unsigned flags)
+pipe_etna_create_screen(int fd, const struct pipe_screen_config *config)
 {
    fprintf(stderr, "etnaviv: driver missing\n");
    return NULL;
 }
 
 #endif
 
 #ifdef GALLIUM_IMX
 #include "imx/drm/imx_drm_public.h"
 
 struct pipe_screen *
-pipe_imx_drm_create_screen(int fd, unsigned flags)
+pipe_imx_drm_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
 
    screen = imx_drm_screen_create(fd);
    return screen ? debug_screen_wrap(screen) : NULL;
 }
 
 #else
 
 struct pipe_screen *
-pipe_imx_drm_create_screen(int fd, unsigned flags)
+pipe_imx_drm_create_screen(int fd, const struct pipe_screen_config *config)
 {
    fprintf(stderr, "imx-drm: driver missing\n");
    return NULL;
 }
 
 #endif
 
 
 #endif /* DRM_HELPER_H */
diff --git a/src/gallium/auxiliary/target-helpers/drm_helper_public.h b/src/gallium/auxiliary/target-helpers/drm_helper_public.h
index d4adc88..5746e08 100644
--- a/src/gallium/auxiliary/target-helpers/drm_helper_public.h
+++ b/src/gallium/auxiliary/target-helpers/drm_helper_public.h
@@ -1,46 +1,47 @@
 #ifndef _DRM_HELPER_PUBLIC_H
 #define _DRM_HELPER_PUBLIC_H
 
 
 struct pipe_screen;
+struct pipe_screen_config;
 
 struct pipe_screen *
-pipe_i915_create_screen(int fd, unsigned flags);
+pipe_i915_create_screen(int fd, const struct pipe_screen_config *config);
 
 struct pipe_screen *
-pipe_ilo_create_screen(int fd, unsigned flags);
+pipe_ilo_create_screen(int fd, const struct pipe_screen_config *config);
 
 struct pipe_screen *
-pipe_nouveau_create_screen(int fd, unsigned flags);
+pipe_nouveau_create_screen(int fd, const struct pipe_screen_config *config);
 
 struct pipe_screen *
-pipe_r300_create_screen(int fd, unsigned flags);
+pipe_r300_create_screen(int fd, const struct pipe_screen_config *config);
 
 struct pipe_screen *
-pipe_r600_create_screen(int fd, unsigned flags);
+pipe_r600_create_screen(int fd, const struct pipe_screen_config *config);
 
 struct pipe_screen *
-pipe_radeonsi_create_screen(int fd, unsigned flags);
+pipe_radeonsi_create_screen(int fd, const struct pipe_screen_config *config);
 
 struct pipe_screen *
-pipe_vmwgfx_create_screen(int fd, unsigned flags);
+pipe_vmwgfx_create_screen(int fd, const struct pipe_screen_config *config);
 
 struct pipe_screen *
-pipe_freedreno_create_screen(int fd, unsigned flags);
+pipe_freedreno_create_screen(int fd, const struct pipe_screen_config *config);
 
 struct pipe_screen *
-pipe_virgl_create_screen(int fd, unsigned flags);
+pipe_virgl_create_screen(int fd, const struct pipe_screen_config *config);
 
 struct pipe_screen *
-pipe_vc4_create_screen(int fd, unsigned flags);
+pipe_vc4_create_screen(int fd, const struct pipe_screen_config *config);
 
 struct pipe_screen *
-pipe_pl111_create_screen(int fd, unsigned flags);
+pipe_pl111_create_screen(int fd, const struct pipe_screen_config *config);
 
 struct pipe_screen *
-pipe_etna_create_screen(int fd, unsigned flags);
+pipe_etna_create_screen(int fd, const struct pipe_screen_config *config);
 
 struct pipe_screen *
-pipe_imx_drm_create_screen(int fd, unsigned flags);
+pipe_imx_drm_create_screen(int fd, const struct pipe_screen_config *config);
 
 #endif /* _DRM_HELPER_PUBLIC_H */
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri.c b/src/gallium/auxiliary/vl/vl_winsys_dri.c
index 043483b..7a0fc3c 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri.c
@@ -399,21 +399,21 @@ vl_dri2_screen_create(Display *display, int screen)
 
    authenticate_cookie = xcb_dri2_authenticate_unchecked(scrn->conn,
                                                          xcb_screen->root,
                                                          magic);
    authenticate = xcb_dri2_authenticate_reply(scrn->conn, authenticate_cookie, NULL);
 
    if (authenticate == NULL || !authenticate->authenticated)
       goto free_authenticate;
 
    if (pipe_loader_drm_probe_fd(&scrn->base.dev, fd))
-      scrn->base.pscreen = pipe_loader_create_screen(scrn->base.dev, 0);
+      scrn->base.pscreen = pipe_loader_create_screen(scrn->base.dev, NULL);
 
    if (!scrn->base.pscreen)
       goto release_pipe;
 
    scrn->base.destroy = vl_dri2_screen_destroy;
    scrn->base.texture_from_drawable = vl_dri2_screen_texture_from_drawable;
    scrn->base.get_dirty_area = vl_dri2_screen_get_dirty_area;
    scrn->base.get_timestamp = vl_dri2_screen_get_timestamp;
    scrn->base.set_next_timestamp = vl_dri2_screen_set_next_timestamp;
    scrn->base.get_private = vl_dri2_screen_get_private;
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
index 68bac44..fbb729a 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
@@ -810,21 +810,21 @@ vl_dri3_screen_create(Display *display, int screen)
    if (!geom_reply)
       goto close_fd;
    /* TODO support depth other than 24 */
    if (geom_reply->depth != 24) {
       free(geom_reply);
       goto close_fd;
    }
    free(geom_reply);
 
    if (pipe_loader_drm_probe_fd(&scrn->base.dev, fd))
-      scrn->base.pscreen = pipe_loader_create_screen(scrn->base.dev, 0);
+      scrn->base.pscreen = pipe_loader_create_screen(scrn->base.dev, NULL);
 
    if (!scrn->base.pscreen)
       goto release_pipe;
 
    scrn->pipe = scrn->base.pscreen->context_create(scrn->base.pscreen,
                                                    NULL, 0);
    if (!scrn->pipe)
        goto no_context;
 
    scrn->base.destroy = vl_dri3_screen_destroy;
diff --git a/src/gallium/auxiliary/vl/vl_winsys_drm.c b/src/gallium/auxiliary/vl/vl_winsys_drm.c
index ebde5b8..07ce380 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_drm.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_drm.c
@@ -45,21 +45,21 @@ vl_drm_screen_create(int fd)
    int new_fd;
 
    vscreen = CALLOC_STRUCT(vl_screen);
    if (!vscreen)
       return NULL;
 
    if (fd < 0 || (new_fd = fcntl(fd, F_DUPFD_CLOEXEC, 3)) < 0)
       goto free_screen;
 
    if (pipe_loader_drm_probe_fd(&vscreen->dev, new_fd))
-      vscreen->pscreen = pipe_loader_create_screen(vscreen->dev, 0);
+      vscreen->pscreen = pipe_loader_create_screen(vscreen->dev, NULL);
 
    if (!vscreen->pscreen)
       goto release_pipe;
 
    vscreen->destroy = vl_drm_screen_destroy;
    vscreen->texture_from_drawable = NULL;
    vscreen->get_dirty_area = NULL;
    vscreen->get_timestamp = NULL;
    vscreen->set_next_timestamp = NULL;
    vscreen->get_private = NULL;
diff --git a/src/gallium/drivers/r300/r300_public.h b/src/gallium/drivers/r300/r300_public.h
index d230010..bf54cc4 100644
--- a/src/gallium/drivers/r300/r300_public.h
+++ b/src/gallium/drivers/r300/r300_public.h
@@ -1,17 +1,19 @@
 
 #ifndef R300_PUBLIC_H
 #define R300_PUBLIC_H
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 struct radeon_winsys;
+struct pipe_screen_config;
 
-struct pipe_screen* r300_screen_create(struct radeon_winsys *rws, unsigned flags);
+struct pipe_screen* r300_screen_create(struct radeon_winsys *rws,
+                                       const struct pipe_screen_config *config);
 
 #ifdef __cplusplus
 } // extern "C"
 #endif
 
 #endif
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index 5cdb248..3d1ccce 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -717,21 +717,22 @@ static void r300_fence_reference(struct pipe_screen *screen,
 static boolean r300_fence_finish(struct pipe_screen *screen,
                                  struct pipe_context *ctx,
                                  struct pipe_fence_handle *fence,
                                  uint64_t timeout)
 {
     struct radeon_winsys *rws = r300_screen(screen)->rws;
 
     return rws->fence_wait(rws, fence, timeout);
 }
 
-struct pipe_screen* r300_screen_create(struct radeon_winsys *rws, unsigned flags)
+struct pipe_screen* r300_screen_create(struct radeon_winsys *rws,
+                                       const struct pipe_screen_config *config)
 {
     struct r300_screen *r300screen = CALLOC_STRUCT(r300_screen);
 
     if (!r300screen) {
         FREE(r300screen);
         return NULL;
     }
 
     rws->query_info(rws, &r300screen->info);
 
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index f0ea409..d9fb273 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -625,36 +625,37 @@ static void r600_destroy_screen(struct pipe_screen* pscreen)
 static struct pipe_resource *r600_resource_create(struct pipe_screen *screen,
 						  const struct pipe_resource *templ)
 {
 	if (templ->target == PIPE_BUFFER &&
 	    (templ->bind & PIPE_BIND_GLOBAL))
 		return r600_compute_global_buffer_create(screen, templ);
 
 	return r600_resource_create_common(screen, templ);
 }
 
-struct pipe_screen *r600_screen_create(struct radeon_winsys *ws, unsigned flags)
+struct pipe_screen *r600_screen_create(struct radeon_winsys *ws,
+				       const struct pipe_screen_config *config)
 {
 	struct r600_screen *rscreen = CALLOC_STRUCT(r600_screen);
 
 	if (!rscreen) {
 		return NULL;
 	}
 
 	/* Set functions first. */
 	rscreen->b.b.context_create = r600_create_context;
 	rscreen->b.b.destroy = r600_destroy_screen;
 	rscreen->b.b.get_param = r600_get_param;
 	rscreen->b.b.get_shader_param = r600_get_shader_param;
 	rscreen->b.b.resource_create = r600_resource_create;
 
-	if (!r600_common_screen_init(&rscreen->b, ws, flags)) {
+	if (!r600_common_screen_init(&rscreen->b, ws, config->flags)) {
 		FREE(rscreen);
 		return NULL;
 	}
 
 	if (rscreen->b.info.chip_class >= EVERGREEN) {
 		rscreen->b.b.is_format_supported = evergreen_is_format_supported;
 	} else {
 		rscreen->b.b.is_format_supported = r600_is_format_supported;
 	}
 
diff --git a/src/gallium/drivers/r600/r600_public.h b/src/gallium/drivers/r600/r600_public.h
index 2018440..937b8f7 100644
--- a/src/gallium/drivers/r600/r600_public.h
+++ b/src/gallium/drivers/r600/r600_public.h
@@ -17,14 +17,16 @@
  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
  * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 #ifndef R600_PUBLIC_H
 #define R600_PUBLIC_H
 
 struct radeon_winsys;
+struct pipe_screen_config;
 
-struct pipe_screen *r600_screen_create(struct radeon_winsys *ws, unsigned flags);
+struct pipe_screen *r600_screen_create(struct radeon_winsys *ws,
+				       const struct pipe_screen_config *config);
 
 #endif
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 5f3b7e1..e51cbce 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -912,39 +912,39 @@ static void si_test_vmfault(struct si_screen *sscreen)
 		puts("VM fault test: SDMA - done.");
 	}
 	if (sscreen->b.debug_flags & DBG_TEST_VMFAULT_SHADER) {
 		util_test_constant_buffer(ctx, buf);
 		puts("VM fault test: Shader - done.");
 	}
 	exit(0);
 }
 
 struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws,
-					   unsigned flags)
+					   const struct pipe_screen_config *config)
 {
 	struct si_screen *sscreen = CALLOC_STRUCT(si_screen);
 	unsigned num_threads, num_compiler_threads, num_compiler_threads_lowprio, i;
 
 	if (!sscreen) {
 		return NULL;
 	}
 
 	/* Set functions first. */
 	sscreen->b.b.context_create = si_pipe_create_context;
 	sscreen->b.b.destroy = si_destroy_screen;
 	sscreen->b.b.get_param = si_get_param;
 	sscreen->b.b.get_shader_param = si_get_shader_param;
 	sscreen->b.b.resource_create = r600_resource_create_common;
 
 	si_init_screen_state_functions(sscreen);
 
-	if (!r600_common_screen_init(&sscreen->b, ws, flags) ||
+	if (!r600_common_screen_init(&sscreen->b, ws, config->flags) ||
 	    !si_init_gs_info(sscreen) ||
 	    !si_init_shader_cache(sscreen)) {
 		FREE(sscreen);
 		return NULL;
 	}
 
 	/* Only enable as many threads as we have target machines, but at most
 	 * the number of CPUs - 1 if there is more than one.
 	 */
 	num_threads = sysconf(_SC_NPROCESSORS_ONLN);
diff --git a/src/gallium/drivers/radeonsi/si_public.h b/src/gallium/drivers/radeonsi/si_public.h
index 13b1731..d502717 100644
--- a/src/gallium/drivers/radeonsi/si_public.h
+++ b/src/gallium/drivers/radeonsi/si_public.h
@@ -19,13 +19,13 @@
  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 #ifndef SI_PUBLIC_H
 #define SI_PUBLIC_H
 
 struct radeon_winsys;
 
 struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws,
-					   unsigned flags);
+					   const struct pipe_screen_config *config);
 
 #endif
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index 65e954a..a804aa9 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -353,15 +353,23 @@ struct pipe_screen {
     * The \p external_only array is used to return whether the format and
     * modifier combination can only be used with an external texture target.
     */
    void (*query_dmabuf_modifiers)(struct pipe_screen *screen,
                                   enum pipe_format format, int max,
                                   uint64_t *modifiers,
                                   unsigned int *external_only, int *count);
 };
 
 
+/**
+ * Global configuration options for screen creation.
+ */
+struct pipe_screen_config {
+   unsigned flags;
+};
+
+
 #ifdef __cplusplus
 }
 #endif
 
 #endif /* P_SCREEN_H */
diff --git a/src/gallium/include/state_tracker/drm_driver.h b/src/gallium/include/state_tracker/drm_driver.h
index 1ac0528..f188b5a 100644
--- a/src/gallium/include/state_tracker/drm_driver.h
+++ b/src/gallium/include/state_tracker/drm_driver.h
@@ -1,17 +1,18 @@
 
 #ifndef _DRM_DRIVER_H_
 #define _DRM_DRIVER_H_
 
 #include "pipe/p_compiler.h"
 
 struct pipe_screen;
+struct pipe_screen_config;
 struct pipe_context;
 struct pipe_resource;
 
 #define DRM_API_HANDLE_TYPE_SHARED 0
 #define DRM_API_HANDLE_TYPE_KMS    1
 #define DRM_API_HANDLE_TYPE_FD     2
 
 
 /**
  * For use with pipe_screen::{texture_from_handle|texture_get_handle}.
@@ -97,21 +98,22 @@ struct drm_driver_descriptor
     * Identifying prefix/suffix of the binary, used by the pipe-loader.
     */
    const char *driver_name;
 
    /**
     * Create a pipe srcreen.
     *
     * This function does any wrapping of the screen.
     * For example wrapping trace or rbug debugging drivers around it.
     */
-   struct pipe_screen* (*create_screen)(int drm_fd, unsigned flags);
+   struct pipe_screen* (*create_screen)(int drm_fd,
+                                        const struct pipe_screen_config *config);
 
    /**
     * Return a configuration value.
     *
     * If this function is NULL, or if it returns NULL
     * the state tracker- or state
     * tracker manager should provide a reasonable default value.
     */
    const struct drm_conf_ret *(*configuration) (enum drm_conf conf);
 };
diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
index 2ad9e49..bd07670 100644
--- a/src/gallium/state_trackers/clover/core/device.cpp
+++ b/src/gallium/state_trackers/clover/core/device.cpp
@@ -35,21 +35,21 @@ namespace {
       int sz = pipe->get_compute_param(pipe, ir_format, cap, NULL);
       std::vector<T> v(sz / sizeof(T));
 
       pipe->get_compute_param(pipe, ir_format, cap, &v.front());
       return v;
    }
 }
 
 device::device(clover::platform &platform, pipe_loader_device *ldev) :
    platform(platform), ldev(ldev) {
-   pipe = pipe_loader_create_screen(ldev, 0);
+   pipe = pipe_loader_create_screen(ldev, NULL);
    if (!pipe || !pipe->get_param(pipe, PIPE_CAP_COMPUTE)) {
       if (pipe)
          pipe->destroy(pipe);
       throw error(CL_INVALID_DEVICE);
    }
 }
 
 device::~device() {
    if (pipe)
       pipe->destroy(pipe);
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 60ec38d..2dceb1d 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -2026,24 +2026,26 @@ dri2_init_screen(__DRIscreen * sPriv)
    screen->fd = sPriv->fd;
    (void) mtx_init(&screen->opencl_func_mutex, mtx_plain);
 
    sPriv->driverPrivate = (void *)screen;
 
    if (screen->fd < 0 || (fd = fcntl(screen->fd, F_DUPFD_CLOEXEC, 3)) < 0)
       goto free_screen;
 
 
    if (pipe_loader_drm_probe_fd(&screen->dev, fd)) {
-      unsigned flags =
+      struct pipe_screen_config config = {};
+
+      config.flags =
          dri_init_options_get_screen_flags(screen, screen->dev->driver_name);
 
-      pscreen = pipe_loader_create_screen(screen->dev, flags);
+      pscreen = pipe_loader_create_screen(screen->dev, &config);
    }
 
    if (!pscreen)
        goto release_pipe;
 
    throttle_ret = pipe_loader_configuration(screen->dev, DRM_CONF_THROTTLE);
    dmabuf_ret = pipe_loader_configuration(screen->dev, DRM_CONF_SHARE_FD);
 
    if (throttle_ret && throttle_ret->val.val_int != -1) {
       screen->throttling_enabled = TRUE;
@@ -2120,24 +2122,26 @@ dri_kms_init_screen(__DRIscreen * sPriv)
       return NULL;
 
    screen->sPriv = sPriv;
    screen->fd = sPriv->fd;
 
    sPriv->driverPrivate = (void *)screen;
 
    if (screen->fd < 0 || (fd = fcntl(screen->fd, F_DUPFD_CLOEXEC, 3)) < 0)
       goto free_screen;
 
-   unsigned flags = dri_init_options_get_screen_flags(screen, "swrast");
+   struct pipe_screen_config config = {};
+
+   config.flags = dri_init_options_get_screen_flags(screen, "swrast");
 
    if (pipe_loader_sw_probe_kms(&screen->dev, fd))
-      pscreen = pipe_loader_create_screen(screen->dev, flags);
+      pscreen = pipe_loader_create_screen(screen->dev, &config);
 
    if (!pscreen)
        goto release_pipe;
 
    if (pscreen->resource_create_with_modifiers)
       dri2ImageExtension.createImageWithModifiers =
          dri2_create_image_with_modifiers;
 
    if (drmGetCap(sPriv->fd, DRM_CAP_PRIME, &cap) == 0 &&
           (cap & DRM_PRIME_CAP_IMPORT)) {
diff --git a/src/gallium/state_trackers/dri/drisw.c b/src/gallium/state_trackers/dri/drisw.c
index 189d61c..2e3ab96 100644
--- a/src/gallium/state_trackers/dri/drisw.c
+++ b/src/gallium/state_trackers/dri/drisw.c
@@ -392,24 +392,26 @@ drisw_init_screen(__DRIscreen * sPriv)
       return NULL;
 
    screen->sPriv = sPriv;
    screen->fd = -1;
 
    swrast_no_present = debug_get_option_swrast_no_present();
 
    sPriv->driverPrivate = (void *)screen;
    sPriv->extensions = drisw_screen_extensions;
 
-   unsigned flags = dri_init_options_get_screen_flags(screen, "swrast");
+   struct pipe_screen_config config;
+
+   config.flags = dri_init_options_get_screen_flags(screen, "swrast");
 
    if (pipe_loader_sw_probe_dri(&screen->dev, &drisw_lf))
-      pscreen = pipe_loader_create_screen(screen->dev, flags);
+      pscreen = pipe_loader_create_screen(screen->dev, &config);
 
    if (!pscreen)
       goto fail;
 
    configs = dri_init_screen_helper(screen, pscreen);
    if (!configs)
       goto fail;
 
    return configs;
 fail:
diff --git a/src/gallium/state_trackers/xa/xa_tracker.c b/src/gallium/state_trackers/xa/xa_tracker.c
index e5addcf..d4114ab 100644
--- a/src/gallium/state_trackers/xa/xa_tracker.c
+++ b/src/gallium/state_trackers/xa/xa_tracker.c
@@ -155,21 +155,21 @@ xa_tracker_create(int drm_fd)
     unsigned int num_formats;
     int fd;
 
     if (!xa)
 	return NULL;
 
     if (drm_fd < 0 || (fd = fcntl(drm_fd, F_DUPFD_CLOEXEC, 3)) < 0)
 	goto out_no_fd;
 
     if (pipe_loader_drm_probe_fd(&xa->dev, fd))
-	xa->screen = pipe_loader_create_screen(xa->dev, 0);
+	xa->screen = pipe_loader_create_screen(xa->dev, NULL);
 
     if (!xa->screen)
 	goto out_no_screen;
 
     xa->default_ctx = xa_context_create(xa);
     if (!xa->default_ctx)
 	goto out_no_pipe;
 
     num_formats = 0;
     for (stype = 0; stype < XA_LAST_SURFACE_TYPE; ++stype)
diff --git a/src/gallium/targets/d3dadapter9/drm.c b/src/gallium/targets/d3dadapter9/drm.c
index c0ed97a..e6e7144 100644
--- a/src/gallium/targets/d3dadapter9/drm.c
+++ b/src/gallium/targets/d3dadapter9/drm.c
@@ -222,21 +222,21 @@ drm_create_adapter( int fd,
     ctx->fd = fd;
     ctx->base.linear_framebuffer = different_device;
 
     if (!pipe_loader_drm_probe_fd(&ctx->dev, fd)) {
         ERR("Failed to probe drm fd %d.\n", fd);
         FREE(ctx);
         close(fd);
         return D3DERR_DRIVERINTERNALERROR;
     }
 
-    ctx->base.hal = pipe_loader_create_screen(ctx->dev, 0);
+    ctx->base.hal = pipe_loader_create_screen(ctx->dev, NULL);
     if (!ctx->base.hal) {
         ERR("Unable to load requested driver.\n");
         drm_destroy(&ctx->base);
         return D3DERR_DRIVERINTERNALERROR;
     }
 
     dmabuf_ret = pipe_loader_configuration(ctx->dev, DRM_CONF_SHARE_FD);
     throttle_ret = pipe_loader_configuration(ctx->dev, DRM_CONF_THROTTLE);
     if (!dmabuf_ret || !dmabuf_ret->val.val_bool) {
         ERR("The driver is not capable of dma-buf sharing."
@@ -305,21 +305,21 @@ drm_create_adapter( int fd,
     if (driCheckOption(&userInitOptions, "csmt_force", DRI_INT))
         ctx->base.csmt_force = driQueryOptioni(&userInitOptions, "csmt_force");
     else
         ctx->base.csmt_force = -1;
 
     driDestroyOptionCache(&userInitOptions);
     driDestroyOptionInfo(&defaultInitOptions);
 
     /* 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, 0);
+        ctx->base.ref = pipe_loader_create_screen(ctx->swdev, NULL);
 
     if (!ctx->base.ref) {
         ERR("Couldn't wrap drm screen to swrast screen. Software devices "
             "will be unavailable.\n");
     }
 
     /* read out PCI info */
     read_descriptor(&ctx->base, fd, override_vendorid);
 
     /* create and return new ID3DAdapter9 */
diff --git a/src/gallium/targets/pipe-loader/pipe_i915.c b/src/gallium/targets/pipe-loader/pipe_i915.c
index 43061b0..8524a1d 100644
--- a/src/gallium/targets/pipe-loader/pipe_i915.c
+++ b/src/gallium/targets/pipe-loader/pipe_i915.c
@@ -1,18 +1,18 @@
 
 #include "target-helpers/inline_debug_helper.h"
 #include "state_tracker/drm_driver.h"
 #include "i915/drm/i915_drm_public.h"
 #include "i915/i915_public.h"
 
 static struct pipe_screen *
-create_screen(int fd, unsigned flags)
+create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct i915_winsys *iws;
    struct pipe_screen *screen;
 
    iws = i915_drm_winsys_create(fd);
    if (!iws)
       return NULL;
 
    screen = i915_screen_create(iws);
    if (!screen)
diff --git a/src/gallium/targets/pipe-loader/pipe_msm.c b/src/gallium/targets/pipe-loader/pipe_msm.c
index 180e0f9..886fbdf 100644
--- a/src/gallium/targets/pipe-loader/pipe_msm.c
+++ b/src/gallium/targets/pipe-loader/pipe_msm.c
@@ -1,17 +1,17 @@
 
 #include "target-helpers/inline_debug_helper.h"
 #include "state_tracker/drm_driver.h"
 #include "freedreno/drm/freedreno_drm_public.h"
 
 static struct pipe_screen *
-create_screen(int fd, unsigned flags)
+create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
 
    screen = fd_drm_screen_create(fd);
    if (!screen)
       return NULL;
 
    screen = debug_screen_wrap(screen);
 
    return screen;
diff --git a/src/gallium/targets/pipe-loader/pipe_nouveau.c b/src/gallium/targets/pipe-loader/pipe_nouveau.c
index de61f44..d95aeda 100644
--- a/src/gallium/targets/pipe-loader/pipe_nouveau.c
+++ b/src/gallium/targets/pipe-loader/pipe_nouveau.c
@@ -1,17 +1,17 @@
 
 #include "target-helpers/inline_debug_helper.h"
 #include "state_tracker/drm_driver.h"
 #include "nouveau/drm/nouveau_drm_public.h"
 
 static struct pipe_screen *
-create_screen(int fd, unsigned flags)
+create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
 
    screen = nouveau_drm_screen_create(fd);
    if (!screen)
       return NULL;
 
    screen = debug_screen_wrap(screen);
 
    return screen;
diff --git a/src/gallium/targets/pipe-loader/pipe_r300.c b/src/gallium/targets/pipe-loader/pipe_r300.c
index da72859..0dcc019 100644
--- a/src/gallium/targets/pipe-loader/pipe_r300.c
+++ b/src/gallium/targets/pipe-loader/pipe_r300.c
@@ -1,18 +1,18 @@
 #include "target-helpers/inline_debug_helper.h"
 #include "state_tracker/drm_driver.h"
 #include "radeon/drm/radeon_drm_public.h"
 #include "radeon/radeon_winsys.h"
 #include "r300/r300_public.h"
 
 static struct pipe_screen *
-create_screen(int fd, unsigned flags)
+create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct radeon_winsys *sws;
 
    sws = radeon_drm_winsys_create(fd, flags, r300_screen_create);
    return sws ? debug_screen_wrap(sws->screen) : NULL;
 }
 
 static const struct drm_conf_ret throttle_ret = {
    .type = DRM_CONF_INT,
    .val.val_int = 2,
diff --git a/src/gallium/targets/pipe-loader/pipe_r600.c b/src/gallium/targets/pipe-loader/pipe_r600.c
index dfe130a..0eedde7 100644
--- a/src/gallium/targets/pipe-loader/pipe_r600.c
+++ b/src/gallium/targets/pipe-loader/pipe_r600.c
@@ -1,18 +1,18 @@
 #include "state_tracker/drm_driver.h"
 #include "target-helpers/inline_debug_helper.h"
 #include "radeon/drm/radeon_drm_public.h"
 #include "radeon/radeon_winsys.h"
 #include "r600/r600_public.h"
 
 static struct pipe_screen *
-create_screen(int fd, unsigned flags)
+create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct radeon_winsys *rw;
 
    rw = radeon_drm_winsys_create(fd, flags, r600_screen_create);
    return rw ? debug_screen_wrap(rw->screen) : NULL;
 }
 
 static const struct drm_conf_ret throttle_ret = {
    .type = DRM_CONF_INT,
    .val.val_int = 2,
diff --git a/src/gallium/targets/pipe-loader/pipe_radeonsi.c b/src/gallium/targets/pipe-loader/pipe_radeonsi.c
index 1bbd97f..598baf5 100644
--- a/src/gallium/targets/pipe-loader/pipe_radeonsi.c
+++ b/src/gallium/targets/pipe-loader/pipe_radeonsi.c
@@ -1,19 +1,19 @@
 #include "state_tracker/drm_driver.h"
 #include "target-helpers/inline_debug_helper.h"
 #include "radeon/drm/radeon_drm_public.h"
 #include "radeon/radeon_winsys.h"
 #include "amdgpu/drm/amdgpu_public.h"
 #include "radeonsi/si_public.h"
 
 static struct pipe_screen *
-create_screen(int fd, unsigned flags)
+create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct radeon_winsys *rw;
 
    /* First, try amdgpu. */
    rw = amdgpu_winsys_create(fd, flags, radeonsi_screen_create);
 
    if (!rw)
       rw = radeon_drm_winsys_create(fd, flags, radeonsi_screen_create);
 
    return rw ? debug_screen_wrap(rw->screen) : NULL;
diff --git a/src/gallium/targets/pipe-loader/pipe_vmwgfx.c b/src/gallium/targets/pipe-loader/pipe_vmwgfx.c
index 6320831..68bf92c 100644
--- a/src/gallium/targets/pipe-loader/pipe_vmwgfx.c
+++ b/src/gallium/targets/pipe-loader/pipe_vmwgfx.c
@@ -1,18 +1,18 @@
 
 #include "target-helpers/inline_debug_helper.h"
 #include "state_tracker/drm_driver.h"
 #include "svga/drm/svga_drm_public.h"
 #include "svga/svga_public.h"
 
 static struct pipe_screen *
-create_screen(int fd, unsigned flags)
+create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct svga_winsys_screen *sws;
    struct pipe_screen *screen;
 
    sws = svga_drm_winsys_screen_create(fd);
    if (!sws)
       return NULL;
 
    screen = svga_screen_create(sws);
    if (!screen)
diff --git a/src/gallium/tests/trivial/compute.c b/src/gallium/tests/trivial/compute.c
index a2e882c..49fefd8 100644
--- a/src/gallium/tests/trivial/compute.c
+++ b/src/gallium/tests/trivial/compute.c
@@ -69,21 +69,21 @@ struct context {
                 printf(" }\n");                                         \
         } while (0)
 
 static void init_ctx(struct context *ctx)
 {
         int ret;
 
         ret = pipe_loader_probe(&ctx->dev, 1);
         assert(ret);
 
-        ctx->screen = pipe_loader_create_screen(ctx->dev, 0);
+        ctx->screen = pipe_loader_create_screen(ctx->dev, NULL);
         assert(ctx->screen);
 
         ctx->pipe = ctx->screen->context_create(ctx->screen, NULL, 0);
         assert(ctx->pipe);
 
         DUMP_COMPUTE_PARAM(p, PIPE_COMPUTE_CAP_GRID_DIMENSION);
         DUMP_COMPUTE_PARAM(p, PIPE_COMPUTE_CAP_MAX_GRID_SIZE);
         DUMP_COMPUTE_PARAM(p, PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE);
 }
 
diff --git a/src/gallium/tests/trivial/quad-tex.c b/src/gallium/tests/trivial/quad-tex.c
index 113cb92..f6232d5 100644
--- a/src/gallium/tests/trivial/quad-tex.c
+++ b/src/gallium/tests/trivial/quad-tex.c
@@ -89,21 +89,21 @@ struct program
 static void init_prog(struct program *p)
 {
 	struct pipe_surface surf_tmpl;
 	int ret;
 
 	/* find a hardware device */
 	ret = pipe_loader_probe(&p->dev, 1);
 	assert(ret);
 
 	/* init a pipe screen */
-	p->screen = pipe_loader_create_screen(p->dev, 0);
+	p->screen = pipe_loader_create_screen(p->dev, NULL);
 	assert(p->screen);
 
 	/* create the pipe driver context and cso context */
 	p->pipe = p->screen->context_create(p->screen, NULL, 0);
 	p->cso = cso_create_context(p->pipe, 0);
 
 	/* set clear color */
 	p->clear_color.f[0] = 0.3;
 	p->clear_color.f[1] = 0.1;
 	p->clear_color.f[2] = 0.3;
diff --git a/src/gallium/tests/trivial/tri.c b/src/gallium/tests/trivial/tri.c
index df02e96..b45a408 100644
--- a/src/gallium/tests/trivial/tri.c
+++ b/src/gallium/tests/trivial/tri.c
@@ -84,21 +84,21 @@ struct program
 static void init_prog(struct program *p)
 {
 	struct pipe_surface surf_tmpl;
 	int ret;
 
 	/* find a hardware device */
 	ret = pipe_loader_probe(&p->dev, 1);
 	assert(ret);
 
 	/* init a pipe screen */
-	p->screen = pipe_loader_create_screen(p->dev, 0);
+	p->screen = pipe_loader_create_screen(p->dev, NULL);
 	assert(p->screen);
 
 	/* create the pipe driver context and cso context */
 	p->pipe = p->screen->context_create(p->screen, NULL, 0);
 	p->cso = cso_create_context(p->pipe, 0);
 
 	/* set clear color */
 	p->clear_color.f[0] = 0.3;
 	p->clear_color.f[1] = 0.1;
 	p->clear_color.f[2] = 0.3;
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_public.h b/src/gallium/winsys/amdgpu/drm/amdgpu_public.h
index 3cb5a1b..8702e4f 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_public.h
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_public.h
@@ -24,19 +24,20 @@
  * of the Software.
  */
 
 #ifndef AMDGPU_PUBLIC_H
 #define AMDGPU_PUBLIC_H
 
 #include "pipe/p_defines.h"
 
 struct radeon_winsys;
 struct pipe_screen;
+struct pipe_screen_config;
 
 typedef struct pipe_screen *(*radeon_screen_create_t)(struct radeon_winsys *,
-						      unsigned);
+                                                      const struct pipe_screen_config *config);
 
 struct radeon_winsys *
-amdgpu_winsys_create(int fd, unsigned flags,
+amdgpu_winsys_create(int fd, const struct pipe_screen_config *config,
 		     radeon_screen_create_t screen_create);
 
 #endif
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
index c4d5216..2cb3855 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
@@ -222,21 +222,21 @@ static bool amdgpu_winsys_unref(struct radeon_winsys *rws)
 }
 
 static const char* amdgpu_get_chip_name(struct radeon_winsys *ws)
 {
    amdgpu_device_handle dev = ((struct amdgpu_winsys *)ws)->dev;
    return amdgpu_get_marketing_name(dev);
 }
 
 
 PUBLIC struct radeon_winsys *
-amdgpu_winsys_create(int fd, unsigned flags,
+amdgpu_winsys_create(int fd, const struct pipe_screen_config *config,
 		     radeon_screen_create_t screen_create)
 {
    struct amdgpu_winsys *ws;
    drmVersionPtr version = drmGetVersion(fd);
    amdgpu_device_handle dev;
    uint32_t drm_major, drm_minor, r;
 
    /* The DRM driver version of amdgpu is 3.x.x. */
    if (version->version_major != 3) {
       drmFreeVersion(version);
@@ -318,21 +318,21 @@ amdgpu_winsys_create(int fd, unsigned flags,
       amdgpu_winsys_destroy(&ws->base);
       mtx_unlock(&dev_tab_mutex);
       return NULL;
    }
 
    /* Create the screen at the end. The winsys must be initialized
     * completely.
     *
     * Alternatively, we could create the screen based on "ws->gen"
     * and link all drivers into one binary blob. */
-   ws->base.screen = screen_create(&ws->base, flags);
+   ws->base.screen = screen_create(&ws->base, config);
    if (!ws->base.screen) {
       amdgpu_winsys_destroy(&ws->base);
       mtx_unlock(&dev_tab_mutex);
       return NULL;
    }
 
    util_hash_table_set(dev_tab, dev, ws);
 
    /* We must unlock the mutex once the winsys is fully initialized, so that
     * other threads attempting to create the winsys from the same fd will
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_public.h b/src/gallium/winsys/radeon/drm/radeon_drm_public.h
index 2192aa6..6a772f3 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_public.h
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_public.h
@@ -1,16 +1,17 @@
 #ifndef RADEON_DRM_PUBLIC_H
 #define RADEON_DRM_PUBLIC_H
 
 #include "pipe/p_defines.h"
 
 struct radeon_winsys;
 struct pipe_screen;
+struct pipe_screen_config;
 
 typedef struct pipe_screen *(*radeon_screen_create_t)(struct radeon_winsys *,
-						      unsigned);
+                                                      const struct pipe_screen_config *);
 
 struct radeon_winsys *
-radeon_drm_winsys_create(int fd, unsigned flags,
+radeon_drm_winsys_create(int fd, const struct pipe_screen_config *config,
 			 radeon_screen_create_t screen_create);
 
 #endif
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
index 2a6ce2c..0faf9ae 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c
@@ -728,21 +728,21 @@ static unsigned handle_hash(void *key)
 {
     return PTR_TO_UINT(key);
 }
 
 static int handle_compare(void *key1, void *key2)
 {
     return PTR_TO_UINT(key1) != PTR_TO_UINT(key2);
 }
 
 PUBLIC struct radeon_winsys *
-radeon_drm_winsys_create(int fd, unsigned flags,
+radeon_drm_winsys_create(int fd, const struct pipe_screen_config *config,
 			 radeon_screen_create_t screen_create)
 {
     struct radeon_drm_winsys *ws;
 
     mtx_lock(&fd_tab_mutex);
     if (!fd_tab) {
         fd_tab = util_hash_table_create(hash_fd, compare_fd);
     }
 
     ws = util_hash_table_get(fd_tab, intptr_to_pointer(fd));
@@ -824,21 +824,21 @@ radeon_drm_winsys_create(int fd, unsigned flags,
     ws->info.gart_page_size = sysconf(_SC_PAGESIZE);
 
     if (ws->num_cpus > 1 && debug_get_option_thread())
         util_queue_init(&ws->cs_queue, "radeon_cs", 8, 1, 0);
 
     /* Create the screen at the end. The winsys must be initialized
      * completely.
      *
      * Alternatively, we could create the screen based on "ws->gen"
      * and link all drivers into one binary blob. */
-    ws->base.screen = screen_create(&ws->base, flags);
+    ws->base.screen = screen_create(&ws->base, config);
     if (!ws->base.screen) {
         radeon_winsys_destroy(&ws->base);
         mtx_unlock(&fd_tab_mutex);
         return NULL;
     }
 
     util_hash_table_set(fd_tab, intptr_to_pointer(ws->fd), ws);
 
     /* We must unlock the mutex once the winsys is fully initialized, so that
      * other threads attempting to create the winsys from the same fd will
-- 
2.9.3



More information about the mesa-dev mailing list