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

Configure Feed

Select the types of activity you want to include in your feed.

drm/colorop: allow non-bypass colorops

Not all HW will be able to do bypass on all color
operations. Introduce an 32 bits 'flags' for all colorop
init functions and DRM_COLOROP_FLAG_ALLOW_BYPASS for creating
the BYPASS property when it's true.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Signed-off-by: Simon Ser <contact@emersion.fr>
Link: https://patch.msgid.link/20251115000237.3561250-45-alex.hung@amd.com

authored by

Harry Wentland and committed by
Simon Ser
24689634 7fa3ee8c

+62 -39
+15 -7
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c
··· 65 65 goto cleanup; 66 66 } 67 67 68 - ret = drm_plane_colorop_curve_1d_init(dev, ops[i], plane, amdgpu_dm_supported_degam_tfs); 68 + ret = drm_plane_colorop_curve_1d_init(dev, ops[i], plane, 69 + amdgpu_dm_supported_degam_tfs, 70 + DRM_COLOROP_FLAG_ALLOW_BYPASS); 69 71 if (ret) 70 72 goto cleanup; 71 73 ··· 83 81 goto cleanup; 84 82 } 85 83 86 - ret = drm_plane_colorop_mult_init(dev, ops[i], plane); 84 + ret = drm_plane_colorop_mult_init(dev, ops[i], plane, DRM_COLOROP_FLAG_ALLOW_BYPASS); 87 85 if (ret) 88 86 goto cleanup; 89 87 ··· 98 96 goto cleanup; 99 97 } 100 98 101 - ret = drm_plane_colorop_ctm_3x4_init(dev, ops[i], plane); 99 + ret = drm_plane_colorop_ctm_3x4_init(dev, ops[i], plane, DRM_COLOROP_FLAG_ALLOW_BYPASS); 102 100 if (ret) 103 101 goto cleanup; 104 102 ··· 113 111 goto cleanup; 114 112 } 115 113 116 - ret = drm_plane_colorop_curve_1d_init(dev, ops[i], plane, amdgpu_dm_supported_shaper_tfs); 114 + ret = drm_plane_colorop_curve_1d_init(dev, ops[i], plane, 115 + amdgpu_dm_supported_shaper_tfs, 116 + DRM_COLOROP_FLAG_ALLOW_BYPASS); 117 117 if (ret) 118 118 goto cleanup; 119 119 ··· 131 127 } 132 128 133 129 ret = drm_plane_colorop_curve_1d_lut_init(dev, ops[i], plane, MAX_COLOR_LUT_ENTRIES, 134 - DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR); 130 + DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR, 131 + DRM_COLOROP_FLAG_ALLOW_BYPASS); 135 132 if (ret) 136 133 goto cleanup; 137 134 ··· 147 142 goto cleanup; 148 143 } 149 144 150 - ret = drm_plane_colorop_curve_1d_init(dev, ops[i], plane, amdgpu_dm_supported_blnd_tfs); 145 + ret = drm_plane_colorop_curve_1d_init(dev, ops[i], plane, 146 + amdgpu_dm_supported_blnd_tfs, 147 + DRM_COLOROP_FLAG_ALLOW_BYPASS); 151 148 if (ret) 152 149 goto cleanup; 153 150 ··· 165 158 } 166 159 167 160 ret = drm_plane_colorop_curve_1d_lut_init(dev, ops[i], plane, MAX_COLOR_LUT_ENTRIES, 168 - DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR); 161 + DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR, 162 + DRM_COLOROP_FLAG_ALLOW_BYPASS); 169 163 if (ret) 170 164 goto cleanup; 171 165
+2 -1
drivers/gpu/drm/drm_atomic.c
··· 787 787 788 788 drm_printf(p, "colorop[%u]:\n", colorop->base.id); 789 789 drm_printf(p, "\ttype=%s\n", drm_get_colorop_type_name(colorop->type)); 790 - drm_printf(p, "\tbypass=%u\n", state->bypass); 790 + if (colorop->bypass_property) 791 + drm_printf(p, "\tbypass=%u\n", state->bypass); 791 792 792 793 switch (colorop->type) { 793 794 case DRM_COLOROP_1D_CURVE:
+25 -18
drivers/gpu/drm/drm_colorop.c
··· 85 85 /* Init Helpers */ 86 86 87 87 static int drm_plane_colorop_init(struct drm_device *dev, struct drm_colorop *colorop, 88 - struct drm_plane *plane, enum drm_colorop_type type) 88 + struct drm_plane *plane, enum drm_colorop_type type, 89 + uint32_t flags) 89 90 { 90 91 struct drm_mode_config *config = &dev->mode_config; 91 92 struct drm_property *prop; ··· 122 121 colorop->type_property, 123 122 colorop->type); 124 123 125 - /* bypass */ 126 - prop = drm_property_create_bool(dev, DRM_MODE_PROP_ATOMIC, 127 - "BYPASS"); 128 - if (!prop) 129 - return -ENOMEM; 124 + if (flags & DRM_COLOROP_FLAG_ALLOW_BYPASS) { 125 + /* bypass */ 126 + prop = drm_property_create_bool(dev, DRM_MODE_PROP_ATOMIC, 127 + "BYPASS"); 128 + if (!prop) 129 + return -ENOMEM; 130 130 131 - colorop->bypass_property = prop; 132 - drm_object_attach_property(&colorop->base, 133 - colorop->bypass_property, 134 - 1); 131 + colorop->bypass_property = prop; 132 + drm_object_attach_property(&colorop->base, 133 + colorop->bypass_property, 134 + 1); 135 + } 135 136 136 137 /* next */ 137 138 prop = drm_property_create_object(dev, DRM_MODE_PROP_IMMUTABLE | DRM_MODE_PROP_ATOMIC, ··· 198 195 * @supported_tfs: A bitfield of supported drm_plane_colorop_curve_1d_init enum values, 199 196 * created using BIT(curve_type) and combined with the OR '|' 200 197 * operator. 198 + * @flags: bitmask of misc, see DRM_COLOROP_FLAG_* defines. 201 199 * @return zero on success, -E value on failure 202 200 */ 203 201 int drm_plane_colorop_curve_1d_init(struct drm_device *dev, struct drm_colorop *colorop, 204 - struct drm_plane *plane, u64 supported_tfs) 202 + struct drm_plane *plane, u64 supported_tfs, uint32_t flags) 205 203 { 206 204 struct drm_prop_enum_list enum_list[DRM_COLOROP_1D_CURVE_COUNT]; 207 205 int i, len; ··· 223 219 return -EINVAL; 224 220 } 225 221 226 - ret = drm_plane_colorop_init(dev, colorop, plane, DRM_COLOROP_1D_CURVE); 222 + ret = drm_plane_colorop_init(dev, colorop, plane, DRM_COLOROP_1D_CURVE, flags); 227 223 if (ret) 228 224 return ret; 229 225 ··· 282 278 * @plane: The associated drm_plane 283 279 * @lut_size: LUT size supported by driver 284 280 * @interpolation: 1D LUT interpolation type 281 + * @flags: bitmask of misc, see DRM_COLOROP_FLAG_* defines. 285 282 * @return zero on success, -E value on failure 286 283 */ 287 284 int drm_plane_colorop_curve_1d_lut_init(struct drm_device *dev, struct drm_colorop *colorop, 288 285 struct drm_plane *plane, uint32_t lut_size, 289 - enum drm_colorop_lut1d_interpolation_type interpolation) 286 + enum drm_colorop_lut1d_interpolation_type interpolation, 287 + uint32_t flags) 290 288 { 291 289 struct drm_property *prop; 292 290 int ret; 293 291 294 - ret = drm_plane_colorop_init(dev, colorop, plane, DRM_COLOROP_1D_LUT); 292 + ret = drm_plane_colorop_init(dev, colorop, plane, DRM_COLOROP_1D_LUT, flags); 295 293 if (ret) 296 294 return ret; 297 295 ··· 331 325 EXPORT_SYMBOL(drm_plane_colorop_curve_1d_lut_init); 332 326 333 327 int drm_plane_colorop_ctm_3x4_init(struct drm_device *dev, struct drm_colorop *colorop, 334 - struct drm_plane *plane) 328 + struct drm_plane *plane, uint32_t flags) 335 329 { 336 330 int ret; 337 331 338 - ret = drm_plane_colorop_init(dev, colorop, plane, DRM_COLOROP_CTM_3X4); 332 + ret = drm_plane_colorop_init(dev, colorop, plane, DRM_COLOROP_CTM_3X4, flags); 339 333 if (ret) 340 334 return ret; 341 335 ··· 355 349 * @dev: DRM device 356 350 * @colorop: The drm_colorop object to initialize 357 351 * @plane: The associated drm_plane 352 + * @flags: bitmask of misc, see DRM_COLOROP_FLAG_* defines. 358 353 * @return zero on success, -E value on failure 359 354 */ 360 355 int drm_plane_colorop_mult_init(struct drm_device *dev, struct drm_colorop *colorop, 361 - struct drm_plane *plane) 356 + struct drm_plane *plane, uint32_t flags) 362 357 { 363 358 struct drm_property *prop; 364 359 int ret; 365 360 366 - ret = drm_plane_colorop_init(dev, colorop, plane, DRM_COLOROP_MULTIPLIER); 361 + ret = drm_plane_colorop_init(dev, colorop, plane, DRM_COLOROP_MULTIPLIER, flags); 367 362 if (ret) 368 363 return ret; 369 364
+6 -4
drivers/gpu/drm/vkms/vkms_colorop.c
··· 31 31 goto cleanup; 32 32 } 33 33 34 - ret = drm_plane_colorop_curve_1d_init(dev, ops[i], plane, supported_tfs); 34 + ret = drm_plane_colorop_curve_1d_init(dev, ops[i], plane, supported_tfs, 35 + DRM_COLOROP_FLAG_ALLOW_BYPASS); 35 36 if (ret) 36 37 goto cleanup; 37 38 ··· 49 48 goto cleanup; 50 49 } 51 50 52 - ret = drm_plane_colorop_ctm_3x4_init(dev, ops[i], plane); 51 + ret = drm_plane_colorop_ctm_3x4_init(dev, ops[i], plane, DRM_COLOROP_FLAG_ALLOW_BYPASS); 53 52 if (ret) 54 53 goto cleanup; 55 54 ··· 65 64 goto cleanup; 66 65 } 67 66 68 - ret = drm_plane_colorop_ctm_3x4_init(dev, ops[i], plane); 67 + ret = drm_plane_colorop_ctm_3x4_init(dev, ops[i], plane, DRM_COLOROP_FLAG_ALLOW_BYPASS); 69 68 if (ret) 70 69 goto cleanup; 71 70 ··· 81 80 goto cleanup; 82 81 } 83 82 84 - ret = drm_plane_colorop_curve_1d_init(dev, ops[i], plane, supported_tfs); 83 + ret = drm_plane_colorop_curve_1d_init(dev, ops[i], plane, supported_tfs, 84 + DRM_COLOROP_FLAG_ALLOW_BYPASS); 85 85 if (ret) 86 86 goto cleanup; 87 87
+14 -9
include/drm/drm_colorop.h
··· 31 31 #include <drm/drm_mode.h> 32 32 #include <drm/drm_property.h> 33 33 34 + /* DRM colorop flags */ 35 + #define DRM_COLOROP_FLAG_ALLOW_BYPASS (1<<0) /* Allow bypass on the drm_colorop */ 36 + 34 37 /** 35 38 * enum drm_colorop_curve_1d_type - type of 1D curve 36 39 * ··· 259 256 * @bypass_property: 260 257 * 261 258 * Boolean property to control enablement of the color 262 - * operation. Setting bypass to "true" shall always be supported 263 - * in order to allow compositors to quickly fall back to 264 - * alternate methods of color processing. This is important 265 - * since setting color operations can fail due to unique 266 - * HW constraints. 259 + * operation. Only present if DRM_COLOROP_FLAG_ALLOW_BYPASS 260 + * flag is set. When present, setting bypass to "true" shall 261 + * always be supported to allow compositors to quickly fall 262 + * back to alternate methods of color processing. This is 263 + * important since setting color operations can fail due to 264 + * unique HW constraints. 267 265 */ 268 266 struct drm_property *bypass_property; 269 267 ··· 357 353 void drm_colorop_cleanup(struct drm_colorop *colorop); 358 354 359 355 int drm_plane_colorop_curve_1d_init(struct drm_device *dev, struct drm_colorop *colorop, 360 - struct drm_plane *plane, u64 supported_tfs); 356 + struct drm_plane *plane, u64 supported_tfs, uint32_t flags); 361 357 int drm_plane_colorop_curve_1d_lut_init(struct drm_device *dev, struct drm_colorop *colorop, 362 358 struct drm_plane *plane, uint32_t lut_size, 363 - enum drm_colorop_lut1d_interpolation_type interpolation); 359 + enum drm_colorop_lut1d_interpolation_type interpolation, 360 + uint32_t flags); 364 361 int drm_plane_colorop_ctm_3x4_init(struct drm_device *dev, struct drm_colorop *colorop, 365 - struct drm_plane *plane); 362 + struct drm_plane *plane, uint32_t flags); 366 363 int drm_plane_colorop_mult_init(struct drm_device *dev, struct drm_colorop *colorop, 367 - struct drm_plane *plane); 364 + struct drm_plane *plane, uint32_t flags); 368 365 369 366 struct drm_colorop_state * 370 367 drm_atomic_helper_colorop_duplicate_state(struct drm_colorop *colorop);