From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2062.outbound.protection.outlook.com [40.107.237.62]) by gabe.freedesktop.org (Postfix) with ESMTPS id 25E1810E7E8 for ; Wed, 8 Nov 2023 16:40:43 +0000 (UTC) From: Harry Wentland To: Date: Wed, 8 Nov 2023 11:39:59 -0500 Message-ID: <20231108164006.106967-11-harry.wentland@amd.com> In-Reply-To: <20231108164006.106967-1-harry.wentland@amd.com> References: <20231108164006.106967-1-harry.wentland@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Subject: [igt-dev] [RFC PATCH v3 10/12] lib/igt_kms: Add support for DATA colorop property List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: Signed-off-by: Harry Wentland --- lib/igt_kms.c | 33 +++++++++++++++++++++++++++++++++ lib/igt_kms.h | 12 ++++++++---- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 504ceaf04b2c..84b4a54b4828 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -689,6 +689,7 @@ const char * const igt_colorop_prop_names[IGT_NUM_COLOROP_PROPS] = { [IGT_COLOROP_TYPE] = "TYPE", [IGT_COLOROP_BYPASS] = "BYPASS", [IGT_COLOROP_CURVE_1D_TYPE] = "CURVE_1D_TYPE", + [IGT_COLOROP_DATA] = "DATA", [IGT_COLOROP_NEXT] = "NEXT", }; @@ -4210,6 +4211,38 @@ igt_plane_replace_prop_blob(igt_plane_t *plane, enum igt_atomic_plane_properties igt_plane_set_prop_changed(plane, prop); } +/** + * igt_colorop_replace_prop_blob: + * @plane: colorop to set property on. + * @prop: property for which the blob will be replaced. + * @ptr: Pointer to contents for the property. + * @length: Length of contents. + * + * This function will destroy the old property blob for the given property, + * and will create a new property blob with the values passed to this function. + * + * The new property blob will be committed when you call igt_display_commit(), + * igt_display_commit2() or igt_display_commit_atomic(). + */ +void +igt_colorop_replace_prop_blob(igt_colorop_t *colorop, enum igt_atomic_colorop_properties prop, const void *ptr, size_t length) +{ + igt_display_t *display = colorop->plane->pipe->display; + uint64_t *blob = &colorop->values[prop]; + uint32_t blob_id = 0; + + if (*blob != 0) + igt_assert(drmModeDestroyPropertyBlob(display->drm_fd, + *blob) == 0); + + if (length > 0) + igt_assert(drmModeCreatePropertyBlob(display->drm_fd, + ptr, length, &blob_id) == 0); + + *blob = blob_id; + igt_colorop_set_prop_changed(colorop, prop); +} + /** * igt_colorop_try_prop_enum: * @colorop: Target colorop. diff --git a/lib/igt_kms.h b/lib/igt_kms.h index e121f0ca6e41..405f8850098c 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -334,6 +334,7 @@ enum igt_atomic_colorop_properties { IGT_COLOROP_TYPE, IGT_COLOROP_BYPASS, IGT_COLOROP_CURVE_1D_TYPE, + IGT_COLOROP_DATA, IGT_COLOROP_NEXT, IGT_NUM_COLOROP_PROPS }; @@ -831,12 +832,15 @@ extern void igt_plane_set_prop_enum(igt_plane_t *plane, enum igt_atomic_plane_properties prop, const char *val); - +extern void igt_plane_replace_prop_blob(igt_plane_t *plane, + enum igt_atomic_plane_properties prop, + const void *ptr, size_t length); 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. @@ -878,9 +882,9 @@ extern void igt_colorop_set_prop_enum(igt_colorop_t *colorop, enum igt_atomic_colorop_properties prop, const char *val); -extern void igt_plane_replace_prop_blob(igt_plane_t *plane, - enum igt_atomic_plane_properties prop, - const void *ptr, size_t length); +extern void igt_colorop_replace_prop_blob(igt_colorop_t *colorop, + enum igt_atomic_colorop_properties prop, + const void *ptr, size_t length); /** * igt_output_has_prop: -- 2.42.0