[Mesa-dev] [PATCH] isl: annotate isl_get_interleaved_msaa_px_size_sa return value as const

Emil Velikov emil.l.velikov at gmail.com
Tue Feb 7 12:54:47 UTC 2017


Already used as such and annotated in a number of places.
Should resolve -Wignored-qualifiers warnings, such as:

src/intel/blorp/blorp_blit.c:1857:8: warning: 'const' type qualifier on
return type has no effect [-Wignored-qualifiers]

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/intel/blorp/blorp_blit.c | 4 ++--
 src/intel/isl/isl.c          | 4 ++--
 src/intel/isl/isl.h          | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c
index b89a112b8c..1d3b52d80e 100644
--- a/src/intel/blorp/blorp_blit.c
+++ b/src/intel/blorp/blorp_blit.c
@@ -1358,7 +1358,7 @@ surf_get_intratile_offset_px(struct brw_blorp_surface_info *info,
                              uint32_t *tile_x_px, uint32_t *tile_y_px)
 {
    if (info->surf.msaa_layout == ISL_MSAA_LAYOUT_INTERLEAVED) {
-      struct isl_extent2d px_size_sa =
+      const struct isl_extent2d px_size_sa =
          isl_get_interleaved_msaa_px_size_sa(info->surf.samples);
       assert(info->tile_x_sa % px_size_sa.width == 0);
       assert(info->tile_y_sa % px_size_sa.height == 0);
@@ -1678,7 +1678,7 @@ try_blorp_blit(struct blorp_batch *batch,
        * If it's UMS, then we have no choice but to set up the rendering
        * pipeline as multisampled.
        */
-      struct isl_extent2d px_size_sa =
+      const struct isl_extent2d px_size_sa =
          isl_get_interleaved_msaa_px_size_sa(params->dst.surf.samples);
       params->x0 = ROUND_DOWN_TO(params->x0, 2) * px_size_sa.width;
       params->y0 = ROUND_DOWN_TO(params->y0, 2) * px_size_sa.height;
diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
index 82ab68dc65..62aa31cf29 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -329,7 +329,7 @@ isl_choose_msaa_layout(const struct isl_device *dev,
    }
 }
 
-struct isl_extent2d
+const struct isl_extent2d
 isl_get_interleaved_msaa_px_size_sa(uint32_t samples)
 {
    assert(isl_is_pow2(samples));
@@ -342,7 +342,7 @@ isl_get_interleaved_msaa_px_size_sa(uint32_t samples)
     *    MSFMT_DEPTH_STENCIL, W_L and H_L must be adjusted as follows before
     *    proceeding: [...]
     */
-   return (struct isl_extent2d) {
+   return (const struct isl_extent2d) {
       .width = 1 << ((ffs(samples) - 0) / 2),
       .height = 1 << ((ffs(samples) - 1) / 2),
    };
diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
index eff7218748..e9074e526d 100644
--- a/src/intel/isl/isl.h
+++ b/src/intel/isl/isl.h
@@ -1172,7 +1172,7 @@ isl_tiling_is_std_y(enum isl_tiling tiling)
    return (1u << tiling) & ISL_TILING_STD_Y_MASK;
 }
 
-struct isl_extent2d ATTRIBUTE_CONST
+const struct isl_extent2d ATTRIBUTE_CONST
 isl_get_interleaved_msaa_px_size_sa(uint32_t samples);
 
 static inline bool
-- 
2.11.0



More information about the mesa-dev mailing list