[Mesa-dev] [PATCH 1/7] gallium: Constify several pipe_screen get_* functions

Tom Stellard tom at stellard.net
Tue Jul 9 21:21:38 PDT 2013


From: Tom Stellard <thomas.stellard at amd.com>

This patches adds the const qualifier to the struct pipe_screen *
argument to the following functions:

pipe_screen::get_name()
pipe_screen::get_vendor()
pipe_screen::get_param()
pipe_screen::get_paramf()
pipe_screen::get_shader_param()
pipe_screen::get_video_param()
pipe_screen::get_compute_param()
---
 src/gallium/auxiliary/vl/vl_decoder.c             |  3 ++-
 src/gallium/auxiliary/vl/vl_decoder.h             |  3 ++-
 src/gallium/auxiliary/vl/vl_video_buffer.c        |  2 +-
 src/gallium/auxiliary/vl/vl_video_buffer.h        |  2 +-
 src/gallium/drivers/freedreno/freedreno_screen.c  | 12 +++++-----
 src/gallium/drivers/freedreno/freedreno_screen.h  |  6 +++++
 src/gallium/drivers/galahad/glhd_screen.c         | 20 ++++++++--------
 src/gallium/drivers/galahad/glhd_screen.h         |  7 ++++++
 src/gallium/drivers/i915/i915_screen.c            | 14 ++++++------
 src/gallium/drivers/i915/i915_screen.h            |  6 +++++
 src/gallium/drivers/identity/id_screen.c          | 20 ++++++++--------
 src/gallium/drivers/identity/id_screen.h          |  6 +++++
 src/gallium/drivers/ilo/ilo_screen.c              | 18 +++++++--------
 src/gallium/drivers/ilo/ilo_screen.h              |  6 +++++
 src/gallium/drivers/llvmpipe/lp_screen.c          | 10 ++++----
 src/gallium/drivers/noop/noop_pipe.c              | 10 ++++----
 src/gallium/drivers/nouveau/nouveau_screen.c      |  6 ++---
 src/gallium/drivers/nouveau/nouveau_screen.h      |  6 +++++
 src/gallium/drivers/nouveau/nouveau_video.c       |  2 +-
 src/gallium/drivers/nv30/nv30_screen.c            | 12 +++++-----
 src/gallium/drivers/nv30/nv30_screen.h            |  6 +++++
 src/gallium/drivers/nv50/nv50_screen.c            | 14 ++++++------
 src/gallium/drivers/nv50/nv50_screen.h            |  6 +++++
 src/gallium/drivers/nvc0/nvc0_context.h           |  2 +-
 src/gallium/drivers/nvc0/nvc0_screen.c            | 14 ++++++------
 src/gallium/drivers/nvc0/nvc0_screen.h            |  7 ++++++
 src/gallium/drivers/nvc0/nvc0_video.c             |  4 ++--
 src/gallium/drivers/r300/r300_screen.c            | 20 ++++++++--------
 src/gallium/drivers/r300/r300_screen.h            |  5 ++++
 src/gallium/drivers/r600/r600_pipe.c              | 16 ++++++-------
 src/gallium/drivers/r600/r600_pipe.h              |  2 +-
 src/gallium/drivers/r600/r600_uvd.c               |  2 +-
 src/gallium/drivers/radeon/radeon_uvd.c           |  2 +-
 src/gallium/drivers/radeon/radeon_uvd.h           |  2 +-
 src/gallium/drivers/radeonsi/radeonsi_pipe.c      | 20 ++++++++--------
 src/gallium/drivers/rbug/rbug_screen.c            | 20 ++++++++--------
 src/gallium/drivers/rbug/rbug_screen.h            |  7 ++++++
 src/gallium/drivers/softpipe/sp_screen.c          | 14 ++++++------
 src/gallium/drivers/softpipe/sp_screen.h          |  5 ++++
 src/gallium/drivers/svga/svga_screen.c            | 24 ++++++++++++-------
 src/gallium/drivers/svga/svga_screen.h            |  9 ++++++++
 src/gallium/drivers/trace/tr_screen.c             | 28 +++++++++++++++--------
 src/gallium/drivers/trace/tr_screen.h             |  2 ++
 src/gallium/include/pipe/p_screen.h               | 14 ++++++------
 src/gallium/state_trackers/clover/core/device.hpp |  1 +
 45 files changed, 260 insertions(+), 157 deletions(-)

diff --git a/src/gallium/auxiliary/vl/vl_decoder.c b/src/gallium/auxiliary/vl/vl_decoder.c
index d6909cb..386bee9 100644
--- a/src/gallium/auxiliary/vl/vl_decoder.c
+++ b/src/gallium/auxiliary/vl/vl_decoder.c
@@ -33,7 +33,8 @@
 #include "vl_mpeg12_decoder.h"
 
 bool
