[Mesa-dev] [PATCH] intel: Remove pointless boolean return value from *_miptree_layout.

Ian Romanick idr at freedesktop.org
Fri Sep 23 10:54:33 PDT 2011


On 09/08/2011 09:14 PM, Kenneth Graunke wrote:
> i915_miptree_layout, i945_miptree_layout, and brw_miptree_layout always
> just return GL_TRUE, so there's really no point to it.  Change them to
> void functions and remove the (dead) error checking code.
>
> Signed-off-by: Kenneth Graunke<kenneth at whitecape.org>

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> ---
>   src/mesa/drivers/dri/i915/i915_tex_layout.c    |    8 ++------
>   src/mesa/drivers/dri/i965/brw_tex_layout.c     |    9 ++++-----
>   src/mesa/drivers/dri/intel/intel_mipmap_tree.c |   13 +++----------
>   src/mesa/drivers/dri/intel/intel_mipmap_tree.h |   18 +++++++++---------
>   4 files changed, 18 insertions(+), 30 deletions(-)
>
> Compile tested only.
>
> diff --git a/src/mesa/drivers/dri/i915/i915_tex_layout.c b/src/mesa/drivers/dri/i915/i915_tex_layout.c
> index e6a4711..c1450be 100644
> --- a/src/mesa/drivers/dri/i915/i915_tex_layout.c
> +++ b/src/mesa/drivers/dri/i915/i915_tex_layout.c
> @@ -230,7 +230,7 @@ i915_miptree_layout_2d(struct intel_context *intel,
>      }
>   }
>
> -GLboolean
> +void
>   i915_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt,
>   		    uint32_t tiling)
>   {
> @@ -253,8 +253,6 @@ i915_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt,
>
>      DBG("%s: %dx%dx%d\n", __FUNCTION__,
>          mt->total_width, mt->total_height, mt->cpp);
> -
> -   return GL_TRUE;
>   }
>
>
> @@ -466,7 +464,7 @@ i945_miptree_layout_3d(struct intel_context *intel,
>      }
>   }
>
> -GLboolean
> +void
>   i945_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt,
>   		    uint32_t tiling)
>   {
> @@ -492,6 +490,4 @@ i945_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt,
>
>      DBG("%s: %dx%dx%d\n", __FUNCTION__,
>          mt->total_width, mt->total_height, mt->cpp);
> -
> -   return GL_TRUE;
>   }
> diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c
> index b5d2cf3..33d8cf0 100644
> --- a/src/mesa/drivers/dri/i965/brw_tex_layout.c
> +++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c
> @@ -39,9 +39,10 @@
>
>   #define FILE_DEBUG_FLAG DEBUG_MIPTREE
>
> -GLboolean brw_miptree_layout(struct intel_context *intel,
> -			     struct intel_mipmap_tree *mt,
> -			     uint32_t tiling)
> +void
> +brw_miptree_layout(struct intel_context *intel,
> +		   struct intel_mipmap_tree *mt,
> +		   uint32_t tiling)
>   {
>      /* XXX: these vary depending on image format: */
>      /* GLint align_w = 4; */
> @@ -167,7 +168,5 @@ GLboolean brw_miptree_layout(struct intel_context *intel,
>      }
>      DBG("%s: %dx%dx%d\n", __FUNCTION__,
>          mt->total_width, mt->total_height, mt->cpp);
> -
> -   return GL_TRUE;
>   }
>
> diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> index f36240d..9b53fdb 100644
> --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
> @@ -64,7 +64,6 @@ intel_miptree_create_internal(struct intel_context *intel,
>   			      GLuint depth0,
>   			      uint32_t tiling)
>   {
> -   GLboolean ok;
>      struct intel_mipmap_tree *mt = calloc(sizeof(*mt), 1);
>      int compress_byte = 0;
>
> @@ -89,19 +88,13 @@ intel_miptree_create_internal(struct intel_context *intel,
>
>   #ifdef I915
>      if (intel->is_945)
> -      ok = i945_miptree_layout(intel, mt, tiling);
> +      i945_miptree_layout(intel, mt, tiling);
>      else
> -      ok = i915_miptree_layout(intel, mt, tiling);
> +      i915_miptree_layout(intel, mt, tiling);
>   #else
> -   ok = brw_miptree_layout(intel, mt, tiling);
> +   brw_miptree_layout(intel, mt, tiling);
>   #endif
>
> -   if (!ok) {
> -      free(mt);
> -      DBG("%s not okay - returning NULL\n", __FUNCTION__);
> -      return NULL;
> -   }
> -
>      return mt;
>   }
>
> diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
> index ea86590..d0e1c40 100644
> --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
> +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
> @@ -212,14 +212,14 @@ void intel_miptree_image_copy(struct intel_context *intel,
>
>   /* i915_mipmap_tree.c:
>    */
> -GLboolean i915_miptree_layout(struct intel_context *intel,
> -			      struct intel_mipmap_tree *mt,
> -			      uint32_t tiling);
> -GLboolean i945_miptree_layout(struct intel_context *intel,
> -			      struct intel_mipmap_tree *mt,
> -			      uint32_t tiling);
> -GLboolean brw_miptree_layout(struct intel_context *intel,
> -			     struct intel_mipmap_tree *mt,
> -			     uint32_t tiling);
> +void i915_miptree_layout(struct intel_context *intel,
> +			 struct intel_mipmap_tree *mt,
> +			 uint32_t tiling);
> +void i945_miptree_layout(struct intel_context *intel,
> +			 struct intel_mipmap_tree *mt,
> +			 uint32_t tiling);
> +void brw_miptree_layout(struct intel_context *intel,
> +			struct intel_mipmap_tree *mt,
> +			uint32_t tiling);
>
>   #endif



More information about the mesa-dev mailing list