From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2040.outbound.protection.outlook.com [40.107.93.40]) by gabe.freedesktop.org (Postfix) with ESMTPS id 66F7010E56E for ; Thu, 19 Oct 2023 21:23:28 +0000 (UTC) From: Harry Wentland To: Date: Thu, 19 Oct 2023 17:22:57 -0400 Message-ID: <20231019212301.245282-5-harry.wentland@amd.com> In-Reply-To: <20231019212301.245282-1-harry.wentland@amd.com> References: <20231019212301.245282-1-harry.wentland@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Subject: [igt-dev] [RFC PATCH v2 4/8] lib/igt_kms: Add new COLOR PIPELINE plane property List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sasha McIntosh , Liviu Dudau , Victoria Brekenfeld , =?UTF-8?q?Michel=20D=C3=A4nzer?= , Sebastian Wick , Shashank Sharma , Christopher Braga , =?UTF-8?q?Jonas=20=C3=85dahl?= , Naseer Ahmed , Aleix Pol , Alexander Goins , Pekka Paalanen , Simon Ser , Hector Martin , Xaver Hugl , Sima , Joshua Ashton Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: Signed-off-by: Harry Wentland Cc: Ville Syrjala Cc: Pekka Paalanen Cc: Simon Ser Cc: Harry Wentland Cc: Melissa Wen Cc: Jonas Ådahl Cc: Sebastian Wick Cc: Shashank Sharma Cc: Alexander Goins Cc: Joshua Ashton Cc: Michel Dänzer Cc: Aleix Pol Cc: Xaver Hugl Cc: Victoria Brekenfeld Cc: Sima Cc: Uma Shankar Cc: Naseer Ahmed Cc: Christopher Braga Cc: Abhinav Kumar Cc: Arthur Grillo Cc: Hector Martin Cc: Liviu Dudau Cc: Sasha McIntosh --- lib/igt_kms.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ lib/igt_kms.h | 10 ++++++++++ 2 files changed, 63 insertions(+) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index cd36e778bae7..a03eae8fa992 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -616,6 +616,7 @@ const char * const igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = { [IGT_PLANE_ZPOS] = "zpos", [IGT_PLANE_FB_DAMAGE_CLIPS] = "FB_DAMAGE_CLIPS", [IGT_PLANE_SCALING_FILTER] = "SCALING_FILTER", + [IGT_PLANE_COLOR_PIPELINE] = "COLOR_PIPELINE", }; const char * const igt_colorop_prop_names[IGT_NUM_COLOROP_PROPS] = { @@ -705,6 +706,27 @@ igt_colorop_t *igt_find_colorop(igt_display_t *display, uint32_t id) return NULL; } +static void +igt_fill_plane_color_pipelines(igt_display_t *display, igt_plane_t *plane, + drmModePropertyPtr prop) +{ + int i; + + plane->num_color_pipelines = 0; + + for (i = 0; i < prop->count_enums; i++) { + igt_colorop_t *colorop = igt_find_colorop(display, prop->enums[i].value); + + if (colorop) { + plane->color_pipelines[plane->num_color_pipelines++] = colorop; + memcpy(colorop->name, prop->enums[i].name, sizeof(colorop->name)); + } + } + + igt_assert(plane->num_color_pipelines < IGT_NUM_PLANE_COLOR_PIPELINES); + +} + /* * Retrieve all the properies specified in props_name and store them into * plane->props. @@ -736,6 +758,9 @@ igt_fill_plane_props(igt_display_t *display, igt_plane_t *plane, if (strcmp(prop->name, "rotation") == 0) plane->rotations = igt_plane_rotations(display, plane, prop); + if (strcmp(prop->name, "COLOR_PIPELINE") == 0) + igt_fill_plane_color_pipelines(display, plane, prop); + drmModeFreeProperty(prop); } @@ -3998,6 +4023,29 @@ bool igt_colorop_try_prop_enum(igt_display_t *display, return true; } +bool igt_plane_is_valid_colorop(igt_plane_t *plane, igt_colorop_t *colorop) +{ + int i; + bool found = false; + + for (i = 0; i < plane->num_color_pipelines; i++) { + if (plane->color_pipelines[i] == colorop) { + found = true; + break; + } + } + + return found; +} + +void igt_plane_set_color_pipeline(igt_plane_t *plane, igt_colorop_t *colorop) +{ + igt_assert(igt_plane_is_valid_colorop(plane, colorop)); + + plane->assigned_color_pipeline = colorop; + igt_plane_set_prop_enum(plane, IGT_PLANE_COLOR_PIPELINE, colorop->name); +} + void igt_colorop_set_prop_enum(igt_display_t *display, igt_colorop_t *colorop, enum igt_atomic_colorop_properties prop, @@ -4277,6 +4325,11 @@ static int igt_atomic_commit(igt_display_t *display, uint32_t flags, void *user_ if (plane->changed) igt_atomic_prepare_plane_commit(plane, pipe_obj, req); + + /* TODO iterate over assigned color pipeline and prepare colorop commit */ + if (plane->assigned_color_pipeline) + igt_atomic_prepare_colorop_commit(plane->assigned_color_pipeline, + pipe_obj, req); } } diff --git a/lib/igt_kms.h b/lib/igt_kms.h index c6402979d10f..c24ae0017ff6 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -326,6 +326,7 @@ enum igt_atomic_plane_properties { IGT_PLANE_SCALING_FILTER, IGT_PLANE_HOTSPOT_X, IGT_PLANE_HOTSPOT_Y, + IGT_PLANE_COLOR_PIPELINE, IGT_NUM_PLANE_PROPS }; @@ -362,6 +363,8 @@ typedef struct igt_display igt_display_t; typedef struct igt_pipe igt_pipe_t; typedef uint32_t igt_fixed_t; /* 16.16 fixed point */ +#define IGT_NUM_PLANE_COLOR_PIPELINES 4 + typedef enum { /* this maps to the kernel API */ IGT_ROTATION_0 = 1 << 0, @@ -431,6 +434,11 @@ typedef struct igt_plane { uint64_t *modifiers; uint32_t *formats; int format_mod_count; + + igt_colorop_t *color_pipelines[IGT_NUM_PLANE_COLOR_PIPELINES]; + int num_color_pipelines; + + igt_colorop_t *assigned_color_pipeline; } igt_plane_t; /* @@ -777,6 +785,8 @@ extern void igt_plane_set_prop_enum(igt_plane_t *plane, extern bool igt_plane_is_valid_colorop(igt_plane_t *plane, igt_colorop_t *colorop); +extern void igt_plane_set_color_pipeline(igt_plane_t *plane, igt_colorop_t *colorop); + /** * igt_colorop_has_prop: * @colorop: colorop to check. -- 2.42.0