[Mesa-dev] [PATCH 07/27] i965/dri: Store the screen associated with the image

Eric Engestrom eric.engestrom at imgtec.com
Fri Dec 2 17:58:57 UTC 2016


On Thursday, 2016-12-01 14:09:48 -0800, Ben Widawsky wrote:
> From: Ben Widawsky <ben at bwidawsk.net>
> 
> I intend to need to get to the devinfo structure, and storing the screen
> is an easy way to do that.
> 
> It seems to be the consensus that you cannot share an image between
> multiple screens.
> 
> Scape-goat: Rob Clark <robdclark at gmail.com>

Do we need to teach git about this new tag? xD

> Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
> ---
>  src/mesa/drivers/dri/i965/intel_image.h  |  1 +
>  src/mesa/drivers/dri/i965/intel_screen.c | 16 ++++++++++------
>  2 files changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/intel_image.h b/src/mesa/drivers/dri/i965/intel_image.h
> index 9b3816e..fd63919 100644
> --- a/src/mesa/drivers/dri/i965/intel_image.h
> +++ b/src/mesa/drivers/dri/i965/intel_image.h
> @@ -65,6 +65,7 @@ struct intel_image_format {
>  };
>  
>  struct __DRIimageRec {
> +   struct intel_screen *screen;
>     drm_intel_bo *bo;
>     uint32_t pitch; /**< in bytes */
>     GLenum internal_format;
> diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
> index e1c3c19..5808bde 100644
> --- a/src/mesa/drivers/dri/i965/intel_screen.c
> +++ b/src/mesa/drivers/dri/i965/intel_screen.c
> @@ -349,7 +349,8 @@ static boolean intel_lookup_fourcc(int dri_format, int *fourcc)
>  }
>  
>  static __DRIimage *
> -intel_allocate_image(int dri_format, void *loaderPrivate)
> +intel_allocate_image(struct intel_screen *screen, int dri_format,
> +                     void *loaderPrivate)
>  {
>      __DRIimage *image;
>  
> @@ -357,6 +358,7 @@ intel_allocate_image(int dri_format, void *loaderPrivate)
>      if (image == NULL)
>  	return NULL;
>  
> +    image->screen = screen;
>      image->dri_format = dri_format;
>      image->offset = 0;
>  
> @@ -407,7 +409,7 @@ intel_create_image_from_name(__DRIscreen *dri_screen,
>      __DRIimage *image;
>      int cpp;
>  
> -    image = intel_allocate_image(format, loaderPrivate);
> +    image = intel_allocate_image(screen, format, loaderPrivate);
>      if (image == NULL)
>         return NULL;
>  
> @@ -557,7 +559,7 @@ intel_create_image(__DRIscreen *dri_screen,
>     if (use & __DRI_IMAGE_USE_LINEAR)
>        tiling = I915_TILING_NONE;
>  
> -   image = intel_allocate_image(format, loaderPrivate);
> +   image = intel_allocate_image(screen, format, loaderPrivate);
>     if (image == NULL)
>        return NULL;
>  
> @@ -719,9 +721,11 @@ intel_create_image_from_fds(__DRIscreen *dri_screen,
>        return NULL;
>  
>     if (f->nplanes == 1)
> -      image = intel_allocate_image(f->planes[0].dri_format, loaderPrivate);
> +      image = intel_allocate_image(screen, f->planes[0].dri_format,
> +                                   loaderPrivate);
>     else
> -      image = intel_allocate_image(__DRI_IMAGE_FORMAT_NONE, loaderPrivate);
> +      image = intel_allocate_image(screen, __DRI_IMAGE_FORMAT_NONE,
> +                                   loaderPrivate);
>  
>     if (image == NULL)
>        return NULL;
> @@ -824,7 +828,7 @@ intel_from_planar(__DRIimage *parent, int plane, void *loaderPrivate)
>      offset = parent->offsets[index];
>      stride = parent->strides[index];
>  
> -    image = intel_allocate_image(dri_format, loaderPrivate);
> +    image = intel_allocate_image(parent->screen, dri_format, loaderPrivate);
>      if (image == NULL)
>         return NULL;
>  
> -- 
> 2.10.2
> 


More information about the mesa-dev mailing list