-vl_profile_supported(struct pipe_screen *screen, enum pipe_video_profile profile)
+vl_profile_supported(const struct pipe_screen *screen,
+                     enum pipe_video_profile profile)
 {
    assert(screen);
    switch (u_reduce_video_profile(profile)) {
diff --git a/src/gallium/auxiliary/vl/vl_decoder.h b/src/gallium/auxiliary/vl/vl_decoder.h
index 8fa6527..8ebf762 100644
--- a/src/gallium/auxiliary/vl/vl_decoder.h
+++ b/src/gallium/auxiliary/vl/vl_decoder.h
@@ -35,7 +35,8 @@
  * check if a given profile is supported with shader based decoding
  */
 bool
-vl_profile_supported(struct pipe_screen *screen, enum pipe_video_profile profile);
+vl_profile_supported(const struct pipe_screen *screen,
+                     enum pipe_video_profile profile);
 
 /**
  * standard implementation of pipe->create_video_decoder
diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c
index 6ef95e4..4dd2c49 100644
--- a/src/gallium/auxiliary/vl/vl_video_buffer.c
+++ b/src/gallium/auxiliary/vl/vl_video_buffer.c
@@ -175,7 +175,7 @@ vl_video_buffer_is_format_supported(struct pipe_screen *screen,
 }
 
 unsigned
-vl_video_buffer_max_size(struct pipe_screen *screen)
+vl_video_buffer_max_size(const struct pipe_screen *screen)
 {
    uint32_t max_2d_texture_level;
 
diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.h b/src/gallium/auxiliary/vl/vl_video_buffer.h
index 178f429..9d192b2 100644
--- a/src/gallium/auxiliary/vl/vl_video_buffer.h
+++ b/src/gallium/auxiliary/vl/vl_video_buffer.h
@@ -64,7 +64,7 @@ vl_video_buffer_plane_order(enum pipe_format format);
  * get maximum size of video buffers
  */
 unsigned
-vl_video_buffer_max_size(struct pipe_screen *screen);
+vl_video_buffer_max_size(const struct pipe_screen *screen);
 
 /**
  * check if video buffer format is supported for a codec/profile
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
index ff45b3e..372f87d 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -68,16 +68,16 @@ DEBUG_GET_ONCE_FLAGS_OPTION(fd_mesa_debug, "FD_MESA_DEBUG", debug_options, 0)
 int fd_mesa_debug = 0;
 
 static const char *
-fd_screen_get_name(struct pipe_screen *pscreen)
+fd_screen_get_name(const struct pipe_screen *pscreen)
 {
 	static char buffer[128];
 	util_snprintf(buffer, sizeof(buffer), "FD%03d",
-			fd_screen(pscreen)->device_id);
+			fd_screen_const(pscreen)->device_id);
 	return buffer;
 }
 
 static const char *
-fd_screen_get_vendor(struct pipe_screen *pscreen)
+fd_screen_get_vendor(const struct pipe_screen *pscreen)
 {
 	return "freedreno";
 }
@@ -131,7 +131,7 @@ TODO either move caps to a2xx/a3xx specific code, or maybe have some
 tables for things that differ if the delta is not too much..
  */
 static int
-fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
+fd_screen_get_param(const struct pipe_screen *pscreen, enum pipe_cap param)
 {
 	/* this is probably not totally correct.. but it's a start: */
 	switch (param) {
@@ -234,7 +234,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
 }
 
 static float
-fd_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_capf param)
+fd_screen_get_paramf(const struct pipe_screen *pscreen, enum pipe_capf param)
 {
 	switch (param) {
 	case PIPE_CAPF_MAX_LINE_WIDTH:
@@ -258,7 +258,7 @@ fd_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_capf param)
 }
 
 static int
-fd_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
+fd_screen_get_shader_param(const struct pipe_screen *pscreen, unsigned shader,
 		enum pipe_shader_cap param)
 {
 	switch(shader)
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.h b/src/gallium/drivers/freedreno/freedreno_screen.h
index 93501e7..1d63b5a 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.h
+++ b/src/gallium/drivers/freedreno/freedreno_screen.h
@@ -58,6 +58,12 @@ fd_screen(struct pipe_screen *pscreen)
 	return (struct fd_screen *)pscreen;
 }
 
+static INLINE const struct fd_screen *
+fd_screen_const(const struct pipe_screen *pscreen)
+{
+	return (const struct fd_screen *)pscreen;
+}
+
 boolean fd_screen_bo_get_handle(struct pipe_screen *pscreen,
 		struct fd_bo *bo,
 		unsigned stride,
diff --git a/src/gallium/drivers/galahad/glhd_screen.c b/src/gallium/drivers/galahad/glhd_screen.c
index 16a5ff1..0d1aace 100644
--- a/src/gallium/drivers/galahad/glhd_screen.c
+++ b/src/gallium/drivers/galahad/glhd_screen.c
@@ -52,28 +52,28 @@ galahad_screen_destroy(struct pipe_screen *_screen)
 }
 
 static const char *
-galahad_screen_get_name(struct pipe_screen *_screen)
+galahad_screen_get_name(const struct pipe_screen *_screen)
 {
-   struct galahad_screen *glhd_screen = galahad_screen(_screen);
+   const struct galahad_screen *glhd_screen = galahad_screen_const(_screen);
    struct pipe_screen *screen = glhd_screen->screen;
 
    return screen->get_name(screen);
 }
 
 static const char *
-galahad_screen_get_vendor(struct pipe_screen *_screen)
+galahad_screen_get_vendor(const struct pipe_screen *_screen)
 {
-   struct galahad_screen *glhd_screen = galahad_screen(_screen);
+   const struct galahad_screen *glhd_screen = galahad_screen_const(_screen);
    struct pipe_screen *screen = glhd_screen->screen;
 
    return screen->get_vendor(screen);
 }
 
 static int
-galahad_screen_get_param(struct pipe_screen *_screen,
+galahad_screen_get_param(const struct pipe_screen *_screen,
                           enum pipe_cap param)
 {
-   struct galahad_screen *glhd_screen = galahad_screen(_screen);
+   const struct galahad_screen *glhd_screen = galahad_screen_const(_screen);
    struct pipe_screen *screen = glhd_screen->screen;
 
    return screen->get_param(screen,
@@ -81,10 +81,10 @@ galahad_screen_get_param(struct pipe_screen *_screen,
 }
 
 static int
-galahad_screen_get_shader_param(struct pipe_screen *_screen,
+galahad_screen_get_shader_param(const struct pipe_screen *_screen,
                           unsigned shader, enum pipe_shader_cap param)
 {
-   struct galahad_screen *glhd_screen = galahad_screen(_screen);
+   const struct galahad_screen *glhd_screen = galahad_screen_const(_screen);
    struct pipe_screen *screen = glhd_screen->screen;
 
    return screen->get_shader_param(screen, shader,
@@ -92,10 +92,10 @@ galahad_screen_get_shader_param(struct pipe_screen *_screen,
 }
 
 static float
-galahad_screen_get_paramf(struct pipe_screen *_screen,
+galahad_screen_get_paramf(const struct pipe_screen *_screen,
                            enum pipe_capf param)
 {
-   struct galahad_screen *glhd_screen = galahad_screen(_screen);
+   const struct galahad_screen *glhd_screen = galahad_screen_const(_screen);
    struct pipe_screen *screen = glhd_screen->screen;
 
    return screen->get_paramf(screen,
diff --git a/src/gallium/drivers/galahad/glhd_screen.h b/src/gallium/drivers/galahad/glhd_screen.h
index 7862f4a..8b4ff03 100644
--- a/src/gallium/drivers/galahad/glhd_screen.h
+++ b/src/gallium/drivers/galahad/glhd_screen.h
@@ -45,4 +45,11 @@ galahad_screen(struct pipe_screen *screen)
    return (struct galahad_screen *)screen;
 }
 
+static INLINE const struct galahad_screen *
+galahad_screen_const(const struct pipe_screen *screen)
+{
+   return (const struct galahad_screen *)screen;
+}
+
+
 #endif /* GLHD_SCREEN_H */
diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
index 3c751c5..9139644 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -48,18 +48,18 @@
 
 
 static const char *
-i915_get_vendor(struct pipe_screen *screen)
+i915_get_vendor(const struct pipe_screen *screen)
 {
    return "VMware, Inc.";
 }
 
 static const char *
-i915_get_name(struct pipe_screen *screen)
+i915_get_name(const struct pipe_screen *screen)
 {
    static char buffer[128];
    const char *chipset;
 
-   switch (i915_screen(screen)->iws->pci_id) {
+   switch (i915_screen_const(screen)->iws->pci_id) {
    case PCI_CHIP_I915_G:
       chipset = "915G";
       break;
@@ -100,7 +100,7 @@ i915_get_name(struct pipe_screen *screen)
 }
 
 static int
-i915_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap cap)
+i915_get_shader_param(const struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap cap)
 {
    switch(shader) {
    case PIPE_SHADER_VERTEX:
@@ -164,9 +164,9 @@ i915_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_sha
 }
 
 static int
-i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
+i915_get_param(const struct pipe_screen *screen, enum pipe_cap cap)
 {
-   struct i915_screen *is = i915_screen(screen);
+   const struct i915_screen *is = i915_screen_const(screen);
 
    switch (cap) {
    /* Supported features (boolean caps). */
@@ -271,7 +271,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
 }
 
 static float
-i915_get_paramf(struct pipe_screen *screen, enum pipe_capf cap)
+i915_get_paramf(const struct pipe_screen *screen, enum pipe_capf cap)
 {
    switch(cap) {
    case PIPE_CAPF_MAX_LINE_WIDTH:
diff --git a/src/gallium/drivers/i915/i915_screen.h b/src/gallium/drivers/i915/i915_screen.h
index 9f2004e..89eabe5 100644
--- a/src/gallium/drivers/i915/i915_screen.h
+++ b/src/gallium/drivers/i915/i915_screen.h
@@ -65,6 +65,12 @@ i915_screen(struct pipe_screen *pscreen)
    return (struct i915_screen *) pscreen;
 }
 
+static INLINE const struct i915_screen *
+i915_screen_const(const struct pipe_screen *pscreen)
+{
+   return (const struct i915_screen *) pscreen;
+}
+
 boolean
 i915_is_format_supported(struct pipe_screen *screen,
                          enum pipe_format format,
diff --git a/src/gallium/drivers/identity/id_screen.c b/src/gallium/drivers/identity/id_screen.c
index 26df7f6..884d195 100644
--- a/src/gallium/drivers/identity/id_screen.c
+++ b/src/gallium/drivers/identity/id_screen.c
@@ -48,28 +48,28 @@ identity_screen_destroy(struct pipe_screen *_screen)
 }
 
 static const char *
-identity_screen_get_name(struct pipe_screen *_screen)
+identity_screen_get_name(const struct pipe_screen *_screen)
 {
-   struct identity_screen *id_screen = identity_screen(_screen);
+   const struct identity_screen *id_screen = identity_screen_const(_screen);
    struct pipe_screen *screen = id_screen->screen;
 
    return screen->get_name(screen);
 }
 
 static const char *
-identity_screen_get_vendor(struct pipe_screen *_screen)
+identity_screen_get_vendor(const struct pipe_screen *_screen)
 {
-   struct identity_screen *id_screen = identity_screen(_screen);
+   const struct identity_screen *id_screen = identity_screen_const(_screen);
    struct pipe_screen *screen = id_screen->screen;
 
    return screen->get_vendor(screen);
 }
 
 static int
-identity_screen_get_param(struct pipe_screen *_screen,
+identity_screen_get_param(const struct pipe_screen *_screen,
                           enum pipe_cap param)
 {
-   struct identity_screen *id_screen = identity_screen(_screen);
+   const struct identity_screen *id_screen = identity_screen_const(_screen);
    struct pipe_screen *screen = id_screen->screen;
 
    return screen->get_param(screen,
@@ -77,10 +77,10 @@ identity_screen_get_param(struct pipe_screen *_screen,
 }
 
 static int
-identity_screen_get_shader_param(struct pipe_screen *_screen,
+identity_screen_get_shader_param(const struct pipe_screen *_screen,
                           unsigned shader, enum pipe_shader_cap param)
 {
-   struct identity_screen *id_screen = identity_screen(_screen);
+   const struct identity_screen *id_screen = identity_screen_const(_screen);
    struct pipe_screen *screen = id_screen->screen;
 
    return screen->get_shader_param(screen, shader,
@@ -88,10 +88,10 @@ identity_screen_get_shader_param(struct pipe_screen *_screen,
 }
 
 static float
-identity_screen_get_paramf(struct pipe_screen *_screen,
+identity_screen_get_paramf(const struct pipe_screen *_screen,
                            enum pipe_capf param)
 {
-   struct identity_screen *id_screen = identity_screen(_screen);
+   const struct identity_screen *id_screen = identity_screen_const(_screen);
    struct pipe_screen *screen = id_screen->screen;
 
    return screen->get_paramf(screen,
diff --git a/src/gallium/drivers/identity/id_screen.h b/src/gallium/drivers/identity/id_screen.h
index 2c4f129..3fbca36 100644
--- a/src/gallium/drivers/identity/id_screen.h
+++ b/src/gallium/drivers/identity/id_screen.h
@@ -45,4 +45,10 @@ identity_screen(struct pipe_screen *screen)
    return (struct identity_screen *)screen;
 }
 
+static INLINE const struct identity_screen *
+identity_screen_const(const struct pipe_screen *screen)
+{
+   return (const struct identity_screen *)screen;
+}
+
 #endif /* ID_SCREEN_H */
diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c
index 1e3d096..7b78cca 100644
--- a/src/gallium/drivers/ilo/ilo_screen.c
+++ b/src/gallium/drivers/ilo/ilo_screen.c
@@ -52,7 +52,7 @@ static const struct debug_named_value ilo_debug_flags[] = {
 };
 
 static float
-ilo_get_paramf(struct pipe_screen *screen, enum pipe_capf param)
+ilo_get_paramf(const struct pipe_screen *screen, enum pipe_capf param)
 {
    switch (param) {
    case PIPE_CAPF_MAX_LINE_WIDTH:
@@ -86,7 +86,7 @@ ilo_get_paramf(struct pipe_screen *screen, enum pipe_capf param)
 }
 
 static int
-ilo_get_shader_param(struct pipe_screen *screen, unsigned shader,
+ilo_get_shader_param(const struct pipe_screen *screen, unsigned shader,
                      enum pipe_shader_cap param)
 {
    switch (shader) {
@@ -150,7 +150,7 @@ ilo_get_shader_param(struct pipe_screen *screen, unsigned shader,
 }
 
 static int
-ilo_get_video_param(struct pipe_screen *screen,
+ilo_get_video_param(const struct pipe_screen *screen,
                     enum pipe_video_profile profile,
                     enum pipe_video_cap param)
 {
@@ -177,7 +177,7 @@ ilo_get_video_param(struct pipe_screen *screen,
 }
 
 static int
-ilo_get_compute_param(struct pipe_screen *screen,
+ilo_get_compute_param(const struct pipe_screen *screen,
                       enum pipe_compute_cap param,
                       void *ret)
 {
@@ -276,9 +276,9 @@ ilo_get_compute_param(struct pipe_screen *screen,
 }
 
 static int
-ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
+ilo_get_param(const struct pipe_screen *screen, enum pipe_cap param)
 {
-   struct ilo_screen *is = ilo_screen(screen);
+   const struct ilo_screen *is = ilo_screen_const(screen);
 
    switch (param) {
    case PIPE_CAP_NPOT_TEXTURES:
@@ -427,15 +427,15 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
 }
 
 static const char *
-ilo_get_vendor(struct pipe_screen *screen)
+ilo_get_vendor(const struct pipe_screen *screen)
 {
    return "LunarG, Inc.";
 }
 
 static const char *
-ilo_get_name(struct pipe_screen *screen)
+ilo_get_name(const struct pipe_screen *screen)
 {
-   struct ilo_screen *is = ilo_screen(screen);
+   const struct ilo_screen *is = ilo_screen_const(screen);
    const char *chipset;
 
    /* stolen from classic i965 */
diff --git a/src/gallium/drivers/ilo/ilo_screen.h b/src/gallium/drivers/ilo/ilo_screen.h
index 4c403f0..37f63a0 100644
--- a/src/gallium/drivers/ilo/ilo_screen.h
+++ b/src/gallium/drivers/ilo/ilo_screen.h
@@ -54,6 +54,12 @@ ilo_screen(struct pipe_screen *screen)
    return (struct ilo_screen *) screen;
 }
 
+static inline const struct ilo_screen *
+ilo_screen_const(const struct pipe_screen *screen)
+{
+   return (struct ilo_screen *) screen;
+}
+
 static inline struct ilo_fence *
 ilo_fence(struct pipe_fence_handle *fence)
 {
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 1fed537..4b77222 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -85,14 +85,14 @@ static const struct debug_named_value lp_perf_flags[] = {
 
 
 static const char *
-llvmpipe_get_vendor(struct pipe_screen *screen)
+llvmpipe_get_vendor(const struct pipe_screen *screen)
 {
    return "VMware, Inc.";
 }
 
 
 static const char *
-llvmpipe_get_name(struct pipe_screen *screen)
+llvmpipe_get_name(const struct pipe_screen *screen)
 {
    static char buf[100];
    util_snprintf(buf, sizeof(buf), "llvmpipe (LLVM %u.%u, %u bits)",
@@ -103,7 +103,7 @@ llvmpipe_get_name(struct pipe_screen *screen)
 
 
 static int
-llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
+llvmpipe_get_param(const struct pipe_screen *screen, enum pipe_cap param)
 {
    switch (param) {
    case PIPE_CAP_MAX_COMBINED_SAMPLERS:
@@ -238,7 +238,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
 }
 
 static int
-llvmpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param)
+llvmpipe_get_shader_param(const struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param)
 {
    switch(shader)
    {
@@ -268,7 +268,7 @@ llvmpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe
 }
 
 static float
-llvmpipe_get_paramf(struct pipe_screen *screen, enum pipe_capf param)
+llvmpipe_get_paramf(const struct pipe_screen *screen, enum pipe_capf param)
 {
    switch (param) {
    case PIPE_CAPF_MAX_LINE_WIDTH:
diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c
index ac837b1..cedf8b0 100644
--- a/src/gallium/drivers/noop/noop_pipe.c
+++ b/src/gallium/drivers/noop/noop_pipe.c
@@ -292,24 +292,24 @@ static void noop_flush_frontbuffer(struct pipe_screen *_screen,
 {
 }
 
-static const char *noop_get_vendor(struct pipe_screen* pscreen)
+static const char *noop_get_vendor(const struct pipe_screen* pscreen)
 {
 	return "X.Org";
 }
 
-static const char *noop_get_name(struct pipe_screen* pscreen)
+static const char *noop_get_name(const struct pipe_screen* pscreen)
 {
 	return "NOOP";
 }
 
-static int noop_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
+static int noop_get_param(const struct pipe_screen* pscreen, enum pipe_cap param)
 {
 	struct pipe_screen *screen = ((struct noop_pipe_screen*)pscreen)->oscreen;
 
 	return screen->get_param(screen, param);
 }
 
-static float noop_get_paramf(struct pipe_screen* pscreen,
+static float noop_get_paramf(const struct pipe_screen* pscreen,
 			     enum pipe_capf param)
 {
 	struct pipe_screen *screen = ((struct noop_pipe_screen*)pscreen)->oscreen;
@@ -317,7 +317,7 @@ static float noop_get_paramf(struct pipe_screen* pscreen,
 	return screen->get_paramf(screen, param);
 }
 
-static int noop_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enum pipe_shader_cap param)
+static int noop_get_shader_param(const struct pipe_screen* pscreen, unsigned shader, enum pipe_shader_cap param)
 {
 	struct pipe_screen *screen = ((struct noop_pipe_screen*)pscreen)->oscreen;
 
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c
index d129a55..d380b86 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -28,9 +28,9 @@
 int nouveau_mesa_debug = 0;
 
 static const char *
-nouveau_screen_get_name(struct pipe_screen *pscreen)
+nouveau_screen_get_name(const struct pipe_screen *pscreen)
 {
-	struct nouveau_device *dev = nouveau_screen(pscreen)->device;
+	struct nouveau_device *dev = nouveau_screen_const(pscreen)->device;
 	static char buffer[128];
 
 	util_snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset);
@@ -38,7 +38,7 @@ nouveau_screen_get_name(struct pipe_screen *pscreen)
 }
 
 static const char *
-nouveau_screen_get_vendor(struct pipe_screen *pscreen)
+nouveau_screen_get_vendor(const struct pipe_screen *pscreen)
 {
 	return "nouveau";
 }
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.h b/src/gallium/drivers/nouveau/nouveau_screen.h
index 7f15d10..e941450 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.h
+++ b/src/gallium/drivers/nouveau/nouveau_screen.h
@@ -107,6 +107,12 @@ nouveau_screen(struct pipe_screen *pscreen)
 	return (struct nouveau_screen *)pscreen;
 }
 
+static INLINE const struct nouveau_screen *
+nouveau_screen_const(const struct pipe_screen *pscreen)
+{
+	return (const struct nouveau_screen *)pscreen;
+}
+
 boolean
 nouveau_screen_bo_get_handle(struct pipe_screen *pscreen,
 			     struct nouveau_bo *bo,
diff --git a/src/gallium/drivers/nouveau/nouveau_video.c b/src/gallium/drivers/nouveau/nouveau_video.c
index 9357508..69efcfd 100644
--- a/src/gallium/drivers/nouveau/nouveau_video.c
+++ b/src/gallium/drivers/nouveau/nouveau_video.c
@@ -842,7 +842,7 @@ error:
 }
 
 static int
-nouveau_screen_get_video_param(struct pipe_screen *pscreen,
+nouveau_screen_get_video_param(const struct pipe_screen *pscreen,
                                enum pipe_video_profile profile,
                                enum pipe_video_cap param)
 {
diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c
index 07ffc80..3d173d5 100644
--- a/src/gallium/drivers/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nv30/nv30_screen.c
@@ -45,9 +45,9 @@
 #define CURIE_4497_CHIPSET6X 0x00000088
 
 static int
-nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
+nv30_screen_get_param(const struct pipe_screen *pscreen, enum pipe_cap param)
 {
-   struct nv30_screen *screen = nv30_screen(pscreen);
+   const struct nv30_screen *screen = nv30_screen_const(pscreen);
    struct nouveau_object *eng3d = screen->eng3d;
 
    switch (param) {
@@ -137,9 +137,9 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
 }
 
 static float
-nv30_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_capf param)
+nv30_screen_get_paramf(const struct pipe_screen *pscreen, enum pipe_capf param)
 {
-   struct nv30_screen *screen = nv30_screen(pscreen);
+   const struct nv30_screen *screen = nv30_screen_const(pscreen);
    struct nouveau_object *eng3d = screen->eng3d;
 
    switch (param) {
@@ -160,10 +160,10 @@ nv30_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_capf param)
 }
 
 static int
-nv30_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
+nv30_screen_get_shader_param(const struct pipe_screen *pscreen, unsigned shader,
                              enum pipe_shader_cap param)
 {
-   struct nv30_screen *screen = nv30_screen(pscreen);
+   const struct nv30_screen *screen = nv30_screen_const(pscreen);
    struct nouveau_object *eng3d = screen->eng3d;
 
    switch (shader) {
diff --git a/src/gallium/drivers/nv30/nv30_screen.h b/src/gallium/drivers/nv30/nv30_screen.h
index 2ee087e..663acfe 100644
--- a/src/gallium/drivers/nv30/nv30_screen.h
+++ b/src/gallium/drivers/nv30/nv30_screen.h
@@ -48,4 +48,10 @@ nv30_screen(struct pipe_screen *pscreen)
    return (struct nv30_screen *)pscreen;
 }
 
+static INLINE const struct nv30_screen *
+nv30_screen_const(const struct pipe_screen *pscreen)
+{
+   return (const struct nv30_screen *)pscreen;
+}
+
 #endif
diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c
index 5c57aa2..5ccf1b7 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -78,9 +78,9 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen,
 }
 
 static int
-nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
+nv50_screen_get_param(const struct pipe_screen *pscreen, enum pipe_cap param)
 {
-   const uint16_t class_3d = nouveau_screen(pscreen)->class_3d;
+   const uint16_t class_3d = nouveau_screen_const(pscreen)->class_3d;
 
    switch (param) {
    case PIPE_CAP_MAX_COMBINED_SAMPLERS:
@@ -108,7 +108,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE:
       return 65536;
    case PIPE_CAP_SEAMLESS_CUBE_MAP:
-      return nv50_screen(pscreen)->tesla->oclass >= NVA0_3D_CLASS;
+      return nv50_screen_const(pscreen)->tesla->oclass >= NVA0_3D_CLASS;
    case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
       return 0;
    case PIPE_CAP_CUBE_MAP_ARRAY:
@@ -147,7 +147,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_INDEP_BLEND_ENABLE:
       return 1;
    case PIPE_CAP_INDEP_BLEND_FUNC:
-      return nv50_screen(pscreen)->tesla->oclass >= NVA3_3D_CLASS;
+      return nv50_screen_const(pscreen)->tesla->oclass >= NVA3_3D_CLASS;
    case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
    case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
       return 1;
@@ -196,7 +196,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
 }
 
 static int
-nv50_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
+nv50_screen_get_shader_param(const struct pipe_screen *pscreen, unsigned shader,
                              enum pipe_shader_cap param)
 {
    switch (shader) {
@@ -235,7 +235,7 @@ nv50_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
    case PIPE_SHADER_CAP_MAX_PREDS:
       return 0;
    case PIPE_SHADER_CAP_MAX_TEMPS:
-      return nv50_screen(pscreen)->max_tls_space / ONE_TEMP_SIZE;
+      return nv50_screen_const(pscreen)->max_tls_space / ONE_TEMP_SIZE;
    case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
       return 1;
    case PIPE_SHADER_CAP_TGSI_SQRT_SUPPORTED:
@@ -253,7 +253,7 @@ nv50_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
 }
 
 static float
-nv50_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_capf param)
+nv50_screen_get_paramf(const struct pipe_screen *pscreen, enum pipe_capf param)
 {
    switch (param) {
    case PIPE_CAPF_MAX_LINE_WIDTH:
diff --git a/src/gallium/drivers/nv50/nv50_screen.h b/src/gallium/drivers/nv50/nv50_screen.h
index 2e8af43..bb99854 100644
--- a/src/gallium/drivers/nv50/nv50_screen.h
+++ b/src/gallium/drivers/nv50/nv50_screen.h
@@ -75,6 +75,12 @@ nv50_screen(struct pipe_screen *screen)
    return (struct nv50_screen *)screen;
 }
 
+static INLINE const struct nv50_screen *
+nv50_screen_const(const struct pipe_screen *screen)
+{
+   return (const struct nv50_screen *)screen;
+}
+
 boolean nv50_blitter_create(struct nv50_screen *);
 void nv50_blitter_destroy(struct nv50_screen *);
 
diff --git a/src/gallium/drivers/nvc0/nvc0_context.h b/src/gallium/drivers/nvc0/nvc0_context.h
index 0431b89..f62f147 100644
--- a/src/gallium/drivers/nvc0/nvc0_context.h
+++ b/src/gallium/drivers/nvc0/nvc0_context.h
@@ -347,7 +347,7 @@ nvc0_video_buffer_create(struct pipe_context *pipe,
                          const struct pipe_video_buffer *templat);
 
 int
-nvc0_screen_get_video_param(struct pipe_screen *pscreen,
+nvc0_screen_get_video_param(const struct pipe_screen *pscreen,
                             enum pipe_video_profile profile,
                             enum pipe_video_cap param);
 
diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c b/src/gallium/drivers/nvc0/nvc0_screen.c
index b5abee3..370770f 100644
--- a/src/gallium/drivers/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nvc0/nvc0_screen.c
@@ -76,9 +76,9 @@ nvc0_screen_video_supported(struct pipe_screen *screen,
 
 
 static int
-nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
+nvc0_screen_get_param(const struct pipe_screen *pscreen, enum pipe_cap param)
 {
-   const uint16_t class_3d = nouveau_screen(pscreen)->class_3d;
+   const uint16_t class_3d = nouveau_screen_const(pscreen)->class_3d;
 
    switch (param) {
    case PIPE_CAP_MAX_COMBINED_SAMPLERS:
@@ -186,10 +186,10 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
 }
 
 static int
-nvc0_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
+nvc0_screen_get_shader_param(const struct pipe_screen *pscreen, unsigned shader,
                              enum pipe_shader_cap param)
 {
-   const uint16_t class_3d = nouveau_screen(pscreen)->class_3d;
+   const uint16_t class_3d = nouveau_screen_const(pscreen)->class_3d;
 
    switch (shader) {
    case PIPE_SHADER_VERTEX:
@@ -271,7 +271,7 @@ nvc0_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
 }
 
 static float
-nvc0_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_capf param)
+nvc0_screen_get_paramf(const struct pipe_screen *pscreen, enum pipe_capf param)
 {
    switch (param) {
    case PIPE_CAPF_MAX_LINE_WIDTH:
@@ -292,11 +292,11 @@ nvc0_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_capf param)
 }
 
 static int
-nvc0_screen_get_compute_param(struct pipe_screen *pscreen,
+nvc0_screen_get_compute_param(const struct pipe_screen *pscreen,
                               enum pipe_compute_cap param, void *data)
 {
    uint64_t *data64 = (uint64_t *)data;
-   const uint16_t obj_class = nvc0_screen(pscreen)->compute->oclass;
+   const uint16_t obj_class = nvc0_screen_const(pscreen)->compute->oclass;
 
    switch (param) {
    case PIPE_COMPUTE_CAP_GRID_DIMENSION:
diff --git a/src/gallium/drivers/nvc0/nvc0_screen.h b/src/gallium/drivers/nvc0/nvc0_screen.h
index 826014e..6e054db 100644
--- a/src/gallium/drivers/nvc0/nvc0_screen.h
+++ b/src/gallium/drivers/nvc0/nvc0_screen.h
@@ -84,6 +84,13 @@ nvc0_screen(struct pipe_screen *screen)
    return (struct nvc0_screen *)screen;
 }
 
+static INLINE const struct nvc0_screen *
+nvc0_screen_const(const struct pipe_screen *screen)
+{
+   return (const struct nvc0_screen *)screen;
+}
+
+
 
 /* Performance counter queries:
  */
diff --git a/src/gallium/drivers/nvc0/nvc0_video.c b/src/gallium/drivers/nvc0/nvc0_video.c
index ad40b94..50a0f3e 100644
--- a/src/gallium/drivers/nvc0/nvc0_video.c
+++ b/src/gallium/drivers/nvc0/nvc0_video.c
@@ -29,7 +29,7 @@
 #include <fcntl.h>
 
 int
-nvc0_screen_get_video_param(struct pipe_screen *pscreen,
+nvc0_screen_get_video_param(const struct pipe_screen *pscreen,
                             enum pipe_video_profile profile,
                             enum pipe_video_cap param)
 {
@@ -40,7 +40,7 @@ nvc0_screen_get_video_param(struct pipe_screen *pscreen,
       return 1;
    case PIPE_VIDEO_CAP_MAX_WIDTH:
    case PIPE_VIDEO_CAP_MAX_HEIGHT:
-      return nouveau_screen(pscreen)->device->chipset < 0xd0 ? 2048 : 4096;
+      return nouveau_screen_const(pscreen)->device->chipset < 0xd0 ? 2048 : 4096;
    case PIPE_VIDEO_CAP_PREFERED_FORMAT:
       return PIPE_FORMAT_NV12;
    case PIPE_VIDEO_CAP_SUPPORTS_INTERLACED:
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index 9c5d5f2..d5e54db 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -42,7 +42,7 @@
  * ...I should have just put "Corbin Simpson", but I'm not that cool.
  *
  * (Or egotistical. Yet.) */
-static const char* r300_get_vendor(struct pipe_screen* pscreen)
+static const char* r300_get_vendor(const struct pipe_screen* pscreen)
 {
     return "X.Org R300 Project";
 }
@@ -74,16 +74,16 @@ static const char* chip_families[] = {
     "ATI RV570"
 };
 
-static const char* r300_get_name(struct pipe_screen* pscreen)
+static const char* r300_get_name(const struct pipe_screen* pscreen)
 {
-    struct r300_screen* r300screen = r300_screen(pscreen);
+    const struct r300_screen* r300screen = r300_screen_const(pscreen);
 
     return chip_families[r300screen->caps.family];
 }
 
-static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
+static int r300_get_param(const struct pipe_screen* pscreen, enum pipe_cap param)
 {
-    struct r300_screen* r300screen = r300_screen(pscreen);
+    const struct r300_screen* r300screen = r300_screen_const(pscreen);
     boolean is_r500 = r300screen->caps.is_r500;
 
     switch (param) {
@@ -194,9 +194,9 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
     return 0;
 }
 
-static int r300_get_shader_param(struct pipe_screen *pscreen, unsigned shader, enum pipe_shader_cap param)
+static int r300_get_shader_param(const struct pipe_screen *pscreen, unsigned shader, enum pipe_shader_cap param)
 {
-   struct r300_screen* r300screen = r300_screen(pscreen);
+   const struct r300_screen* r300screen = r300_screen_const(pscreen);
    boolean is_r400 = r300screen->caps.is_r400;
    boolean is_r500 = r300screen->caps.is_r500;
 
@@ -300,10 +300,10 @@ static int r300_get_shader_param(struct pipe_screen *pscreen, unsigned shader, e
     return 0;
 }
 
-static float r300_get_paramf(struct pipe_screen* pscreen,
+static float r300_get_paramf(const struct pipe_screen* pscreen,
                              enum pipe_capf param)
 {
-    struct r300_screen* r300screen = r300_screen(pscreen);
+    const struct r300_screen* r300screen = r300_screen_const(pscreen);
 
     switch (param) {
         case PIPE_CAPF_MAX_LINE_WIDTH:
@@ -337,7 +337,7 @@ static float r300_get_paramf(struct pipe_screen* pscreen,
     }
 }
 
-static int r300_get_video_param(struct pipe_screen *screen,
+static int r300_get_video_param(const struct pipe_screen *screen,
 				enum pipe_video_profile profile,
 				enum pipe_video_cap param)
 {
diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h
index e129cee..85d68d4 100644
--- a/src/gallium/drivers/r300/r300_screen.h
+++ b/src/gallium/drivers/r300/r300_screen.h
@@ -55,6 +55,11 @@ static INLINE struct r300_screen* r300_screen(struct pipe_screen* screen) {
     return (struct r300_screen*)screen;
 }
 
+static INLINE const struct r300_screen* r300_screen_const(
+                                        const struct pipe_screen* screen) {
+    return (const struct r300_screen*)screen;
+}
+
 static INLINE struct radeon_winsys *
 radeon_winsys(struct pipe_screen *screen) {
     return r300_screen(screen)->rws;
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index a4e88ce..cd01948 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -508,7 +508,7 @@ fail:
 /*
  * pipe_screen
  */
-static const char* r600_get_vendor(struct pipe_screen* pscreen)
+static const char* r600_get_vendor(const struct pipe_screen* pscreen)
 {
 	return "X.Org";
 }
@@ -545,16 +545,16 @@ static const char *r600_get_family_name(enum radeon_family family)
 	}
 }
 
-static const char* r600_get_name(struct pipe_screen* pscreen)
+static const char* r600_get_name(const struct pipe_screen* pscreen)
 {
 	struct r600_screen *rscreen = (struct r600_screen *)pscreen;
 
 	return r600_get_family_name(rscreen->family);
 }
 
-static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
+static int r600_get_param(const struct pipe_screen* pscreen, enum pipe_cap param)
 {
-	struct r600_screen *rscreen = (struct r600_screen *)pscreen;
+	const struct r600_screen *rscreen = (const struct r600_screen *)pscreen;
 	enum radeon_family family = rscreen->family;
 
 	switch (param) {
@@ -682,7 +682,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
 	return 0;
 }
 
-static float r600_get_paramf(struct pipe_screen* pscreen,
+static float r600_get_paramf(const struct pipe_screen* pscreen,
 			     enum pipe_capf param)
 {
 	struct r600_screen *rscreen = (struct r600_screen *)pscreen;
@@ -710,7 +710,7 @@ static float r600_get_paramf(struct pipe_screen* pscreen,
 	return 0.0f;
 }
 
-static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enum pipe_shader_cap param)
+static int r600_get_shader_param(const struct pipe_screen* pscreen, unsigned shader, enum pipe_shader_cap param)
 {
 	switch(shader)
 	{
@@ -772,7 +772,7 @@ static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, e
 	return 0;
 }
 
-static int r600_get_video_param(struct pipe_screen *screen,
+static int r600_get_video_param(const struct pipe_screen *screen,
 				enum pipe_video_profile profile,
 				enum pipe_video_cap param)
 {
@@ -865,7 +865,7 @@ const char * r600_llvm_gpu_string(enum radeon_family family)
 }
 
 
-static int r600_get_compute_param(struct pipe_screen *screen,
+static int r600_get_compute_param(const struct pipe_screen *screen,
         enum pipe_compute_cap param,
         void *ret)
 {
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index 3fad311..bc9bca2 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -899,7 +899,7 @@ struct pipe_video_decoder *r600_uvd_create_decoder(struct pipe_context *context,
 struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe,
 						   const struct pipe_video_buffer *tmpl);
 
-int r600_uvd_get_video_param(struct pipe_screen *screen,
+int r600_uvd_get_video_param(const struct pipe_screen *screen,
 			     enum pipe_video_profile profile,
 			     enum pipe_video_cap param);
 
diff --git a/src/gallium/drivers/r600/r600_uvd.c b/src/gallium/drivers/r600/r600_uvd.c
index a077a50..9339b5e 100644
--- a/src/gallium/drivers/r600/r600_uvd.c
+++ b/src/gallium/drivers/r600/r600_uvd.c
@@ -178,7 +178,7 @@ struct pipe_video_decoder *r600_uvd_create_decoder(struct pipe_context *context,
 				   ctx->ws, r600_uvd_set_dtb);
 }
 
-int r600_uvd_get_video_param(struct pipe_screen *screen,
+int r600_uvd_get_video_param(const struct pipe_screen *screen,
 			     enum pipe_video_profile profile,
 			     enum pipe_video_cap param)
 {
diff --git a/src/gallium/drivers/radeon/radeon_uvd.c b/src/gallium/drivers/radeon/radeon_uvd.c
index caf3e90..1c6a66b 100644
--- a/src/gallium/drivers/radeon/radeon_uvd.c
+++ b/src/gallium/drivers/radeon/radeon_uvd.c
@@ -1081,7 +1081,7 @@ void ruvd_set_dt_surfaces(struct ruvd_msg *msg, struct radeon_surface *luma,
 	msg->body.decode.dt_surf_tile_config |= RUVD_MACRO_TILE_ASPECT_RATIO(macro_tile_aspect(luma->mtilea));
 }
 
-int ruvd_get_video_param(struct pipe_screen *screen,
+int ruvd_get_video_param(const struct pipe_screen *screen,
 			 enum pipe_video_profile profile,
 			 enum pipe_video_cap param)
 {
diff --git a/src/gallium/drivers/radeon/radeon_uvd.h b/src/gallium/drivers/radeon/radeon_uvd.h
index 1e97425..710162f 100644
--- a/src/gallium/drivers/radeon/radeon_uvd.h
+++ b/src/gallium/drivers/radeon/radeon_uvd.h
@@ -365,7 +365,7 @@ void ruvd_set_dt_surfaces(struct ruvd_msg *msg, struct radeon_surface *luma,
 			  struct radeon_surface *chroma);
 
 /* returns supported codecs and other parameters */
-int ruvd_get_video_param(struct pipe_screen *screen,
+int ruvd_get_video_param(const struct pipe_screen *screen,
 			 enum pipe_video_profile profile,
 			 enum pipe_video_cap param);
 
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.c b/src/gallium/drivers/radeonsi/radeonsi_pipe.c
index 463cc72..9d8d600 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pipe.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.c
@@ -286,7 +286,7 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
 /*
  * pipe_screen
  */
-static const char* r600_get_vendor(struct pipe_screen* pscreen)
+static const char* r600_get_vendor(const struct pipe_screen* pscreen)
 {
 	return "X.Org";
 }
@@ -321,16 +321,16 @@ static const char *r600_get_family_name(enum radeon_family family)
 	}
 }
 
-static const char* r600_get_name(struct pipe_screen* pscreen)
+static const char* r600_get_name(const struct pipe_screen* pscreen)
 {
-	struct r600_screen *rscreen = (struct r600_screen *)pscreen;
+	const struct r600_screen *rscreen = (const struct r600_screen *)pscreen;
 
 	return r600_get_family_name(rscreen->family);
 }
 
-static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
+static int r600_get_param(const struct pipe_screen* pscreen, enum pipe_cap param)
 {
-	struct r600_screen *rscreen = (struct r600_screen *)pscreen;
+	const struct r600_screen *rscreen = (const struct r600_screen *)pscreen;
 
 	switch (param) {
 	/* Supported features (boolean caps). */
@@ -444,7 +444,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
 	return 0;
 }
 
-static float r600_get_paramf(struct pipe_screen* pscreen,
+static float r600_get_paramf(const struct pipe_screen* pscreen,
 			     enum pipe_capf param)
 {
 	switch (param) {
@@ -466,7 +466,7 @@ static float r600_get_paramf(struct pipe_screen* pscreen,
 	return 0.0f;
 }
 
-static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enum pipe_shader_cap param)
+static int r600_get_shader_param(const struct pipe_screen* pscreen, unsigned shader, enum pipe_shader_cap param)
 {
 	switch(shader)
 	{
@@ -530,7 +530,7 @@ static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, e
 	return 0;
 }
 
-static int r600_get_video_param(struct pipe_screen *screen,
+static int r600_get_video_param(const struct pipe_screen *screen,
 				enum pipe_video_profile profile,
 				enum pipe_video_cap param)
 {
@@ -549,11 +549,11 @@ static int r600_get_video_param(struct pipe_screen *screen,
 	}
 }
 
-static int r600_get_compute_param(struct pipe_screen *screen,
+static int r600_get_compute_param(const struct pipe_screen *screen,
         enum pipe_compute_cap param,
         void *ret)
 {
-	struct r600_screen *rscreen = (struct r600_screen *)screen;
+	const struct r600_screen *rscreen = (const struct r600_screen *)screen;
 	//TODO: select these params by asic
 	switch (param) {
 	case PIPE_COMPUTE_CAP_IR_TARGET: {
diff --git a/src/gallium/drivers/rbug/rbug_screen.c b/src/gallium/drivers/rbug/rbug_screen.c
index 2471fdb..ec79317 100644
--- a/src/gallium/drivers/rbug/rbug_screen.c
+++ b/src/gallium/drivers/rbug/rbug_screen.c
@@ -51,28 +51,28 @@ rbug_screen_destroy(struct pipe_screen *_screen)
 }
 
 static const char *
-rbug_screen_get_name(struct pipe_screen *_screen)
+rbug_screen_get_name(const struct pipe_screen *_screen)
 {
-   struct rbug_screen *rb_screen = rbug_screen(_screen);
+   const struct rbug_screen *rb_screen = rbug_screen_const(_screen);
    struct pipe_screen *screen = rb_screen->screen;
 
    return screen->get_name(screen);
 }
 
 static const char *
-rbug_screen_get_vendor(struct pipe_screen *_screen)
+rbug_screen_get_vendor(const struct pipe_screen *_screen)
 {
-   struct rbug_screen *rb_screen = rbug_screen(_screen);
+   const struct rbug_screen *rb_screen = rbug_screen_const(_screen);
    struct pipe_screen *screen = rb_screen->screen;
 
    return screen->get_vendor(screen);
 }
 
 static int
-rbug_screen_get_param(struct pipe_screen *_screen,
+rbug_screen_get_param(const struct pipe_screen *_screen,
                       enum pipe_cap param)
 {
-   struct rbug_screen *rb_screen = rbug_screen(_screen);
+   const struct rbug_screen *rb_screen = rbug_screen_const(_screen);
    struct pipe_screen *screen = rb_screen->screen;
 
    return screen->get_param(screen,
@@ -80,10 +80,10 @@ rbug_screen_get_param(struct pipe_screen *_screen,
 }
 
 static int
-rbug_screen_get_shader_param(struct pipe_screen *_screen,
+rbug_screen_get_shader_param(const struct pipe_screen *_screen,
                       unsigned shader, enum pipe_shader_cap param)
 {
-   struct rbug_screen *rb_screen = rbug_screen(_screen);
+   const struct rbug_screen *rb_screen = rbug_screen_const(_screen);
    struct pipe_screen *screen = rb_screen->screen;
 
    return screen->get_shader_param(screen, shader,
@@ -91,10 +91,10 @@ rbug_screen_get_shader_param(struct pipe_screen *_screen,
 }
 
 static float
-rbug_screen_get_paramf(struct pipe_screen *_screen,
+rbug_screen_get_paramf(const struct pipe_screen *_screen,
                        enum pipe_capf param)
 {
-   struct rbug_screen *rb_screen = rbug_screen(_screen);
+   const struct rbug_screen *rb_screen = rbug_screen_const(_screen);
    struct pipe_screen *screen = rb_screen->screen;
 
    return screen->get_paramf(screen,
diff --git a/src/gallium/drivers/rbug/rbug_screen.h b/src/gallium/drivers/rbug/rbug_screen.h
index a53afac..9a00c26 100644
--- a/src/gallium/drivers/rbug/rbug_screen.h
+++ b/src/gallium/drivers/rbug/rbug_screen.h
@@ -66,6 +66,13 @@ rbug_screen(struct pipe_screen *screen)
    return (struct rbug_screen *)screen;
 }
 
+static INLINE const struct rbug_screen *
+rbug_screen_const(const struct pipe_screen *screen)
+{
+   return (const struct rbug_screen *)screen;
+}
+
+
 #define rbug_screen_add_to_list(scr, name, obj) \
    do {                                          \
       pipe_mutex_lock(scr->list_mutex);          \
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index 2abfe89..b8acda5 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -49,21 +49,21 @@
 DEBUG_GET_ONCE_BOOL_OPTION(use_llvm, "SOFTPIPE_USE_LLVM", FALSE)
 
 static const char *
-softpipe_get_vendor(struct pipe_screen *screen)
+softpipe_get_vendor(const struct pipe_screen *screen)
 {
    return "VMware, Inc.";
 }
 
 
 static const char *
-softpipe_get_name(struct pipe_screen *screen)
+softpipe_get_name(const struct pipe_screen *screen)
 {
    return "softpipe";
 }
 
 
 static int
-softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
+softpipe_get_param(const struct pipe_screen *screen, enum pipe_cap param)
 {
    switch (param) {
    case PIPE_CAP_MAX_COMBINED_SAMPLERS:
@@ -190,9 +190,9 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
 }
 
 static int
-softpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param)
+softpipe_get_shader_param(const struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param)
 {
-   struct softpipe_screen *sp_screen = softpipe_screen(screen);
+   const struct softpipe_screen *sp_screen = softpipe_screen_const(screen);
    switch(shader)
    {
    case PIPE_SHADER_FRAGMENT:
@@ -218,7 +218,7 @@ softpipe_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe
 }
 
 static float
-softpipe_get_paramf(struct pipe_screen *screen, enum pipe_capf param)
+softpipe_get_paramf(const struct pipe_screen *screen, enum pipe_capf param)
 {
    switch (param) {
    case PIPE_CAPF_MAX_LINE_WIDTH:
@@ -245,7 +245,7 @@ softpipe_get_paramf(struct pipe_screen *screen, enum pipe_capf param)
 }
 
 static int
-softpipe_get_video_param(struct pipe_screen *screen,
+softpipe_get_video_param(const struct pipe_screen *screen,
                          enum pipe_video_profile profile,
                          enum pipe_video_cap param)
 {
diff --git a/src/gallium/drivers/softpipe/sp_screen.h b/src/gallium/drivers/softpipe/sp_screen.h
index 007feec..2ad5ca5 100644
--- a/src/gallium/drivers/softpipe/sp_screen.h
+++ b/src/gallium/drivers/softpipe/sp_screen.h
@@ -55,6 +55,11 @@ softpipe_screen( struct pipe_screen *pipe )
    return (struct softpipe_screen *)pipe;
 }
 
+static INLINE const struct softpipe_screen *
+softpipe_screen_const( const struct pipe_screen *pipe )
+{
+   return (const struct softpipe_screen *)pipe;
+}
 
 
 #endif /* SP_SCREEN_H */
diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
index 7bf6285..f0a79d4 100644
--- a/src/gallium/drivers/svga/svga_screen.c
+++ b/src/gallium/drivers/svga/svga_screen.c
@@ -63,14 +63,14 @@ static const struct debug_named_value svga_debug_flags[] = {
 #endif
 
 static const char *
-svga_get_vendor( struct pipe_screen *pscreen )
+svga_get_vendor( const struct pipe_screen *pscreen )
 {
    return "VMware, Inc.";
 }
 
 
 static const char *
-svga_get_name( struct pipe_screen *pscreen )
+svga_get_name( const struct pipe_screen *pscreen )
 {
    const char *build = "", *llvm = "", *mutex = "";
    static char name[100];
@@ -94,9 +94,9 @@ svga_get_name( struct pipe_screen *pscreen )
 
 
 static float
-svga_get_paramf(struct pipe_screen *screen, enum pipe_capf param)
+svga_get_paramf(const struct pipe_screen *screen, enum pipe_capf param)
 {
-   struct svga_screen *svgascreen = svga_screen(screen);
+   const struct svga_screen *svgascreen = svga_screen_const(screen);
    struct svga_winsys_screen *sws = svgascreen->sws;
    SVGA3dDevCapResult result;
 
@@ -131,9 +131,9 @@ svga_get_paramf(struct pipe_screen *screen, enum pipe_capf param)
 
 
 static int
-svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
+svga_get_param(const struct pipe_screen *screen, enum pipe_cap param)
 {
-   struct svga_screen *svgascreen = svga_screen(screen);
+   const struct svga_screen *svgascreen = svga_screen_const(screen);
    struct svga_winsys_screen *sws = svgascreen->sws;
    SVGA3dDevCapResult result;
 
@@ -276,9 +276,9 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
    return 0;
 }
 
-static int svga_get_shader_param(struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param)
+static int svga_get_shader_param(const struct pipe_screen *screen, unsigned shader, enum pipe_shader_cap param)
 {
-   struct svga_screen *svgascreen = svga_screen(screen);
+   const struct svga_screen *svgascreen = svga_screen_const(screen);
    struct svga_winsys_screen *sws = svgascreen->sws;
    SVGA3dDevCapResult result;
 
@@ -680,4 +680,12 @@ svga_screen(struct pipe_screen *screen)
    assert(screen->destroy == svga_destroy_screen);
    return (struct svga_screen *)screen;
 }
+
+const struct svga_screen *
+svga_screen_const(const struct pipe_screen *screen)
+{
+   assert(screen);
+   assert(screen->destroy == svga_destroy_screen);
+   return (const struct svga_screen *)screen;
+}
 #endif
diff --git a/src/gallium/drivers/svga/svga_screen.h b/src/gallium/drivers/svga/svga_screen.h
index 77b552a..970fef2 100644
--- a/src/gallium/drivers/svga/svga_screen.h
+++ b/src/gallium/drivers/svga/svga_screen.h
@@ -85,9 +85,18 @@ svga_screen(struct pipe_screen *pscreen)
 {
    return (struct svga_screen *) pscreen;
 }
+
+static INLINE const struct svga_screen *
+svga_screen(const struct pipe_screen *pscreen)
+{
+   return (const struct svga_screen *) pscreen;
+}
 #else
 struct svga_screen *
 svga_screen(struct pipe_screen *screen);
+
+const struct svga_screen *
+svga_screen_const(const struct pipe_screen *screen);
 #endif
 
 #endif /* SVGA_SCREEN_H */
diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c
index 5281ba8..6a9234f 100644
--- a/src/gallium/drivers/trace/tr_screen.c
+++ b/src/gallium/drivers/trace/tr_screen.c
@@ -42,9 +42,9 @@
 static boolean trace = FALSE;
 
 static const char *
-trace_screen_get_name(struct pipe_screen *_screen)
+trace_screen_get_name(const struct pipe_screen *_screen)
 {
-   struct trace_screen *tr_scr = trace_screen(_screen);
+   const struct trace_screen *tr_scr = trace_screen_const(_screen);
    struct pipe_screen *screen = tr_scr->screen;
    const char *result;
 
@@ -63,9 +63,9 @@ trace_screen_get_name(struct pipe_screen *_screen)
 
 
 static const char *
-trace_screen_get_vendor(struct pipe_screen *_screen)
+trace_screen_get_vendor(const struct pipe_screen *_screen)
 {
-   struct trace_screen *tr_scr = trace_screen(_screen);
+   const struct trace_screen *tr_scr = trace_screen_const(_screen);
    struct pipe_screen *screen = tr_scr->screen;
    const char *result;
 
@@ -84,10 +84,10 @@ trace_screen_get_vendor(struct pipe_screen *_screen)
 
 
 static int
-trace_screen_get_param(struct pipe_screen *_screen,
+trace_screen_get_param(const struct pipe_screen *_screen,
                        enum pipe_cap param)
 {
-   struct trace_screen *tr_scr = trace_screen(_screen);
+   const struct trace_screen *tr_scr = trace_screen_const(_screen);
    struct pipe_screen *screen = tr_scr->screen;
    int result;
 
@@ -107,10 +107,10 @@ trace_screen_get_param(struct pipe_screen *_screen,
 
 
 static int
-trace_screen_get_shader_param(struct pipe_screen *_screen, unsigned shader,
+trace_screen_get_shader_param(const struct pipe_screen *_screen, unsigned shader,
                        enum pipe_shader_cap param)
 {
-   struct trace_screen *tr_scr = trace_screen(_screen);
+   const struct trace_screen *tr_scr = trace_screen_const(_screen);
    struct pipe_screen *screen = tr_scr->screen;
    int result;
 
@@ -131,10 +131,10 @@ trace_screen_get_shader_param(struct pipe_screen *_screen, unsigned shader,
 
 
 static float
-trace_screen_get_paramf(struct pipe_screen *_screen,
+trace_screen_get_paramf(const struct pipe_screen *_screen,
                         enum pipe_capf param)
 {
-   struct trace_screen *tr_scr = trace_screen(_screen);
+   const struct trace_screen *tr_scr = trace_screen_const(_screen);
    struct pipe_screen *screen = tr_scr->screen;
    float result;
 
@@ -508,3 +508,11 @@ trace_screen(struct pipe_screen *screen)
    assert(screen->destroy == trace_screen_destroy);
    return (struct trace_screen *)screen;
 }
+
+const struct trace_screen *
+trace_screen_const(const struct pipe_screen *screen)
+{
+   assert(screen);
+   assert(screen->destroy == trace_screen_destroy);
+   return (const struct trace_screen *)screen;
+}
diff --git a/src/gallium/drivers/trace/tr_screen.h b/src/gallium/drivers/trace/tr_screen.h
index 385015d..d0ce350 100644
--- a/src/gallium/drivers/trace/tr_screen.h
+++ b/src/gallium/drivers/trace/tr_screen.h
@@ -57,6 +57,8 @@ struct trace_screen
 struct trace_screen *
 trace_screen(struct pipe_screen *screen);
 
+const struct trace_screen *
+trace_screen_const(const struct pipe_screen *screen);
 
 #ifdef __cplusplus
 }
diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
index c487e8e..decc08e 100644
--- a/src/gallium/include/pipe/p_screen.h
+++ b/src/gallium/include/pipe/p_screen.h
@@ -66,33 +66,33 @@ struct pipe_transfer;
 struct pipe_screen {
    void (*destroy)( struct pipe_screen * );
 
-   const char *(*get_name)( struct pipe_screen * );
+   const char *(*get_name)( const struct pipe_screen * );
 
-   const char *(*get_vendor)( struct pipe_screen * );
+   const char *(*get_vendor)( const struct pipe_screen * );
 
    /**
     * Query an integer-valued capability/parameter/limit
     * \param param  one of PIPE_CAP_x
     */
-   int (*get_param)( struct pipe_screen *, enum pipe_cap param );
+   int (*get_param)( const struct pipe_screen *, enum pipe_cap param );
 
    /**
     * Query a float-valued capability/parameter/limit
     * \param param  one of PIPE_CAP_x
     */
-   float (*get_paramf)( struct pipe_screen *, enum pipe_capf param );
+   float (*get_paramf)( const struct pipe_screen *, enum pipe_capf param );
 
    /**
     * Query a per-shader-stage integer-valued capability/parameter/limit
     * \param param  one of PIPE_CAP_x
     */
-   int (*get_shader_param)( struct pipe_screen *, unsigned shader, enum pipe_shader_cap param );
+   int (*get_shader_param)( const struct pipe_screen *, unsigned shader, enum pipe_shader_cap param );
 
    /**
     * Query an integer-valued capability/parameter/limit for a codec/profile
     * \param param  one of PIPE_VIDEO_CAP_x
     */
-   int (*get_video_param)( struct pipe_screen *,
+   int (*get_video_param)( const struct pipe_screen *,
 			   enum pipe_video_profile profile,
 			   enum pipe_video_cap param );
 
@@ -104,7 +104,7 @@ struct pipe_screen {
     * \return       size in bytes of the parameter value that would be
     *               returned.
     */
-   int (*get_compute_param)(struct pipe_screen *,
+   int (*get_compute_param)(const struct pipe_screen *,
 			    enum pipe_compute_cap param,
 			    void *ret);
 
diff --git a/src/gallium/state_trackers/clover/core/device.hpp b/src/gallium/state_trackers/clover/core/device.hpp
index 465af9f..4d89315 100644
--- a/src/gallium/state_trackers/clover/core/device.hpp
+++ b/src/gallium/state_trackers/clover/core/device.hpp
@@ -74,6 +74,7 @@ public:
    clover::supported_formats(cl_context, cl_mem_object_type);
 
    clover::platform &platform;
+   const struct pipe_screen *get_pipe() const { return pipe; }
 
 private:
    pipe_screen *pipe;
-- 
1.7.11.4



More information about the mesa-dev mailing list