[Mesa-dev] [PATCH 07/18] i965: Drop the tiling argument to intel_miptree_create_for_bo.

Chad Versace chad.versace at linux.intel.com
Wed Apr 30 23:09:54 PDT 2014


On Tue, Apr 29, 2014 at 04:34:32PM -0700, Eric Anholt wrote:
> The drm function to get the tiling is just a getter storing the two
> pointers, so we don't need to go out of our way to avoid it.

> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> index 63b80bd..58a6b86 100644
> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
> @@ -643,15 +643,17 @@ intel_miptree_create_for_bo(struct brw_context *brw,
>                              uint32_t offset,
>                              uint32_t width,
>                              uint32_t height,
> -                            int pitch,
> -                            uint32_t tiling)
> +                            int pitch)
>  {
>     struct intel_mipmap_tree *mt;
> +   uint32_t tiling, swizzle;
>  
>     struct intel_region *region = calloc(1, sizeof(*region));
>     if (!region)
>        return NULL;
>  
> +   drm_intel_bo_get_tiling(bo, &tiling, &swizzle);
> +
>     /* Nothing will be able to use this miptree with the BO if the offset isn't
>      * aligned.
>      */



> diff --git a/src/mesa/drivers/dri/i965/intel_pixel_draw.c b/src/mesa/drivers/dri/i965/intel_pixel_draw.c
> index 8ca8ae4..96bbd3d 100644
> --- a/src/mesa/drivers/dri/i965/intel_pixel_draw.c
> +++ b/src/mesa/drivers/dri/i965/intel_pixel_draw.c
> @@ -113,7 +113,7 @@ do_blit_drawpixels(struct gl_context * ctx,
>                                    irb->mt->format,
>                                    src_offset,
>                                    width, height,
> -                                  src_stride, I915_TILING_NONE);
> +                                  src_stride);
>     if (!pbo_mt)
>        return false;
>  

I really like this patch. Pre-patch, to call intel_miptree_create_for_bo() with
the correct tiling, do_blit_readpixels() required detailed knowledge of how
intel_bufferobj_alloc_buffer() performed its allocation.

I never feel comfortable with hidden knowledge dependencies like that. And this
patch removes the dependency.

Ditto for do_blit_readpixels() and try_pbo_upload().

Patches up to here are
Reviewed-by: Chad Versace <chad.versace at linux.intel.com> 


More information about the mesa-dev mailing list