[Mesa-dev] [PATCH 10/13] gallium: introduce format modifier querying

Roland Scheidegger sroland at vmware.com
Tue Nov 15 17:23:12 UTC 2016


It looks like there aren't any possible modifier bits defined, so how is
this supposed to work?

Roland

Am 15.11.2016 um 15:24 schrieb Varad Gautam:
> From: Varad Gautam <varad.gautam at collabora.com>
> 
> drivers should implement pipe_screen->get_modifiers_for_format and
> advertise it with PIPE_CAP_QUERY_DMABUF_MODIFIERS to support format
> modifier queries.
> 
> Signed-off-by: Varad Gautam <varad.gautam at collabora.com>
> ---
>  src/gallium/docs/source/screen.rst               | 2 ++
>  src/gallium/drivers/freedreno/freedreno_screen.c | 1 +
>  src/gallium/drivers/i915/i915_screen.c           | 1 +
>  src/gallium/drivers/ilo/ilo_screen.c             | 1 +
>  src/gallium/drivers/llvmpipe/lp_screen.c         | 1 +
>  src/gallium/drivers/nouveau/nv30/nv30_screen.c   | 1 +
>  src/gallium/drivers/nouveau/nv50/nv50_screen.c   | 1 +
>  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   | 1 +
>  src/gallium/drivers/r300/r300_screen.c           | 1 +
>  src/gallium/drivers/r600/r600_pipe.c             | 1 +
>  src/gallium/drivers/radeonsi/si_pipe.c           | 1 +
>  src/gallium/drivers/softpipe/sp_screen.c         | 1 +
>  src/gallium/drivers/svga/svga_screen.c           | 1 +
>  src/gallium/drivers/swr/swr_screen.cpp           | 1 +
>  src/gallium/drivers/vc4/vc4_screen.c             | 1 +
>  src/gallium/drivers/virgl/virgl_screen.c         | 1 +
>  src/gallium/include/pipe/p_defines.h             | 1 +
>  src/gallium/include/pipe/p_screen.h              | 7 +++++++
>  18 files changed, 25 insertions(+)
> 
> diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
> index 6ad2bec..1775fe3 100644
> --- a/src/gallium/docs/source/screen.rst
> +++ b/src/gallium/docs/source/screen.rst
> @@ -364,6 +364,8 @@ The integer capabilities:
>  * ``PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS``: Whether interleaved stream
>    output mode is able to interleave across buffers. This is required for
>    ARB_transform_feedback3.
> +* ``PIPE_CAP_QUERY_DMABUF_MODIFIERS``: Whether the driver supports modifier
> +  queries for a given format.
>  
>  
>  .. _pipe_capf:
> diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
> index 97da0d7..2786d45 100644
> --- a/src/gallium/drivers/freedreno/freedreno_screen.c
> +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
> @@ -288,6 +288,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>  	case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
>  	case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
>  	case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
> +	case PIPE_CAP_QUERY_DMABUF_MODIFIERS:
>  		return 0;
>  
>  	case PIPE_CAP_MAX_VIEWPORTS:
> diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
> index bfadca3..ce42e04 100644
> --- a/src/gallium/drivers/i915/i915_screen.c
> +++ b/src/gallium/drivers/i915/i915_screen.c
> @@ -278,6 +278,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
>     case PIPE_CAP_MAX_WINDOW_RECTANGLES:
>     case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
>     case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
> +   case PIPE_CAP_QUERY_DMABUF_MODIFIERS:
>        return 0;
>  
>     case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
> diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c
> index f3f182c..05fc906 100644
> --- a/src/gallium/drivers/ilo/ilo_screen.c
> +++ b/src/gallium/drivers/ilo/ilo_screen.c
> @@ -517,6 +517,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
>     case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
>     case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
> +   case PIPE_CAP_QUERY_DMABUF_MODIFIERS:
>        return 0;
>  
>     case PIPE_CAP_VENDOR_ID:
> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
> index 4b502f0..2a8fa76 100644
> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
> @@ -338,6 +338,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_MAX_WINDOW_RECTANGLES:
>     case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
>     case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
> +   case PIPE_CAP_QUERY_DMABUF_MODIFIERS:
>        return 0;
>     }
>     /* should only get here on unhandled cases */
> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> index 96708c0..6ba768b 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> @@ -203,6 +203,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>     case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
>     case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
>     case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
> +   case PIPE_CAP_QUERY_DMABUF_MODIFIERS:
>        return 0;
>  
>     case PIPE_CAP_VENDOR_ID:
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> index 50cdeda..5c922ed 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> @@ -255,6 +255,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>     case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
>     case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
>     case PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS:
> +   case PIPE_CAP_QUERY_DMABUF_MODIFIERS:
>        return 0;
>  
>     case PIPE_CAP_VENDOR_ID:
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> index 6361e9e..02216a9 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> @@ -274,6 +274,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>     case PIPE_CAP_PCI_DEVICE:
>     case PIPE_CAP_PCI_FUNCTION:
>     case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
> +   case PIPE_CAP_QUERY_DMABUF_MODIFIERS:
>        return 0;
>  
>     case PIPE_CAP_VENDOR_ID:
> diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
> index 1e1dc87..e8efb1f 100644
> --- a/src/gallium/drivers/r300/r300_screen.c
> +++ b/src/gallium/drivers/r300/r300_screen.c
> @@ -225,6 +225,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>          case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
>          case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
>          case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
> +        case PIPE_CAP_QUERY_DMABUF_MODIFIERS:
>              return 0;
>  
>          /* SWTCL-only features. */
> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
> index 970a20e..39230cf 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -374,6 +374,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>  	case PIPE_CAP_TGSI_VOTE:
>  	case PIPE_CAP_MAX_WINDOW_RECTANGLES:
>  	case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
> +	case PIPE_CAP_QUERY_DMABUF_MODIFIERS:
>  		return 0;
>  
>  	case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
> index f0cd9ca..1b60e81 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -458,6 +458,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>  	case PIPE_CAP_PRIMITIVE_RESTART_FOR_PATCHES:
>  	case PIPE_CAP_TGSI_VOTE:
>  	case PIPE_CAP_MAX_WINDOW_RECTANGLES:
> +	case PIPE_CAP_QUERY_DMABUF_MODIFIERS:
>  		return 0;
>  
>  	case PIPE_CAP_QUERY_BUFFER_OBJECT:
> diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
> index 275adab..aeab080 100644
> --- a/src/gallium/drivers/softpipe/sp_screen.c
> +++ b/src/gallium/drivers/softpipe/sp_screen.c
> @@ -288,6 +288,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_MAX_WINDOW_RECTANGLES:
>     case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
>     case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
> +   case PIPE_CAP_QUERY_DMABUF_MODIFIERS:
>        return 0;
>     case PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT:
>        return 4;
> diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
> index 67a35cf..0d19eb4 100644
> --- a/src/gallium/drivers/svga/svga_screen.c
> +++ b/src/gallium/drivers/svga/svga_screen.c
> @@ -419,6 +419,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
>     case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
>     case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
> +   case PIPE_CAP_QUERY_DMABUF_MODIFIERS:
>        return 0;
>     }
>  
> diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp
> index fa16edd..3d0b2f4 100644
> --- a/src/gallium/drivers/swr/swr_screen.cpp
> +++ b/src/gallium/drivers/swr/swr_screen.cpp
> @@ -369,6 +369,7 @@ swr_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
>     case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
>     case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
> +   case PIPE_CAP_QUERY_DMABUF_MODIFIERS:
>        return 0;
>     }
>  
> diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
> index 9aa80ca..70c9e3a 100644
> --- a/src/gallium/drivers/vc4/vc4_screen.c
> +++ b/src/gallium/drivers/vc4/vc4_screen.c
> @@ -239,6 +239,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>          case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
>          case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
>          case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
> +        case PIPE_CAP_QUERY_DMABUF_MODIFIERS:
>                  return 0;
>  
>                  /* Stream output. */
> diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c
> index 2817809..f41a078 100644
> --- a/src/gallium/drivers/virgl/virgl_screen.c
> +++ b/src/gallium/drivers/virgl/virgl_screen.c
> @@ -250,6 +250,7 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_POLYGON_OFFSET_UNITS_UNSCALED:
>     case PIPE_CAP_VIEWPORT_SUBPIXEL_BITS:
>     case PIPE_CAP_TGSI_ARRAY_COMPONENTS:
> +   case PIPE_CAP_QUERY_DMABUF_MODIFIERS:
>        return 0;
>     case PIPE_CAP_VENDOR_ID:
>        return 0x1af4;
> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
> index 69d290c..53d041c 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -740,6 +740,7 @@ enum pipe_cap
>     PIPE_CAP_MIXED_COLOR_DEPTH_BITS,
>     PIPE_CAP_TGSI_ARRAY_COMPONENTS,
>     PIPE_CAP_STREAM_OUTPUT_INTERLEAVE_BUFFERS,
> +   PIPE_CAP_QUERY_DMABUF_MODIFIERS,
>  };
>  
>  #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
> diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h
> index 255647e..91b3434 100644
> --- a/src/gallium/include/pipe/p_screen.h
> +++ b/src/gallium/include/pipe/p_screen.h
> @@ -300,6 +300,13 @@ struct pipe_screen {
>     const void *(*get_compiler_options)(struct pipe_screen *screen,
>                                        enum pipe_shader_ir ir,
>                                        unsigned shader);
> +
> +   /**
> +    * Get supported modifiers for a format.
> +    */
> +   void (*get_modifiers_for_format)(struct pipe_screen *screen,
> +                                    enum pipe_format format, int max,
> +                                    uint64_t *modifiers, int *count);
>  };
>  
>  
> 



More information about the mesa-dev mailing list