Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/imx: ipuv3-plane: do not advertise YUV formats on planes without CSC

Only planes that are displayed via the Display Processor (DP) path
support color space conversion. Limit formats on planes that are
shown via the direct Display Controller (DC) path to RGB.

Reported-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>

+37 -4
+37 -4
drivers/gpu/drm/imx/ipuv3-plane.c
··· 35 35 return container_of(p, struct ipu_plane, base); 36 36 } 37 37 38 - static const uint32_t ipu_plane_formats[] = { 38 + static const uint32_t ipu_plane_all_formats[] = { 39 39 DRM_FORMAT_ARGB1555, 40 40 DRM_FORMAT_XRGB1555, 41 41 DRM_FORMAT_ABGR1555, ··· 63 63 DRM_FORMAT_YVU444, 64 64 DRM_FORMAT_NV12, 65 65 DRM_FORMAT_NV16, 66 + DRM_FORMAT_RGB565, 67 + DRM_FORMAT_RGB565_A8, 68 + DRM_FORMAT_BGR565_A8, 69 + DRM_FORMAT_RGB888_A8, 70 + DRM_FORMAT_BGR888_A8, 71 + DRM_FORMAT_RGBX8888_A8, 72 + DRM_FORMAT_BGRX8888_A8, 73 + }; 74 + 75 + static const uint32_t ipu_plane_rgb_formats[] = { 76 + DRM_FORMAT_ARGB1555, 77 + DRM_FORMAT_XRGB1555, 78 + DRM_FORMAT_ABGR1555, 79 + DRM_FORMAT_XBGR1555, 80 + DRM_FORMAT_RGBA5551, 81 + DRM_FORMAT_BGRA5551, 82 + DRM_FORMAT_ARGB4444, 83 + DRM_FORMAT_ARGB8888, 84 + DRM_FORMAT_XRGB8888, 85 + DRM_FORMAT_ABGR8888, 86 + DRM_FORMAT_XBGR8888, 87 + DRM_FORMAT_RGBA8888, 88 + DRM_FORMAT_RGBX8888, 89 + DRM_FORMAT_BGRA8888, 90 + DRM_FORMAT_BGRX8888, 66 91 DRM_FORMAT_RGB565, 67 92 DRM_FORMAT_RGB565_A8, 68 93 DRM_FORMAT_BGR565_A8, ··· 855 830 struct ipu_plane *ipu_plane; 856 831 const uint64_t *modifiers = ipu_format_modifiers; 857 832 unsigned int zpos = (type == DRM_PLANE_TYPE_PRIMARY) ? 0 : 1; 833 + unsigned int format_count; 834 + const uint32_t *formats; 858 835 int ret; 859 836 860 837 DRM_DEBUG_KMS("channel %d, dp flow %d, possible_crtcs=0x%x\n", 861 838 dma, dp, possible_crtcs); 862 839 840 + if (dp == IPU_DP_FLOW_SYNC_BG || dp == IPU_DP_FLOW_SYNC_FG) { 841 + formats = ipu_plane_all_formats; 842 + format_count = ARRAY_SIZE(ipu_plane_all_formats); 843 + } else { 844 + formats = ipu_plane_rgb_formats; 845 + format_count = ARRAY_SIZE(ipu_plane_rgb_formats); 846 + } 863 847 ipu_plane = drmm_universal_plane_alloc(dev, struct ipu_plane, base, 864 848 possible_crtcs, &ipu_plane_funcs, 865 - ipu_plane_formats, 866 - ARRAY_SIZE(ipu_plane_formats), 867 - modifiers, type, NULL); 849 + formats, format_count, modifiers, 850 + type, NULL); 868 851 if (IS_ERR(ipu_plane)) { 869 852 DRM_ERROR("failed to allocate and initialize %s plane\n", 870 853 zpos ? "overlay" : "primary");