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: Add multiplier type

This introduces a new drm_colorop_type: DRM_COLOROP_MULTIPLIER.

It's a simple multiplier to all pixel values. The value is
specified via a S31.32 fixed point provided via the
"MULTIPLIER" property.

Reviewed-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
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-41-alex.hung@amd.com

authored by

Alex Hung and committed by
Simon Ser
34101080 16e0f785

+67
+3
drivers/gpu/drm/drm_atomic.c
··· 801 801 case DRM_COLOROP_CTM_3X4: 802 802 drm_printf(p, "\tdata blob id=%d\n", state->data ? state->data->base.id : 0); 803 803 break; 804 + case DRM_COLOROP_MULTIPLIER: 805 + drm_printf(p, "\tmultiplier=%llu\n", state->multiplier); 806 + break; 804 807 default: 805 808 break; 806 809 }
+4
drivers/gpu/drm/drm_atomic_uapi.c
··· 728 728 state->bypass = val; 729 729 } else if (property == colorop->curve_1d_type_property) { 730 730 state->curve_1d_type = val; 731 + } else if (property == colorop->multiplier_property) { 732 + state->multiplier = val; 731 733 } else if (property == colorop->data_property) { 732 734 return drm_atomic_color_set_data_property(colorop, state, 733 735 property, val); ··· 755 753 *val = state->bypass; 756 754 else if (property == colorop->curve_1d_type_property) 757 755 *val = state->curve_1d_type; 756 + else if (property == colorop->multiplier_property) 757 + *val = state->multiplier; 758 758 else if (property == colorop->size_property) 759 759 *val = colorop->size; 760 760 else if (property == colorop->data_property)
+33
drivers/gpu/drm/drm_colorop.c
··· 66 66 { DRM_COLOROP_1D_CURVE, "1D Curve" }, 67 67 { DRM_COLOROP_1D_LUT, "1D LUT" }, 68 68 { DRM_COLOROP_CTM_3X4, "3x4 Matrix"}, 69 + { DRM_COLOROP_MULTIPLIER, "Multiplier"}, 69 70 }; 70 71 71 72 static const char * const colorop_curve_1d_type_names[] = { ··· 326 325 } 327 326 EXPORT_SYMBOL(drm_plane_colorop_ctm_3x4_init); 328 327 328 + /** 329 + * drm_plane_colorop_mult_init - Initialize a DRM_COLOROP_MULTIPLIER 330 + * 331 + * @dev: DRM device 332 + * @colorop: The drm_colorop object to initialize 333 + * @plane: The associated drm_plane 334 + * @return zero on success, -E value on failure 335 + */ 336 + int drm_plane_colorop_mult_init(struct drm_device *dev, struct drm_colorop *colorop, 337 + struct drm_plane *plane) 338 + { 339 + struct drm_property *prop; 340 + int ret; 341 + 342 + ret = drm_plane_colorop_init(dev, colorop, plane, DRM_COLOROP_MULTIPLIER); 343 + if (ret) 344 + return ret; 345 + 346 + prop = drm_property_create_range(dev, DRM_MODE_PROP_ATOMIC, "MULTIPLIER", 0, U64_MAX); 347 + if (!prop) 348 + return -ENOMEM; 349 + 350 + colorop->multiplier_property = prop; 351 + drm_object_attach_property(&colorop->base, colorop->multiplier_property, 0); 352 + 353 + drm_colorop_reset(colorop); 354 + 355 + return 0; 356 + } 357 + EXPORT_SYMBOL(drm_plane_colorop_mult_init); 358 + 329 359 static void __drm_atomic_helper_colorop_duplicate_state(struct drm_colorop *colorop, 330 360 struct drm_colorop_state *state) 331 361 { ··· 447 415 [DRM_COLOROP_1D_CURVE] = "1D Curve", 448 416 [DRM_COLOROP_1D_LUT] = "1D LUT", 449 417 [DRM_COLOROP_CTM_3X4] = "3x4 Matrix", 418 + [DRM_COLOROP_MULTIPLIER] = "Multiplier", 450 419 }; 451 420 452 421 const char *drm_get_colorop_type_name(enum drm_colorop_type type)
+16
include/drm/drm_colorop.h
··· 145 145 enum drm_colorop_curve_1d_type curve_1d_type; 146 146 147 147 /** 148 + * @multiplier: 149 + * 150 + * Multiplier to 'gain' the plane. Format is S31.32 sign-magnitude. 151 + */ 152 + uint64_t multiplier; 153 + 154 + /** 148 155 * @data: 149 156 * 150 157 * Data blob for any TYPE that requires such a blob. The ··· 279 272 struct drm_property *curve_1d_type_property; 280 273 281 274 /** 275 + * @multiplier_property: 276 + * 277 + * Multiplier property for plane gain 278 + */ 279 + struct drm_property *multiplier_property; 280 + 281 + /** 282 282 * @size_property: 283 283 * 284 284 * Size property for custom LUT from userspace. ··· 343 329 struct drm_plane *plane, uint32_t lut_size); 344 330 int drm_plane_colorop_ctm_3x4_init(struct drm_device *dev, struct drm_colorop *colorop, 345 331 struct drm_plane *plane); 332 + int drm_plane_colorop_mult_init(struct drm_device *dev, struct drm_colorop *colorop, 333 + struct drm_plane *plane); 346 334 347 335 struct drm_colorop_state * 348 336 drm_atomic_helper_colorop_duplicate_state(struct drm_colorop *colorop);
+11
include/uapi/drm/drm_mode.h
··· 931 931 * | B | | 8 9 10 12 | | B | 932 932 */ 933 933 DRM_COLOROP_CTM_3X4, 934 + 935 + /** 936 + * @DRM_COLOROP_MULTIPLIER: 937 + * 938 + * enum string "Multiplier" 939 + * 940 + * A simple multiplier, applied to all color values. The 941 + * multiplier is specified as a S31.32 via the MULTIPLIER 942 + * property. 943 + */ 944 + DRM_COLOROP_MULTIPLIER, 934 945 }; 935 946 936 947 /**