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

drm: Plumb modifiers through plane init

This is the plumbing for supporting fb modifiers on planes. Modifiers
have already been introduced to some extent, but this series will extend
this to allow querying modifiers per plane. Based on this, the client to
enable optimal modifications for framebuffers.

This patch simply allows the DRM drivers to initialize their list of
supported modifiers upon initializing the plane.

v2: A minor addition from Daniel

v3:
* Updated commit message
* s/INVALID/DRM_FORMAT_MOD_INVALID (Liviu)
* Remove some excess newlines (Liviu)
* Update comment for > 64 modifiers (Liviu)

v4: Minor comment adjustments (Liviu)

v5: Some new platforms added due to rebase

v6: Add some missed plane inits (or maybe they're new - who knows at
this point) (Daniel)

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Daniel Stone <daniels@collabora.com> (v2)
Reviewed-by: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Daniel Stone <daniels@collabora.com>

authored by

Ben Widawsky and committed by
Daniel Stone
e6fc3b68 d7429669

+131 -50
+1
drivers/gpu/drm/arc/arcpgu_crtc.c
··· 217 217 218 218 ret = drm_universal_plane_init(drm, plane, 0xff, &arc_pgu_plane_funcs, 219 219 formats, ARRAY_SIZE(formats), 220 + NULL, 220 221 DRM_PLANE_TYPE_PRIMARY, NULL); 221 222 if (ret) 222 223 return ERR_PTR(ret);
+1
drivers/gpu/drm/arm/hdlcd_crtc.c
··· 315 315 316 316 ret = drm_universal_plane_init(drm, plane, 0xff, &hdlcd_plane_funcs, 317 317 formats, ARRAY_SIZE(formats), 318 + NULL, 318 319 DRM_PLANE_TYPE_PRIMARY, NULL); 319 320 if (ret) { 320 321 return ERR_PTR(ret);
+1 -1
drivers/gpu/drm/arm/malidp_planes.c
··· 398 398 DRM_PLANE_TYPE_OVERLAY; 399 399 ret = drm_universal_plane_init(drm, &plane->base, crtcs, 400 400 &malidp_de_plane_funcs, formats, 401 - n, plane_type, NULL); 401 + n, NULL, plane_type, NULL); 402 402 if (ret < 0) 403 403 goto cleanup; 404 404
+1
drivers/gpu/drm/armada/armada_crtc.c
··· 1269 1269 &armada_primary_plane_funcs, 1270 1270 armada_primary_formats, 1271 1271 ARRAY_SIZE(armada_primary_formats), 1272 + NULL, 1272 1273 DRM_PLANE_TYPE_PRIMARY, NULL); 1273 1274 if (ret) { 1274 1275 kfree(primary);
+1
drivers/gpu/drm/armada/armada_overlay.c
··· 460 460 &armada_ovl_plane_funcs, 461 461 armada_ovl_formats, 462 462 ARRAY_SIZE(armada_ovl_formats), 463 + NULL, 463 464 DRM_PLANE_TYPE_OVERLAY, NULL); 464 465 if (ret) { 465 466 kfree(dplane);
+2 -1
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
··· 1087 1087 ret = drm_universal_plane_init(dev, &plane->base, 0, 1088 1088 &layer_plane_funcs, 1089 1089 desc->formats->formats, 1090 - desc->formats->nformats, type, NULL); 1090 + desc->formats->nformats, 1091 + NULL, type, NULL); 1091 1092 if (ret) 1092 1093 return ret; 1093 1094
+1
drivers/gpu/drm/drm_modeset_helper.c
··· 124 124 &drm_primary_helper_funcs, 125 125 safe_modeset_formats, 126 126 ARRAY_SIZE(safe_modeset_formats), 127 + NULL, 127 128 DRM_PLANE_TYPE_PRIMARY, NULL); 128 129 if (ret) { 129 130 kfree(primary);
+35 -1
drivers/gpu/drm/drm_plane.c
··· 70 70 * @funcs: callbacks for the new plane 71 71 * @formats: array of supported formats (DRM_FORMAT\_\*) 72 72 * @format_count: number of elements in @formats 73 + * @format_modifiers: array of struct drm_format modifiers terminated by 74 + * DRM_FORMAT_MOD_INVALID 73 75 * @type: type of plane (overlay, primary, cursor) 74 76 * @name: printf style format string for the plane name, or NULL for default name 75 77 * ··· 84 82 uint32_t possible_crtcs, 85 83 const struct drm_plane_funcs *funcs, 86 84 const uint32_t *formats, unsigned int format_count, 85 + const uint64_t *format_modifiers, 87 86 enum drm_plane_type type, 88 87 const char *name, ...) 89 88 { 90 89 struct drm_mode_config *config = &dev->mode_config; 90 + unsigned int format_modifier_count = 0; 91 91 int ret; 92 92 93 93 ret = drm_mode_object_add(dev, &plane->base, DRM_MODE_OBJECT_PLANE); ··· 109 105 return -ENOMEM; 110 106 } 111 107 108 + /* 109 + * First driver to need more than 64 formats needs to fix this. Each 110 + * format is encoded as a bit and the current code only supports a u64. 111 + */ 112 + if (WARN_ON(format_count > 64)) 113 + return -EINVAL; 114 + 115 + if (format_modifiers) { 116 + const uint64_t *temp_modifiers = format_modifiers; 117 + while (*temp_modifiers++ != DRM_FORMAT_MOD_INVALID) 118 + format_modifier_count++; 119 + } 120 + 121 + plane->modifier_count = format_modifier_count; 122 + plane->modifiers = kmalloc_array(format_modifier_count, 123 + sizeof(format_modifiers[0]), 124 + GFP_KERNEL); 125 + 126 + if (format_modifier_count && !plane->modifiers) { 127 + DRM_DEBUG_KMS("out of memory when allocating plane\n"); 128 + kfree(plane->format_types); 129 + drm_mode_object_unregister(dev, &plane->base); 130 + return -ENOMEM; 131 + } 132 + 112 133 if (name) { 113 134 va_list ap; 114 135 ··· 146 117 } 147 118 if (!plane->name) { 148 119 kfree(plane->format_types); 120 + kfree(plane->modifiers); 149 121 drm_mode_object_unregister(dev, &plane->base); 150 122 return -ENOMEM; 151 123 } 152 124 153 125 memcpy(plane->format_types, formats, format_count * sizeof(uint32_t)); 154 126 plane->format_count = format_count; 127 + memcpy(plane->modifiers, format_modifiers, 128 + format_modifier_count * sizeof(format_modifiers[0])); 155 129 plane->possible_crtcs = possible_crtcs; 156 130 plane->type = type; 157 131 ··· 237 205 238 206 type = is_primary ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY; 239 207 return drm_universal_plane_init(dev, plane, possible_crtcs, funcs, 240 - formats, format_count, type, NULL); 208 + formats, format_count, 209 + NULL, type, NULL); 241 210 } 242 211 EXPORT_SYMBOL(drm_plane_init); 243 212 ··· 257 224 drm_modeset_lock_fini(&plane->mutex); 258 225 259 226 kfree(plane->format_types); 227 + kfree(plane->modifiers); 260 228 drm_mode_object_unregister(dev, &plane->base); 261 229 262 230 BUG_ON(list_empty(&plane->head));
+3
drivers/gpu/drm/drm_simple_kms_helper.c
··· 199 199 * @funcs: callbacks for the display pipe (optional) 200 200 * @formats: array of supported formats (DRM_FORMAT\_\*) 201 201 * @format_count: number of elements in @formats 202 + * @format_modifiers: array of formats modifiers 202 203 * @connector: connector to attach and register (optional) 203 204 * 204 205 * Sets up a display pipeline which consist of a really simple ··· 220 219 struct drm_simple_display_pipe *pipe, 221 220 const struct drm_simple_display_pipe_funcs *funcs, 222 221 const uint32_t *formats, unsigned int format_count, 222 + const uint64_t *format_modifiers, 223 223 struct drm_connector *connector) 224 224 { 225 225 struct drm_encoder *encoder = &pipe->encoder; ··· 235 233 ret = drm_universal_plane_init(dev, plane, 0, 236 234 &drm_simple_kms_plane_funcs, 237 235 formats, format_count, 236 + format_modifiers, 238 237 DRM_PLANE_TYPE_PRIMARY, NULL); 239 238 if (ret) 240 239 return ret;
+1 -1
drivers/gpu/drm/exynos/exynos_drm_plane.c
··· 283 283 &exynos_plane_funcs, 284 284 config->pixel_formats, 285 285 config->num_pixel_formats, 286 - config->type, NULL); 286 + NULL, config->type, NULL); 287 287 if (err) { 288 288 DRM_ERROR("failed to initialize plane\n"); 289 289 return err;
+1 -1
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
··· 224 224 &fsl_dcu_drm_plane_funcs, 225 225 fsl_dcu_drm_plane_formats, 226 226 ARRAY_SIZE(fsl_dcu_drm_plane_formats), 227 - DRM_PLANE_TYPE_PRIMARY, NULL); 227 + NULL, DRM_PLANE_TYPE_PRIMARY, NULL); 228 228 if (ret) { 229 229 kfree(primary); 230 230 primary = NULL;
+1
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
··· 181 181 ret = drm_universal_plane_init(dev, plane, 1, &hibmc_plane_funcs, 182 182 channel_formats1, 183 183 ARRAY_SIZE(channel_formats1), 184 + NULL, 184 185 DRM_PLANE_TYPE_PRIMARY, 185 186 NULL); 186 187 if (ret) {
+1 -1
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
··· 910 910 return ret; 911 911 912 912 ret = drm_universal_plane_init(dev, &aplane->base, 1, &ade_plane_funcs, 913 - fmts, fmts_cnt, type, NULL); 913 + fmts, fmts_cnt, NULL, type, NULL); 914 914 if (ret) { 915 915 DRM_ERROR("fail to init plane, ch=%d\n", aplane->ch); 916 916 return ret;
+4 -1
drivers/gpu/drm/i915/intel_display.c
··· 13809 13809 ret = drm_universal_plane_init(&dev_priv->drm, &primary->base, 13810 13810 0, &intel_plane_funcs, 13811 13811 intel_primary_formats, num_formats, 13812 + NULL, 13812 13813 DRM_PLANE_TYPE_PRIMARY, 13813 13814 "plane 1%c", pipe_name(pipe)); 13814 13815 else if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv)) 13815 13816 ret = drm_universal_plane_init(&dev_priv->drm, &primary->base, 13816 13817 0, &intel_plane_funcs, 13817 13818 intel_primary_formats, num_formats, 13819 + NULL, 13818 13820 DRM_PLANE_TYPE_PRIMARY, 13819 13821 "primary %c", pipe_name(pipe)); 13820 13822 else 13821 13823 ret = drm_universal_plane_init(&dev_priv->drm, &primary->base, 13822 13824 0, &intel_plane_funcs, 13823 13825 intel_primary_formats, num_formats, 13826 + NULL, 13824 13827 DRM_PLANE_TYPE_PRIMARY, 13825 13828 "plane %c", plane_name(primary->plane)); 13826 13829 if (ret) ··· 13909 13906 0, &intel_cursor_plane_funcs, 13910 13907 intel_cursor_formats, 13911 13908 ARRAY_SIZE(intel_cursor_formats), 13912 - DRM_PLANE_TYPE_CURSOR, 13909 + NULL, DRM_PLANE_TYPE_CURSOR, 13913 13910 "cursor %c", pipe_name(pipe)); 13914 13911 if (ret) 13915 13912 goto fail;
+2 -2
drivers/gpu/drm/i915/intel_sprite.c
··· 1171 1171 ret = drm_universal_plane_init(&dev_priv->drm, &intel_plane->base, 1172 1172 possible_crtcs, &intel_plane_funcs, 1173 1173 plane_formats, num_plane_formats, 1174 - DRM_PLANE_TYPE_OVERLAY, 1174 + NULL, DRM_PLANE_TYPE_OVERLAY, 1175 1175 "plane %d%c", plane + 2, pipe_name(pipe)); 1176 1176 else 1177 1177 ret = drm_universal_plane_init(&dev_priv->drm, &intel_plane->base, 1178 1178 possible_crtcs, &intel_plane_funcs, 1179 1179 plane_formats, num_plane_formats, 1180 - DRM_PLANE_TYPE_OVERLAY, 1180 + NULL, DRM_PLANE_TYPE_OVERLAY, 1181 1181 "sprite %c", sprite_name(pipe, plane)); 1182 1182 if (ret) 1183 1183 goto fail;
+2 -2
drivers/gpu/drm/imx/ipuv3-plane.c
··· 718 718 719 719 ret = drm_universal_plane_init(dev, &ipu_plane->base, possible_crtcs, 720 720 &ipu_plane_funcs, ipu_plane_formats, 721 - ARRAY_SIZE(ipu_plane_formats), type, 722 - NULL); 721 + ARRAY_SIZE(ipu_plane_formats), 722 + NULL, type, NULL); 723 723 if (ret) { 724 724 DRM_ERROR("failed to initialize plane\n"); 725 725 kfree(ipu_plane);
+1 -1
drivers/gpu/drm/mediatek/mtk_drm_plane.c
··· 175 175 176 176 err = drm_universal_plane_init(dev, plane, possible_crtcs, 177 177 &mtk_plane_funcs, formats, 178 - ARRAY_SIZE(formats), type, NULL); 178 + ARRAY_SIZE(formats), NULL, type, NULL); 179 179 if (err) { 180 180 DRM_ERROR("failed to initialize plane\n"); 181 181 return err;
+1
drivers/gpu/drm/meson/meson_plane.c
··· 223 223 &meson_plane_funcs, 224 224 supported_drm_formats, 225 225 ARRAY_SIZE(supported_drm_formats), 226 + NULL, 226 227 DRM_PLANE_TYPE_PRIMARY, "meson_primary_plane"); 227 228 228 229 drm_plane_helper_add(plane, &meson_plane_helper_funcs);
+1 -1
drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
··· 401 401 type = private_plane ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY; 402 402 ret = drm_universal_plane_init(dev, plane, 0xff, &mdp4_plane_funcs, 403 403 mdp4_plane->formats, mdp4_plane->nformats, 404 - type, NULL); 404 + NULL, type, NULL); 405 405 if (ret) 406 406 goto fail; 407 407
+2 -2
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
··· 1139 1139 ret = drm_universal_plane_init(dev, plane, 0xff, 1140 1140 &mdp5_cursor_plane_funcs, 1141 1141 mdp5_plane->formats, mdp5_plane->nformats, 1142 - type, NULL); 1142 + NULL, type, NULL); 1143 1143 else 1144 1144 ret = drm_universal_plane_init(dev, plane, 0xff, 1145 1145 &mdp5_plane_funcs, 1146 1146 mdp5_plane->formats, mdp5_plane->nformats, 1147 - type, NULL); 1147 + NULL, type, NULL); 1148 1148 if (ret) 1149 1149 goto fail; 1150 1150
+1 -1
drivers/gpu/drm/mxsfb/mxsfb_drv.c
··· 190 190 } 191 191 192 192 ret = drm_simple_display_pipe_init(drm, &mxsfb->pipe, &mxsfb_funcs, 193 - mxsfb_formats, ARRAY_SIZE(mxsfb_formats), 193 + mxsfb_formats, ARRAY_SIZE(mxsfb_formats), NULL, 194 194 &mxsfb->connector); 195 195 if (ret < 0) { 196 196 dev_err(drm->dev, "Cannot setup simple display pipe\n");
+3 -2
drivers/gpu/drm/nouveau/nv50_display.c
··· 1083 1083 wndw->func = func; 1084 1084 wndw->dmac = dmac; 1085 1085 1086 - ret = drm_universal_plane_init(dev, &wndw->plane, 0, &nv50_wndw, format, 1087 - nformat, type, "%s-%d", name, index); 1086 + ret = drm_universal_plane_init(dev, &wndw->plane, 0, &nv50_wndw, 1087 + format, nformat, NULL, 1088 + type, "%s-%d", name, index); 1088 1089 if (ret) 1089 1090 return ret; 1090 1091
+1 -1
drivers/gpu/drm/omapdrm/omap_plane.c
··· 291 291 292 292 ret = drm_universal_plane_init(dev, plane, possible_crtcs, 293 293 &omap_plane_funcs, formats, 294 - nformats, type, NULL); 294 + nformats, NULL, type, NULL); 295 295 if (ret < 0) 296 296 goto error; 297 297
+1 -1
drivers/gpu/drm/pl111/pl111_display.c
··· 457 457 ret = drm_simple_display_pipe_init(drm, &priv->pipe, 458 458 &pl111_display_funcs, 459 459 formats, ARRAY_SIZE(formats), 460 - &priv->connector.connector); 460 + NULL, &priv->connector.connector); 461 461 if (ret) 462 462 return ret; 463 463
+1 -1
drivers/gpu/drm/qxl/qxl_display.c
··· 784 784 785 785 err = drm_universal_plane_init(&qdev->ddev, plane, possible_crtcs, 786 786 funcs, formats, num_formats, 787 - type, NULL); 787 + NULL, type, NULL); 788 788 if (err) 789 789 goto free_plane; 790 790
+2 -2
drivers/gpu/drm/rcar-du/rcar_du_plane.c
··· 743 743 744 744 ret = drm_universal_plane_init(rcdu->ddev, &plane->plane, crtcs, 745 745 &rcar_du_plane_funcs, formats, 746 - ARRAY_SIZE(formats), type, 747 - NULL); 746 + ARRAY_SIZE(formats), 747 + NULL, type, NULL); 748 748 if (ret < 0) 749 749 return ret; 750 750
+2 -2
drivers/gpu/drm/rcar-du/rcar_du_vsp.c
··· 439 439 1 << vsp->index, 440 440 &rcar_du_vsp_plane_funcs, 441 441 formats_kms, 442 - ARRAY_SIZE(formats_kms), type, 443 - NULL); 442 + ARRAY_SIZE(formats_kms), 443 + NULL, type, NULL); 444 444 if (ret < 0) 445 445 return ret; 446 446
+2 -2
drivers/gpu/drm/rockchip/rockchip_drm_vop.c
··· 1288 1288 0, &vop_plane_funcs, 1289 1289 win_data->phy->data_formats, 1290 1290 win_data->phy->nformats, 1291 - win_data->type, NULL); 1291 + NULL, win_data->type, NULL); 1292 1292 if (ret) { 1293 1293 DRM_DEV_ERROR(vop->dev, "failed to init plane %d\n", 1294 1294 ret); ··· 1327 1327 &vop_plane_funcs, 1328 1328 win_data->phy->data_formats, 1329 1329 win_data->phy->nformats, 1330 - win_data->type, NULL); 1330 + NULL, win_data->type, NULL); 1331 1331 if (ret) { 1332 1332 DRM_DEV_ERROR(vop->dev, "failed to init overlay %d\n", 1333 1333 ret);
+1 -1
drivers/gpu/drm/sti/sti_cursor.c
··· 392 392 &sti_cursor_plane_helpers_funcs, 393 393 cursor_supported_formats, 394 394 ARRAY_SIZE(cursor_supported_formats), 395 - DRM_PLANE_TYPE_CURSOR, NULL); 395 + NULL, DRM_PLANE_TYPE_CURSOR, NULL); 396 396 if (res) { 397 397 DRM_ERROR("Failed to initialize universal plane\n"); 398 398 goto err_plane;
+1 -1
drivers/gpu/drm/sti/sti_gdp.c
··· 931 931 &sti_gdp_plane_helpers_funcs, 932 932 gdp_supported_formats, 933 933 ARRAY_SIZE(gdp_supported_formats), 934 - type, NULL); 934 + NULL, type, NULL); 935 935 if (res) { 936 936 DRM_ERROR("Failed to initialize universal plane\n"); 937 937 goto err;
+1 -1
drivers/gpu/drm/sti/sti_hqvdp.c
··· 1298 1298 &sti_hqvdp_plane_helpers_funcs, 1299 1299 hqvdp_supported_formats, 1300 1300 ARRAY_SIZE(hqvdp_supported_formats), 1301 - DRM_PLANE_TYPE_OVERLAY, NULL); 1301 + NULL, DRM_PLANE_TYPE_OVERLAY, NULL); 1302 1302 if (res) { 1303 1303 DRM_ERROR("Failed to initialize universal plane\n"); 1304 1304 return NULL;
+1 -1
drivers/gpu/drm/stm/ltdc.c
··· 735 735 736 736 ret = drm_universal_plane_init(ddev, plane, possible_crtcs, 737 737 &ltdc_plane_funcs, formats, nb_fmt, 738 - type, NULL); 738 + NULL, type, NULL); 739 739 if (ret < 0) 740 740 return 0; 741 741
+1 -1
drivers/gpu/drm/sun4i/sun4i_layer.c
··· 115 115 ret = drm_universal_plane_init(drm, &layer->plane, 0, 116 116 &sun4i_backend_layer_funcs, 117 117 plane->formats, plane->nformats, 118 - plane->type, NULL); 118 + NULL, plane->type, NULL); 119 119 if (ret) { 120 120 dev_err(drm->dev, "Couldn't initialize layer\n"); 121 121 return ERR_PTR(ret);
+1 -1
drivers/gpu/drm/sun4i/sun8i_layer.c
··· 90 90 ret = drm_universal_plane_init(drm, &layer->plane, 0, 91 91 &sun8i_mixer_layer_funcs, 92 92 plane->formats, plane->nformats, 93 - plane->type, NULL); 93 + NULL, plane->type, NULL); 94 94 if (ret) { 95 95 dev_err(drm->dev, "Couldn't initialize layer\n"); 96 96 return ERR_PTR(ret);
+6 -6
drivers/gpu/drm/tegra/dc.c
··· 678 678 679 679 err = drm_universal_plane_init(drm, &plane->base, possible_crtcs, 680 680 &tegra_primary_plane_funcs, formats, 681 - num_formats, DRM_PLANE_TYPE_PRIMARY, 682 - NULL); 681 + num_formats, NULL, 682 + DRM_PLANE_TYPE_PRIMARY, NULL); 683 683 if (err < 0) { 684 684 kfree(plane); 685 685 return ERR_PTR(err); ··· 844 844 845 845 err = drm_universal_plane_init(drm, &plane->base, 1 << dc->pipe, 846 846 &tegra_cursor_plane_funcs, formats, 847 - num_formats, DRM_PLANE_TYPE_CURSOR, 848 - NULL); 847 + num_formats, NULL, 848 + DRM_PLANE_TYPE_CURSOR, NULL); 849 849 if (err < 0) { 850 850 kfree(plane); 851 851 return ERR_PTR(err); ··· 906 906 907 907 err = drm_universal_plane_init(drm, &plane->base, 1 << dc->pipe, 908 908 &tegra_overlay_plane_funcs, formats, 909 - num_formats, DRM_PLANE_TYPE_OVERLAY, 910 - NULL); 909 + num_formats, NULL, 910 + DRM_PLANE_TYPE_OVERLAY, NULL); 911 911 if (err < 0) { 912 912 kfree(plane); 913 913 return ERR_PTR(err);
+1 -1
drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
··· 225 225 return PTR_ERR(connector); 226 226 227 227 ret = drm_simple_display_pipe_init(drm, &tdev->pipe, funcs, formats, 228 - format_count, connector); 228 + format_count, NULL, connector); 229 229 if (ret) 230 230 return ret; 231 231
+1 -1
drivers/gpu/drm/vc4/vc4_plane.c
··· 902 902 ret = drm_universal_plane_init(dev, plane, 0, 903 903 &vc4_plane_funcs, 904 904 formats, num_formats, 905 - type, NULL); 905 + NULL, type, NULL); 906 906 907 907 drm_plane_helper_add(plane, &vc4_plane_helper_funcs); 908 908
+1 -1
drivers/gpu/drm/virtio/virtgpu_plane.c
··· 298 298 ret = drm_universal_plane_init(dev, plane, 1 << index, 299 299 &virtio_gpu_plane_funcs, 300 300 formats, nformats, 301 - type, NULL); 301 + NULL, type, NULL); 302 302 if (ret) 303 303 goto err_plane_init; 304 304
+2 -2
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
··· 428 428 0, &vmw_ldu_plane_funcs, 429 429 vmw_primary_plane_formats, 430 430 ARRAY_SIZE(vmw_primary_plane_formats), 431 - DRM_PLANE_TYPE_PRIMARY, NULL); 431 + NULL, DRM_PLANE_TYPE_PRIMARY, NULL); 432 432 if (ret) { 433 433 DRM_ERROR("Failed to initialize primary plane"); 434 434 goto err_free; ··· 443 443 0, &vmw_ldu_cursor_funcs, 444 444 vmw_cursor_plane_formats, 445 445 ARRAY_SIZE(vmw_cursor_plane_formats), 446 - DRM_PLANE_TYPE_CURSOR, NULL); 446 + NULL, DRM_PLANE_TYPE_CURSOR, NULL); 447 447 if (ret) { 448 448 DRM_ERROR("Failed to initialize cursor plane"); 449 449 drm_plane_cleanup(&ldu->base.primary);
+2 -2
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
··· 624 624 0, &vmw_sou_plane_funcs, 625 625 vmw_primary_plane_formats, 626 626 ARRAY_SIZE(vmw_primary_plane_formats), 627 - DRM_PLANE_TYPE_PRIMARY, NULL); 627 + NULL, DRM_PLANE_TYPE_PRIMARY, NULL); 628 628 if (ret) { 629 629 DRM_ERROR("Failed to initialize primary plane"); 630 630 goto err_free; ··· 639 639 0, &vmw_sou_cursor_funcs, 640 640 vmw_cursor_plane_formats, 641 641 ARRAY_SIZE(vmw_cursor_plane_formats), 642 - DRM_PLANE_TYPE_CURSOR, NULL); 642 + NULL, DRM_PLANE_TYPE_CURSOR, NULL); 643 643 if (ret) { 644 644 DRM_ERROR("Failed to initialize cursor plane"); 645 645 drm_plane_cleanup(&sou->base.primary);
+2 -2
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
··· 1475 1475 0, &vmw_stdu_plane_funcs, 1476 1476 vmw_primary_plane_formats, 1477 1477 ARRAY_SIZE(vmw_primary_plane_formats), 1478 - DRM_PLANE_TYPE_PRIMARY, NULL); 1478 + NULL, DRM_PLANE_TYPE_PRIMARY, NULL); 1479 1479 if (ret) { 1480 1480 DRM_ERROR("Failed to initialize primary plane"); 1481 1481 goto err_free; ··· 1490 1490 0, &vmw_stdu_cursor_funcs, 1491 1491 vmw_cursor_plane_formats, 1492 1492 ARRAY_SIZE(vmw_cursor_plane_formats), 1493 - DRM_PLANE_TYPE_CURSOR, NULL); 1493 + NULL, DRM_PLANE_TYPE_CURSOR, NULL); 1494 1494 if (ret) { 1495 1495 DRM_ERROR("Failed to initialize cursor plane"); 1496 1496 drm_plane_cleanup(&stdu->base.primary);
+1 -1
drivers/gpu/drm/zte/zx_plane.c
··· 540 540 541 541 ret = drm_universal_plane_init(drm, plane, VOU_CRTC_MASK, 542 542 &zx_plane_funcs, formats, format_count, 543 - type, NULL); 543 + NULL, type, NULL); 544 544 if (ret) { 545 545 DRM_DEV_ERROR(dev, "failed to init universal plane: %d\n", ret); 546 546 return ret;
+21 -1
include/drm/drm_plane.h
··· 392 392 */ 393 393 void (*atomic_print_state)(struct drm_printer *p, 394 394 const struct drm_plane_state *state); 395 + 396 + /** 397 + * @format_mod_supported: 398 + * 399 + * This optional hook is used for the DRM to determine if the given 400 + * format/modifier combination is valid for the plane. This allows the 401 + * DRM to generate the correct format bitmask (which formats apply to 402 + * which modifier). 403 + * 404 + * Returns: 405 + * 406 + * True if the given modifier is valid for that format on the plane. 407 + * False otherwise. 408 + */ 409 + bool (*format_mod_supported)(struct drm_plane *plane, uint32_t format, 410 + uint64_t modifier); 395 411 }; 396 412 397 413 /** ··· 503 487 unsigned int format_count; 504 488 bool format_default; 505 489 490 + uint64_t *modifiers; 491 + unsigned int modifier_count; 492 + 506 493 struct drm_crtc *crtc; 507 494 struct drm_framebuffer *fb; 508 495 ··· 546 527 547 528 #define obj_to_plane(x) container_of(x, struct drm_plane, base) 548 529 549 - __printf(8, 9) 530 + __printf(9, 10) 550 531 int drm_universal_plane_init(struct drm_device *dev, 551 532 struct drm_plane *plane, 552 533 uint32_t possible_crtcs, 553 534 const struct drm_plane_funcs *funcs, 554 535 const uint32_t *formats, 555 536 unsigned int format_count, 537 + const uint64_t *format_modifiers, 556 538 enum drm_plane_type type, 557 539 const char *name, ...); 558 540 int drm_plane_init(struct drm_device *dev,
+1
include/drm/drm_simple_kms_helper.h
··· 122 122 struct drm_simple_display_pipe *pipe, 123 123 const struct drm_simple_display_pipe_funcs *funcs, 124 124 const uint32_t *formats, unsigned int format_count, 125 + const uint64_t *format_modifiers, 125 126 struct drm_connector *connector); 126 127 127 128 #endif /* __LINUX_DRM_SIMPLE_KMS_HELPER_H */
+11
include/uapi/drm/drm_fourcc.h
··· 185 185 #define DRM_FORMAT_MOD_VENDOR_BROADCOM 0x07 186 186 /* add more to the end as needed */ 187 187 188 + #define DRM_FORMAT_RESERVED ((1ULL << 56) - 1) 189 + 188 190 #define fourcc_mod_code(vendor, val) \ 189 191 ((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | (val & 0x00ffffffffffffffULL)) 190 192 ··· 197 195 * similar to the fourcc codes above. drm_fourcc.h is considered the 198 196 * authoritative source for all of these. 199 197 */ 198 + 199 + /* 200 + * Invalid Modifier 201 + * 202 + * This modifier can be used as a sentinel to terminate the format modifiers 203 + * list, or to initialize a variable with an invalid modifier. It might also be 204 + * used to report an error back to userspace for certain APIs. 205 + */ 206 + #define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED) 200 207 201 208 /* 202 209 * Linear Layout