MLK-16075-8 gpu: imx: dpu: common: Add helpers to get sub-samplings of pfmt
authorLiu Ying <victor.liu@nxp.com>
Tue, 25 Jul 2017 07:20:22 +0000 (15:20 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:33:50 +0000 (15:33 -0500)
This patch adds helpers dpu_format_horz/vert_chroma_subsampling() to
get horizontal or vertical sub-samplings of pixel formats which are
supported by the current dpu base driver.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
drivers/gpu/imx/dpu/dpu-common.c
drivers/gpu/imx/dpu/dpu-prv.h

index 722c1e7..dd468d5 100644 (file)
@@ -549,6 +549,32 @@ u32 dpu_vproc_get_vscale_cap(u32 cap_mask)
 }
 EXPORT_SYMBOL_GPL(dpu_vproc_get_vscale_cap);
 
+int dpu_format_horz_chroma_subsampling(u32 format)
+{
+       switch (format) {
+       case DRM_FORMAT_YUYV:
+       case DRM_FORMAT_UYVY:
+       case DRM_FORMAT_NV12:
+       case DRM_FORMAT_NV21:
+       case DRM_FORMAT_NV16:
+       case DRM_FORMAT_NV61:
+               return 2;
+       default:
+               return 1;
+       }
+}
+
+int dpu_format_vert_chroma_subsampling(u32 format)
+{
+       switch (format) {
+       case DRM_FORMAT_NV12:
+       case DRM_FORMAT_NV21:
+               return 2;
+       default:
+               return 1;
+       }
+}
+
 #define DPU_UNIT_INIT(dpu, base, unit, name, id, pec_ofs, ofs)         \
 {                                                                      \
        int ret;                                                        \
index 2641aa7..25066cf 100644 (file)
@@ -226,6 +226,9 @@ struct dpu_soc {
        struct dpu_vscaler      *vs_priv[3];
 };
 
+int dpu_format_horz_chroma_subsampling(u32 format);
+int dpu_format_vert_chroma_subsampling(u32 format);
+
 #define DECLARE_DPU_UNIT_INIT_FUNC(block)                      \
 int dpu_##block##_init(struct dpu_soc *dpu, unsigned int id,   \
                         unsigned long pec_base, unsigned long base)