[Mesa-dev] [PATCH] st/dri: allow direct YUYV import

Philipp Zabel p.zabel at pengutronix.de
Wed Jul 19 12:38:08 UTC 2017


On Fri, 2017-06-23 at 18:48 +0200, Lucas Stach wrote:
> Push this format to the pipe driver unchanged.
> 
> Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
> ---
>  include/GL/internal/dri_interface.h   | 1 +
>  src/gallium/state_trackers/dri/dri2.c | 7 +++++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/include/GL/internal/dri_interface.h b/include/GL/internal/dri_interface.h
> index fc2d4bbe22ef..69188a2a0da3 100644
> --- a/include/GL/internal/dri_interface.h
> +++ b/include/GL/internal/dri_interface.h
> @@ -1167,6 +1167,7 @@ struct __DRIdri2ExtensionRec {
>  #define __DRI_IMAGE_FORMAT_ARGB1555     0x100c
>  #define __DRI_IMAGE_FORMAT_R16          0x100d
>  #define __DRI_IMAGE_FORMAT_GR1616       0x100e
> +#define __DRI_IMAGE_FORMAT_YUYV         0x100f
>  
>  #define __DRI_IMAGE_USE_SHARE		0x0001
>  #define __DRI_IMAGE_USE_SCANOUT		0x0002
> diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
> index c5e69d639b16..3119a396ce29 100644
> --- a/src/gallium/state_trackers/dri/dri2.c
> +++ b/src/gallium/state_trackers/dri/dri2.c
> @@ -115,6 +115,10 @@ static int convert_fourcc(int format, int *dri_components_p)
>        format = __DRI_IMAGE_FORMAT_GR88;
>        dri_components = __DRI_IMAGE_COMPONENTS_RG;
>        break;
> +   case __DRI_IMAGE_FOURCC_YUYV:
> +      format = __DRI_IMAGE_FORMAT_YUYV;
> +      dri_components = __DRI_IMAGE_COMPONENTS_Y_XUXV;
> +      break;
>     /*
>      * For multi-planar YUV formats, we return the format of the first
>      * plane only.  Since there is only one caller which supports multi-
> @@ -195,6 +199,9 @@ static enum pipe_format dri2_format_to_pipe_format (int format)
>     case __DRI_IMAGE_FORMAT_GR88:
>        pf = PIPE_FORMAT_RG88_UNORM;
>        break;
> +   case __DRI_IMAGE_FORMAT_YUYV:
> +      pf = PIPE_FORMAT_YUYV;
> +      break;
>     default:
>        pf = PIPE_FORMAT_NONE;
>        break;

Reviewed-by: Philipp Zabel <p.zabel at pengutronix.de>

regards
Philipp



More information about the mesa-dev mailing list