[PATCH RFC v2 19/20] drm/vkms: Introduce support for post-blend color pipeline
Ariel D'Alessandro
ariel.dalessandro at collabora.com
Wed Dec 10 13:15:20 PST 2025
Louis,
On 9/19/25 9:50 AM, Louis Chauvet wrote:
>
>
> Le 18/09/2025 à 02:43, Nícolas F. R. A. Prado a écrit :
>> Introduce a post-blend color pipeline with the same colorop blocks as
>> the pre-blend color pipeline.
>>
>> Signed-off-by: Nícolas F. R. A. Prado <nfraprado at collabora.com>
>> ---
>> drivers/gpu/drm/vkms/vkms_colorop.c | 98 ++++++++++++++++++++++++++
>> ++++++++++
>> drivers/gpu/drm/vkms/vkms_composer.c | 5 +-
>> drivers/gpu/drm/vkms/vkms_crtc.c | 1 +
>> drivers/gpu/drm/vkms/vkms_drv.h | 1 +
>> 4 files changed, 104 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/vkms/vkms_colorop.c b/drivers/gpu/drm/
>> vkms/vkms_colorop.c
>> index
>> 5924ae2bd40fc904048f99bc9b96308140709e25..54c512db68eef16435d5f79453784f7784d540fb 100644
>> --- a/drivers/gpu/drm/vkms/vkms_colorop.c
>> +++ b/drivers/gpu/drm/vkms/vkms_colorop.c
>> @@ -98,6 +98,86 @@ vkms_initialize_pre_blend_color_pipeline(struct
>> drm_plane *plane,
>> return ret;
>> }
>> +static int
>> +vkms_initialize_post_blend_color_pipeline(struct drm_crtc *crtc,
>> + struct drm_prop_enum_list *list)
>> +{
>> + struct drm_colorop *ops[MAX_COLOR_PIPELINE_OPS];
>> + struct drm_device *dev = crtc->dev;
>> + int ret;
>> + int i = 0;
>> +
>> + memset(ops, 0, sizeof(ops));
>> +
>> + /* 1st op: 1d curve */
>> + ops[i] = kzalloc(sizeof(*ops[i]), GFP_KERNEL);
>> + if (!ops[i]) {
>> + ret = -ENOMEM;
>> + goto cleanup;
>> + }
>> +
>> + ret = drm_crtc_colorop_curve_1d_init(dev, ops[i], crtc,
>> supported_tfs,
>> + DRM_COLOROP_FLAG_ALLOW_BYPASS);
>> + if (ret)
>> + goto cleanup;
>> +
>> + list->type = ops[i]->base.id;
>> + list->name = kasprintf(GFP_KERNEL, "Color Pipeline %d", ops[i]-
>> >base.id);
>> +
>> + i++;
>> +
>> + /* 2nd op: 3x4 matrix */
>> + ops[i] = kzalloc(sizeof(*ops[i]), GFP_KERNEL);
>> + if (!ops[i]) {
>> + ret = -ENOMEM;
>> + goto cleanup;
>> + }
>> +
>> + ret = drm_crtc_colorop_ctm_3x4_init(dev, ops[i], crtc,
>> DRM_COLOROP_FLAG_ALLOW_BYPASS);
>> + if (ret)
>> + goto cleanup;
>> +
>> + drm_colorop_set_next_property(ops[i - 1], ops[i]);
>> +
>> + i++;
>> +
>> + /* 3rd op: 3x4 matrix */
>> + ops[i] = kzalloc(sizeof(*ops[i]), GFP_KERNEL);
>> + if (!ops[i]) {
>> + ret = -ENOMEM;
>> + goto cleanup;
>> + }
>> +
>> + ret = drm_crtc_colorop_ctm_3x4_init(dev, ops[i], crtc,
>> DRM_COLOROP_FLAG_ALLOW_BYPASS);
>> + if (ret)
>> + goto cleanup;
>> +
>> + drm_colorop_set_next_property(ops[i - 1], ops[i]);
>> +
>> + i++;
>> +
>> + /* 4th op: 1d curve */
>> + ops[i] = kzalloc(sizeof(*ops[i]), GFP_KERNEL);
>> + if (!ops[i]) {
>> + ret = -ENOMEM;
>> + goto cleanup;
>> + }
>> +
>> + ret = drm_crtc_colorop_curve_1d_init(dev, ops[i], crtc,
>> supported_tfs,
>> + DRM_COLOROP_FLAG_ALLOW_BYPASS);
>> + if (ret)
>> + goto cleanup;
>> +
>> + drm_colorop_set_next_property(ops[i - 1], ops[i]);
>> +
>> + return 0;
>> +
>> +cleanup:
>> + drm_colorop_pipeline_destroy(dev);
>
> Same comment as for pre_blend colorops, it feel strange to destroy all
> the pipelines here.
>
> The suggestion in [1] is better (don't forget to add the kfree).
>
> [1]: https://lore.kernel.org/all/73f01810-df2d-4e39-a20b-
> fc1cec2c5e12 at amd.com/
Ack, will be addressed in v3.
Regards,
--
Ariel D'Alessandro
Software Engineer
Collabora Ltd.
Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK
Registered in England & Wales, no. 5513718
More information about the linux-arm-kernel
mailing list