Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DBFE4606A320 for ; Tue, 1 Dec 2026 19:03:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=uJwLX+56 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 57A9D10FC1F; Tue, 1 Dec 2026 19:03:36 +0000 (UTC) Received: from BN8PR05CU002.outbound.protection.outlook.com (mail-eastus2azon11011027.outbound.protection.outlook.com [52.101.57.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4D86E10FC03 for ; Tue, 1 Dec 2026 19:03:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oqgKhy4Q7T+jsubIHU8xvriP/aQJEryqrwVcBiAazQ6DCvADHllYF6s94F6AiERt1QB+ABy4DsV/d1IfOfa4AWnpX0AtbcWR50QgDWX9TC/Pc17pL2AvBabNGUIrl1hFOWBbI1TqGCEMdu2sMz8GMAIJVGwxxpljaVi0woi+lvvgWM0z+XWOt1RijHyMRCZQ8c4oNUnnDcn4O0YlS5fB941jQ2QJcKIGLgdUdNRLCMcjcy++KQa0smirpSxuEzTvT8r8EeeKVCE2XDpgDlLPMLE2k8TCteWF3MGhEWU9NeCV4FCWL5UwraYjsAsc91B2M8+ne70nESwTYWeGfMhmQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3uc6H1Kgm6W/N/GJFKAFXx35IAxcelyyA4FCTlo8zMQ=; b=nClBp3qdkkX4rA+AGgCHmRcSyv90PJYamP4YmEM1UXSkQw9cVnXJOVszkd1ptH6QsUWT7fLDe18LFJrRTrJX8mK9LDZq9+wcMmPo7fE8cNQcUFqbZ/wTJU96mfvUjd0esMAIxNGAVIZh3hQJVCAH6NW7rnDXbfmLYCBYnDrpDIgqrQgcyVtBiSHQMn7dxhd3ehBCSQbhty1V0cg242Om4LdQaasLM5weqqJBEBA9hswdwx5zr5kLcwggM7jzMVhvpu3fk9Y+9z+YDz3IyhsqUkoCrO4tGjdEEA7/SwFybaAjl154h+i9PgV1fEbHaL9IIjzjson1c5bQ5WuyCoKpHg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3uc6H1Kgm6W/N/GJFKAFXx35IAxcelyyA4FCTlo8zMQ=; b=uJwLX+56eZ3z0Y0o+1DzTlkcbC1n7Znkvtc3GLvjCwYdp+j332K3WmeYUfumGHVLEaFU331bw10NNiTic8OEfJSWgwOcbjq7YBfilxqe/0TvVt2SqiOwiBattNc5yz57MNti3FkABUDm0FbYO+TUFgQZBkx58P7Ih6UaxvFjaOw= Received: from DS7P220CA0075.NAMP220.PROD.OUTLOOK.COM (2603:10b6:8:259::17) by SN7PR12MB6837.namprd12.prod.outlook.com (2603:10b6:806:267::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Tue, 1 Dec 2026 19:03:18 +0000 Received: from DM3PEPF000265B2.namprd02.prod.outlook.com (2603:10b6:8:259:cafe::47) by DS7P220CA0075.outlook.office365.com (2603:10b6:8:259::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.10 via Frontend Transport; Tue, 1 Dec 2026 19:03:18 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by DM3PEPF000265B2.mail.protection.outlook.com (10.167.23.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.3 via Frontend Transport; Tue, 1 Dec 2026 19:03:18 +0000 Received: from georzhanmkm.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Tue, 1 Dec 2026 13:03:16 -0600 From: George Zhang To: CC: Harry Wentland , Leo Li , Aurabindo Pillai , Roman Li , Wayne Lin , Tom Chung , "Fangzhi Zuo" , Dan Wheeler , Ray Wu , Ivan Lipski , Alex Hung , James Lin , Chenyu Chen , Rafal Ostrowski , Alvin Lee , George Zhang Subject: [PATCH 10/30] drm/amd/display: Make DPP_SET_INPUT_TRANSFER_FUNC BLS compliant Date: Tue, 1 Dec 2026 13:57:46 -0500 Message-ID: <20261201190245.360906-11-george.zhang@amd.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261201190245.360906-1-george.zhang@amd.com> References: <20261201190245.360906-1-george.zhang@amd.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: satlexmb08.amd.com (10.181.42.217) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM3PEPF000265B2:EE_|SN7PR12MB6837:EE_ X-MS-Office365-Filtering-Correlation-Id: deddf5b6-0c0d-4f25-3345-08df4fddc2be X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|36860700016|23010399003|82310400026|10067099003|56012099006|261026140227099003|261021123027099003|261026121527099003|261022105027099003|261021121427099003|261102123227099003|261028144727099003|11063799006|261009223027099003|22082099003|18002099003|6133799003|3023799007; X-Microsoft-Antispam-Message-Info: TMPDX3iS6xgm3cv+gi+bCewQKxaci7Q2iY9OQ31eW5/KFbcpJ/sBXU+Bm3xen9JlfpTB4vWcP7Xn1+tFdD4qaiKRoPT8DH61LTkKz76eN/MKHMJjYqbSWedrFWnamsPh7LwmdJR/DQHgkd5+VmYyESAUPAxLXnFXuyXTQu8fQa0Uj8zxV7XJtGNVVJnYgdE5wOGhfl1x5FC4lhFgUiSmwbQnZY/n26X2X3C/qefYQniSAUnXM5XKX07z9YbYXv3Sb15uBaAcB1hfziRNts0OsFuMbtm7BrpfIsyCChR/smBlbx7DC2WxBE7TdsOFiTRY81KtRWIovZbCk6ZXzNYA8G2c9G2lh+EcO3rjepDobqmWNwF8GYksUXtPHxcxAA9t9nbEz+RyEEvrhAPonLiEU4BA6Tfaj5nXPKq7wKOQzvIczC5uhbVRvF1zVOt/IKMUX+qQ2IByr6V8nRPYjHBJk88Wi7juoIczk95nfc/kb8gqMN9L7eaEGFIOz/SfdynWQ11lCMl0amd+TnGSbL6ENa/r6rLeN08WCAiOzpUxWA1NT19TQ6irYa5xeoEnCRhq2bE1DX/WV7UIb2wETXb/qseXtltY+LoZe+qclaht03Kaxlv/QCCYXPh5qpGIQ0Z4UrDwXoULnkiBt2bAITjMSJZYA+N/fTH7w13mqczdl6aIL2YeyLLTGpE6KeUjaivH5pWqnNDEWNDt3LvsNZjymw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:satlexmb07.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(1800799024)(36860700016)(23010399003)(82310400026)(10067099003)(56012099006)(261026140227099003)(261021123027099003)(261026121527099003)(261022105027099003)(261021121427099003)(261102123227099003)(261028144727099003)(11063799006)(261009223027099003)(22082099003)(18002099003)(6133799003)(3023799007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iAViv7JTmK9KoXxZX3a1SFQ+jroDio5CnuagtE1QiJmiGtKE7MKiLEAmf33FJDc1crQVoPAl8yHwSltatAifH5N+HMKnIXnsc7w/KoM1ZyVUaYIzQqwX+AHe7zQI+ckrm4imdwFRVBeHK8bIqMoWvrNZjYByh1Xnr1OgimUYB7Ymk5lnTOtUE5ETGiaKQQN03ix4ztPdMSlTyYSw3gf5fYuV72titbNS/rEtVmjUFJC6sxJjH6svPx9aCNfGI0tlAoI12TMfNXTco7J0NAOehN0IMTtgWwFl2HMaTh+rkP5fMTC/n57NT8RQtPMxZOF9+MstqugxHwGEBfEVw8dsTz/igW/iFjJtBCGUCmDDU+JOaaVDQkffkTrb+RXwNhIO9Kvkc1Y9BBY4bzgDhlmGE7lUipxpIXTS2sEV1Guf4gFN35TO2YLNtzmMKEI+w23H X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2026 19:03:18.2760 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: deddf5b6-0c0d-4f25-3345-08df4fddc2be X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM3PEPF000265B2.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6837 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "amd-gfx" X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 From: Rafal Ostrowski [Why] - The DPP_SET_INPUT_TRANSFER_FUNC step carried dc, stream and plane_state, so the hwseq hooks read plane and stream state at execute time. [How] - Add hwss_resolve_set_input_transfer_func_params(). It copies the pixel format, the CM enable flags and the RMCM pool by value, and borrows the curve and LUT data from the plane state. - Build the step from the resolved params in hwss_add_dpp_set_input_transfer_func(), hwss_build_fast_sequence() and dcn401_program_pipe_sequence(). The adder validates its arguments and the hook; the executor only dispatches. - Pass the resolved params to set_blend_lut, set_shaper_3dlut and disable_rmcm_luts, and drop dc, stream and plane_state from them. - Give set_mcm_luts and set_rmcm_luts their own argument structs, set_mcm_luts_params and set_rmcm_luts_params. The dispatcher fills them from the step params, so each hook sees only the fields it uses. - set_mcm_luts() still reads dpp->ctx. It passes it to cm3_helper_translate_curve_to_hw_format(), which uses it only for the logger, so it cannot be dropped without changing that shared helper. - Move MAX_RMCM_INST to hw_shared.h. Cc: Alvin Lee Signed-off-by: Rafal Ostrowski Signed-off-by: George Zhang --- .../drm/amd/display/dc/core/dc_hw_sequencer.c | 125 ++++++++++-------- .../amd/display/dc/hwss/dce110/dce110_hwseq.c | 19 ++- .../amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 15 +-- .../amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 45 +++---- .../amd/display/dc/hwss/dcn20/dcn20_hwseq.h | 5 +- .../amd/display/dc/hwss/dcn30/dcn30_hwseq.c | 32 ++--- .../amd/display/dc/hwss/dcn30/dcn30_hwseq.h | 2 +- .../amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 102 ++++++++------ .../amd/display/dc/hwss/dcn32/dcn32_hwseq.h | 5 +- .../amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 3 +- .../amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 74 ++++++----- .../amd/display/dc/hwss/dcn401/dcn401_hwseq.h | 5 +- .../amd/display/dc/hwss/dcn42/dcn42_hwseq.c | 56 ++++---- .../amd/display/dc/hwss/dcn42/dcn42_hwseq.h | 13 +- .../amd/display/dc/hwss/dcn60/dcn60_hwseq.c | 33 ++--- .../amd/display/dc/hwss/dcn60/dcn60_hwseq.h | 2 +- .../drm/amd/display/dc/hwss/hw_sequencer.h | 56 +++++++- .../display/dc/hwss/hw_sequencer_private.h | 17 +-- .../gpu/drm/amd/display/dc/inc/core_types.h | 2 - .../gpu/drm/amd/display/dc/inc/hw/hw_shared.h | 2 + 20 files changed, 348 insertions(+), 265 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c index 583dcd8c8e2f..4107648cc88c 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c @@ -116,6 +116,52 @@ void hwss_dmub_fams2_update_config(union block_sequence_params *params) dc_dmub_srv_fams2_update_config(p->dmub_srv, &p->data); } +/* + * Resolve everything DPP_SET_INPUT_TRANSFER_FUNC needs from the pipe and plane, + * so the hwseq implementation never reads dc, stream or plane state. + */ +void hwss_resolve_set_input_transfer_func_params(struct dc *dc, + struct pipe_ctx *pipe_ctx, + struct set_input_transfer_func_params *params) +{ + struct pipe_ctx *primary_dpp_pipe = resource_get_primary_dpp_pipe(pipe_ctx); + const struct dc_plane_state *plane_state = pipe_ctx->plane_state; + + *params = (struct set_input_transfer_func_params) { + .hws = dc->hwseq, + .dpp = pipe_ctx->plane_res.dpp, + .hubp = pipe_ctx->plane_res.hubp, + .primary_hubp = primary_dpp_pipe ? + primary_dpp_pipe->plane_res.hubp : pipe_ctx->plane_res.hubp, + .mpc = dc->res_pool->mpc, + .rmcm = pipe_ctx->plane_res.rmcm, + .mpcc_id = pipe_ctx->plane_res.mpcc_inst, + .ipp = pipe_ctx->plane_res.ipp, + .always_use_regamma = dc->debug.always_use_regamma, + }; + + if (dc->res_pool->res_cap) { + int rmcm_count = dc->res_pool->res_cap->num_rmcm; + + params->rmcm_pool = dc->res_pool->rmcm; + params->rmcm_count = rmcm_count < MAX_RMCM_INST ? rmcm_count : MAX_RMCM_INST; + } + + if (!plane_state) + return; + + params->format = plane_state->format; + params->scaling_linearity = plane_state->scaling_linearity; + params->blend_enable = plane_state->cm.flags.bits.blend_enable != 0; + params->shaper_enable = plane_state->cm.flags.bits.shaper_enable != 0; + params->lut3d_enable = plane_state->cm.flags.bits.lut3d_enable != 0; + params->lut3d_dma_enable = plane_state->cm.flags.bits.lut3d_dma_enable != 0; + params->rmcm_enable = plane_state->cm.flags.bits.rmcm_enable != 0; + params->in_transfer_func = &plane_state->in_transfer_func; + params->gamma_correction = &plane_state->gamma_correction; + params->cm = &plane_state->cm; +} + #define MAX_NUM_MCACHE 8 /* used as index in array of black_color_format */ @@ -1541,26 +1587,12 @@ void hwss_build_fast_sequence(struct dc *dc, block_sequence[*num_steps].func = HUBP_ENABLE_3DLUT_FL; (*num_steps)++; } - if (hws->funcs.set_input_transfer_func && current_mpc_pipe->plane_state->update_bits.gamma_change) { - struct pipe_ctx *primary_dpp_pipe = - resource_get_primary_dpp_pipe(current_mpc_pipe); - - block_sequence[*num_steps].params.set_input_transfer_func_params = - (struct set_input_transfer_func_params) { - .dc = dc, - .dpp = current_mpc_pipe->plane_res.dpp, - .hubp = current_mpc_pipe->plane_res.hubp, - .primary_hubp = primary_dpp_pipe ? - primary_dpp_pipe->plane_res.hubp : current_mpc_pipe->plane_res.hubp, - .ipp = current_mpc_pipe->plane_res.ipp, - .mpc = dc->res_pool->mpc, - .rmcm = current_mpc_pipe->plane_res.rmcm, - .mpcc_id = current_mpc_pipe->plane_res.mpcc_inst, - .stream = current_mpc_pipe->stream, - .plane_state = current_mpc_pipe->plane_state, - }; - block_sequence[*num_steps].func = DPP_SET_INPUT_TRANSFER_FUNC; - (*num_steps)++; + if (current_mpc_pipe->plane_state->update_bits.gamma_change) { + struct set_input_transfer_func_params itf_params; + + hwss_resolve_set_input_transfer_func_params(dc, current_mpc_pipe, + &itf_params); + hwss_add_dpp_set_input_transfer_func(&seq_state, &itf_params); } if (current_mpc_pipe->plane_state->update_bits.hdr_mult) { @@ -1737,7 +1769,7 @@ void hwss_execute_sequence(struct dc *dc, params->update_plane_addr_params.dcc); break; case DPP_SET_INPUT_TRANSFER_FUNC: - hws->funcs.set_input_transfer_func(¶ms->set_input_transfer_func_params); + hwss_dpp_set_input_transfer_func(params); break; case DPP_PROGRAM_GAMUT_REMAP: if (dc->hwss.program_gamut_remap) @@ -2391,27 +2423,18 @@ void hwss_add_hubp_update_plane_addr(struct block_sequence_state *seq_state, /* * Helper function to add DPP set input transfer function to block sequence */ -void hwss_add_dpp_set_input_transfer_func(struct block_sequence_state *seq_state, struct dc *dc, - struct pipe_ctx *pipe_ctx) +void hwss_add_dpp_set_input_transfer_func(struct block_sequence_state *seq_state, + const struct set_input_transfer_func_params *params) { + if (!seq_state || !seq_state->steps || !seq_state->num_steps || !params || !params->hws || + !params->hws->funcs.set_input_transfer_func) + return; + if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) { - struct pipe_ctx *primary_dpp_pipe = resource_get_primary_dpp_pipe(pipe_ctx); + struct block_sequence *step = &seq_state->steps[*seq_state->num_steps]; - seq_state->steps[*seq_state->num_steps].params.set_input_transfer_func_params = - (struct set_input_transfer_func_params) { - .dc = dc, - .dpp = pipe_ctx->plane_res.dpp, - .hubp = pipe_ctx->plane_res.hubp, - .primary_hubp = primary_dpp_pipe ? - primary_dpp_pipe->plane_res.hubp : pipe_ctx->plane_res.hubp, - .ipp = pipe_ctx->plane_res.ipp, - .mpc = dc->res_pool->mpc, - .rmcm = pipe_ctx->plane_res.rmcm, - .mpcc_id = pipe_ctx->plane_res.mpcc_inst, - .plane_state = pipe_ctx->plane_state, - .stream = pipe_ctx->stream, - }; - seq_state->steps[*seq_state->num_steps].func = DPP_SET_INPUT_TRANSFER_FUNC; + step->params.set_input_transfer_func_params = *params; + step->func = DPP_SET_INPUT_TRANSFER_FUNC; (*seq_state->num_steps)++; } } @@ -4942,24 +4965,20 @@ void hwss_disable_audio_stream(struct dc *dc, union block_sequence_params *param void hwss_set_input_transfer_func(struct dc *dc, struct pipe_ctx *pipe_ctx) { if (dc->hwseq->funcs.set_input_transfer_func) { - struct pipe_ctx *primary_dpp_pipe = resource_get_primary_dpp_pipe(pipe_ctx); + struct set_input_transfer_func_params params; - dc->hwseq->funcs.set_input_transfer_func(&(struct set_input_transfer_func_params) { - .dc = dc, - .dpp = pipe_ctx->plane_res.dpp, - .hubp = pipe_ctx->plane_res.hubp, - .primary_hubp = primary_dpp_pipe ? - primary_dpp_pipe->plane_res.hubp : pipe_ctx->plane_res.hubp, - .ipp = pipe_ctx->plane_res.ipp, - .mpc = dc->res_pool->mpc, - .rmcm = pipe_ctx->plane_res.rmcm, - .mpcc_id = pipe_ctx->plane_res.mpcc_inst, - .plane_state = pipe_ctx->plane_state, - .stream = pipe_ctx->stream, - }); + hwss_resolve_set_input_transfer_func_params(dc, pipe_ctx, ¶ms); + dc->hwseq->funcs.set_input_transfer_func(¶ms); } } +void hwss_dpp_set_input_transfer_func(union block_sequence_params *params) +{ + struct set_input_transfer_func_params *itf_params = ¶ms->set_input_transfer_func_params; + + itf_params->hws->funcs.set_input_transfer_func(itf_params); +} + void hwss_prepare_bandwidth(struct dc *dc, union block_sequence_params *params) { if (dc && dc->hwss.prepare_bandwidth) diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c index 363961f700d9..3db6a408129d 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c @@ -261,11 +261,11 @@ static bool dce110_enable_display_power_gating( } static void dce110_prescale_params(struct ipp_prescale_params *prescale_params, - const struct dc_plane_state *plane_state) + enum surface_pixel_format format) { prescale_params->mode = IPP_PRESCALE_MODE_FIXED_UNSIGNED; - switch (plane_state->format) { + switch (format) { case SURFACE_PIXEL_FORMAT_GRPH_RGB565: prescale_params->scale = 0x2082; break; @@ -293,22 +293,19 @@ static bool dce110_set_input_transfer_func(struct set_input_transfer_func_params *params) { struct input_pixel_processor *ipp = params->ipp; - struct dc_plane_state *plane_state = params->plane_state; - const struct dc_transfer_func *tf = NULL; + const struct dc_transfer_func *tf = params->in_transfer_func; struct ipp_prescale_params prescale_params = { 0 }; bool result = true; - if (ipp == NULL) + if (ipp == NULL || tf == NULL) return false; - tf = &plane_state->in_transfer_func; - - dce110_prescale_params(&prescale_params, plane_state); + dce110_prescale_params(&prescale_params, params->format); ipp->funcs->ipp_program_prescale(ipp, &prescale_params); - if (!plane_state->gamma_correction.is_identity && - dce_use_lut(plane_state->format)) - ipp->funcs->ipp_program_input_lut(ipp, &plane_state->gamma_correction); + if (!params->gamma_correction->is_identity && + dce_use_lut(params->format)) + ipp->funcs->ipp_program_input_lut(ipp, params->gamma_correction); if (tf->type == TF_TYPE_PREDEFINED) { switch (tf->tf) { diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c index 5ce73286f8f2..10f755d7b182 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c @@ -2119,19 +2119,16 @@ void dcn10_update_plane_addr(const struct dc *dc, struct pipe_ctx *pipe_ctx) bool dcn10_set_input_transfer_func(struct set_input_transfer_func_params *params) { struct dpp *dpp = params->dpp; - struct dc_plane_state *plane_state = params->plane_state; - const struct dc_transfer_func *tf = NULL; + const struct dc_transfer_func *tf = params->in_transfer_func; bool result = true; - if (dpp == NULL) + if (dpp == NULL || tf == NULL) return false; - tf = &plane_state->in_transfer_func; - - if (!dpp->ctx->dc->debug.always_use_regamma - && !plane_state->gamma_correction.is_identity - && dce_use_lut(plane_state->format)) - dpp->funcs->dpp_program_input_lut(dpp, &plane_state->gamma_correction); + if (!params->always_use_regamma + && !params->gamma_correction->is_identity + && dce_use_lut(params->format)) + dpp->funcs->dpp_program_input_lut(dpp, params->gamma_correction); if (tf->type == TF_TYPE_PREDEFINED) { switch (tf->tf) { diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c index 356ca90bf9bb..0f88195a5487 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c @@ -723,7 +723,8 @@ void dcn20_plane_atomic_disable(struct dc *dc, struct pipe_ctx *pipe_ctx) /* Clearing 3DLUT fast load writes to HUBP, so it must precede hubp_clk_cntl() below */ if (hws->funcs.disable_rmcm_luts) - hws->funcs.disable_rmcm_luts(dc, pipe_ctx->plane_res.rmcm, hubp, pipe_ctx->plane_res.mpcc_inst); + hws->funcs.disable_rmcm_luts(dc->res_pool->rmcm, dc->res_pool->res_cap->num_rmcm, + pipe_ctx->plane_res.rmcm, hubp, pipe_ctx->plane_res.mpcc_inst); dc->hwss.wait_for_mpcc_disconnect(dc, dc->res_pool, pipe_ctx); @@ -1088,16 +1089,16 @@ bool dcn20_set_output_transfer_func(struct set_output_transfer_func_params *otf_ } bool dcn20_set_blend_lut( - struct dpp *dpp, struct dc_plane_state *plane_state) + struct dpp *dpp, const struct dc_transfer_func *blend_func) { bool result = true; const struct pwl_params *blend_lut = NULL; - if (plane_state->cm.blend_func.type == TF_TYPE_HWPWL) - blend_lut = &plane_state->cm.blend_func.pwl; - else if (plane_state->cm.blend_func.type == TF_TYPE_DISTRIBUTED_POINTS) { - cm_helper_translate_curve_to_hw_format(plane_state->ctx, - &plane_state->cm.blend_func, + if (blend_func->type == TF_TYPE_HWPWL) + blend_lut = &blend_func->pwl; + else if (blend_func->type == TF_TYPE_DISTRIBUTED_POINTS) { + cm_helper_translate_curve_to_hw_format(dpp->ctx, + blend_func, &dpp->regamma_params, false); blend_lut = &dpp->regamma_params; } @@ -1107,24 +1108,25 @@ bool dcn20_set_blend_lut( } bool dcn20_set_shaper_3dlut( - struct dpp *dpp, struct dc_plane_state *plane_state) + struct dpp *dpp, const struct dc_transfer_func *shaper_func, + const struct dc_3dlut *lut3d_func) { bool result = true; const struct pwl_params *shaper_lut = NULL; - if (plane_state->cm.shaper_func.type == TF_TYPE_HWPWL) - shaper_lut = &plane_state->cm.shaper_func.pwl; - else if (plane_state->cm.shaper_func.type == TF_TYPE_DISTRIBUTED_POINTS) { - cm_helper_translate_curve_to_hw_format(plane_state->ctx, - &plane_state->cm.shaper_func, + if (shaper_func->type == TF_TYPE_HWPWL) + shaper_lut = &shaper_func->pwl; + else if (shaper_func->type == TF_TYPE_DISTRIBUTED_POINTS) { + cm_helper_translate_curve_to_hw_format(dpp->ctx, + shaper_func, &dpp->shaper_params, true); shaper_lut = &dpp->shaper_params; } dpp->funcs->dpp_program_shaper_lut(dpp, shaper_lut); - if (plane_state->cm.lut3d_func.state.bits.initialized == 1) + if (lut3d_func->state.bits.initialized == 1) result = dpp->funcs->dpp_program_3dlut(dpp, - &plane_state->cm.lut3d_func.lut_3d); + &lut3d_func->lut_3d); else result = dpp->funcs->dpp_program_3dlut(dpp, NULL); @@ -1134,19 +1136,16 @@ bool dcn20_set_shaper_3dlut( bool dcn20_set_input_transfer_func(struct set_input_transfer_func_params *params) { struct dpp *dpp = params->dpp; - struct dc_plane_state *plane_state = params->plane_state; - struct dce_hwseq *hws = params->dc->hwseq; - const struct dc_transfer_func *tf = NULL; + struct dce_hwseq *hws = params->hws; + const struct dc_transfer_func *tf = params->in_transfer_func; bool result = true; bool use_degamma_ram = false; - if (dpp == NULL || plane_state == NULL) + if (dpp == NULL || tf == NULL) return false; - hws->funcs.set_shaper_3dlut(dpp, plane_state); - hws->funcs.set_blend_lut(dpp, plane_state); - - tf = &plane_state->in_transfer_func; + hws->funcs.set_shaper_3dlut(dpp, ¶ms->cm->shaper_func, ¶ms->cm->lut3d_func); + hws->funcs.set_blend_lut(dpp, ¶ms->cm->blend_func); if (tf->type == TF_TYPE_HWPWL || tf->type == TF_TYPE_DISTRIBUTED_POINTS) use_degamma_ram = true; diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.h b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.h index e2f65c3748de..30ac1f009531 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.h +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.h @@ -31,9 +31,10 @@ void dcn20_log_color_state(struct dc *dc, struct dc_log_buffer_ctx *log_ctx); bool dcn20_set_blend_lut( - struct dpp *dpp, struct dc_plane_state *plane_state); + struct dpp *dpp, const struct dc_transfer_func *blend_func); bool dcn20_set_shaper_3dlut( - struct dpp *dpp, struct dc_plane_state *plane_state); + struct dpp *dpp, const struct dc_transfer_func *shaper_func, + const struct dc_3dlut *lut3d_func); void dcn20_program_front_end_for_ctx( struct dc *dc, struct dc_state *context); diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c index c4500617dc85..7c873e5c48fa 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c @@ -234,16 +234,16 @@ void dcn30_log_color_state(struct dc *dc, } bool dcn30_set_blend_lut( - struct dpp *dpp, struct dc_plane_state *plane_state) + struct dpp *dpp, const struct dc_transfer_func *blend_func) { bool result = true; const struct pwl_params *blend_lut = NULL; - if (plane_state->cm.blend_func.type == TF_TYPE_HWPWL) - blend_lut = &plane_state->cm.blend_func.pwl; - else if (plane_state->cm.blend_func.type == TF_TYPE_DISTRIBUTED_POINTS) { + if (blend_func->type == TF_TYPE_HWPWL) + blend_lut = &blend_func->pwl; + else if (blend_func->type == TF_TYPE_DISTRIBUTED_POINTS) { result = cm3_helper_translate_curve_to_degamma_hw_format( - &plane_state->cm.blend_func, + blend_func, &dpp->regamma_params); if (!result) return result; @@ -315,36 +315,36 @@ static bool dcn30_set_mpc_shaper_3dlut(struct dpp *dpp, struct mpc *mpc, bool dcn30_set_input_transfer_func(struct set_input_transfer_func_params *params) { struct dpp *dpp = params->dpp; - struct dce_hwseq *hws = params->dc->hwseq; - struct dc_plane_state *plane_state = params->plane_state; + struct dce_hwseq *hws = params->hws; + const struct dc_transfer_func *in_tf = params->in_transfer_func; enum dc_transfer_func_predefined tf; bool result = true; const struct pwl_params *pwl_params = NULL; - if (dpp == NULL || plane_state == NULL) + if (dpp == NULL || in_tf == NULL) return false; tf = TRANSFER_FUNCTION_UNITY; - if (plane_state->in_transfer_func.type == TF_TYPE_PREDEFINED) - tf = plane_state->in_transfer_func.tf; + if (in_tf->type == TF_TYPE_PREDEFINED) + tf = in_tf->tf; dpp->funcs->dpp_set_pre_degam(dpp, tf); - if (plane_state->in_transfer_func.type == TF_TYPE_HWPWL) - pwl_params = &plane_state->in_transfer_func.pwl; - else if (plane_state->in_transfer_func.type == TF_TYPE_DISTRIBUTED_POINTS && - cm3_helper_translate_curve_to_degamma_hw_format(&plane_state->in_transfer_func, + if (in_tf->type == TF_TYPE_HWPWL) + pwl_params = &in_tf->pwl; + else if (in_tf->type == TF_TYPE_DISTRIBUTED_POINTS && + cm3_helper_translate_curve_to_degamma_hw_format(in_tf, &dpp->degamma_params)) pwl_params = &dpp->degamma_params; result = dpp->funcs->dpp_program_gamcor_lut(dpp, pwl_params); if (dpp->funcs->dpp_program_blnd_lut) - hws->funcs.set_blend_lut(dpp, plane_state); + hws->funcs.set_blend_lut(dpp, ¶ms->cm->blend_func); if (dpp->funcs->dpp_program_shaper_lut && dpp->funcs->dpp_program_3dlut) - hws->funcs.set_shaper_3dlut(dpp, plane_state); + hws->funcs.set_shaper_3dlut(dpp, ¶ms->cm->shaper_func, ¶ms->cm->lut3d_func); return result; diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.h b/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.h index 61470a51da23..70cf1f6fe904 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.h +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.h @@ -57,7 +57,7 @@ void dcn30_log_color_state(struct dc *dc, struct dc_log_buffer_ctx *log_ctx); bool dcn30_set_blend_lut(struct dpp *dpp, - struct dc_plane_state *plane_state); + const struct dc_transfer_func *blend_func); bool dcn30_set_input_transfer_func(struct set_input_transfer_func_params *params); diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c index 945052b1808f..cdb80e96cf31 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c @@ -466,25 +466,21 @@ bool dcn32_set_mpc_shaper_3dlut(struct dpp *dpp, struct mpc *mpc, return result; } -bool dcn32_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp, - struct hubp *primary_hubp, struct mpc *mpc, int mpcc_id, - struct dc_stream_state *stream, - struct dc_plane_state *plane_state) +bool dcn32_set_mcm_luts(const struct set_mcm_luts_params *params) { + struct dpp *dpp = params->dpp; + struct mpc *mpc = params->mpc; + int mpcc_id = params->mpcc_id; bool rval, result; const struct pwl_params *lut_params = NULL; - - (void)dc; - (void)hubp; - (void)primary_hubp; - (void)stream; + const struct dc_plane_cm *cm = params->cm; // 1D LUT - if (plane_state->cm.blend_func.type == TF_TYPE_HWPWL) - lut_params = &plane_state->cm.blend_func.pwl; - else if (plane_state->cm.blend_func.type == TF_TYPE_DISTRIBUTED_POINTS) { + if (cm->blend_func.type == TF_TYPE_HWPWL) + lut_params = &cm->blend_func.pwl; + else if (cm->blend_func.type == TF_TYPE_DISTRIBUTED_POINTS) { result = cm3_helper_translate_curve_to_degamma_hw_format( - &plane_state->cm.blend_func, + &cm->blend_func, &dpp->regamma_params); if (!result) return result; @@ -495,12 +491,12 @@ bool dcn32_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp, lut_params = NULL; // Shaper - if (plane_state->cm.shaper_func.type == TF_TYPE_HWPWL) - lut_params = &plane_state->cm.shaper_func.pwl; - else if (plane_state->cm.shaper_func.type == TF_TYPE_DISTRIBUTED_POINTS) { + if (cm->shaper_func.type == TF_TYPE_HWPWL) + lut_params = &cm->shaper_func.pwl; + else if (cm->shaper_func.type == TF_TYPE_DISTRIBUTED_POINTS) { // TODO: dpp replace - rval = cm3_helper_translate_curve_to_hw_format(plane_state->ctx, - &plane_state->cm.shaper_func, + rval = cm3_helper_translate_curve_to_hw_format(dpp->ctx, + &cm->shaper_func, &dpp->shaper_params, true); lut_params = rval ? &dpp->shaper_params : NULL; @@ -509,8 +505,8 @@ bool dcn32_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp, mpc->funcs->program_shaper(mpc, lut_params, mpcc_id); // 3D - if (plane_state->cm.lut3d_func.state.bits.initialized == 1) - result = mpc->funcs->program_3dlut(mpc, &plane_state->cm.lut3d_func.lut_3d, mpcc_id); + if (cm->lut3d_func.state.bits.initialized == 1) + result = mpc->funcs->program_3dlut(mpc, &cm->lut3d_func.lut_3d, mpcc_id); else result = mpc->funcs->program_3dlut(mpc, NULL, mpcc_id); @@ -537,32 +533,32 @@ static bool is_source_pixel_format_linear(enum surface_pixel_format format) bool dcn32_set_input_transfer_func(struct set_input_transfer_func_params *params) { - struct dce_hwseq *hws = params->dc->hwseq; + struct dce_hwseq *hws = params->hws; struct dpp *dpp = params->dpp; - struct dc_plane_state *plane_state = params->plane_state; + const struct dc_transfer_func *in_tf = params->in_transfer_func; enum dc_transfer_func_predefined tf; bool result = true; const struct pwl_params *pwl_params = NULL; - if (params->mpc == NULL || plane_state == NULL) + if (params->mpc == NULL || in_tf == NULL) return false; tf = TRANSFER_FUNCTION_UNITY; - if (plane_state->in_transfer_func.type == TF_TYPE_PREDEFINED) - tf = plane_state->in_transfer_func.tf; + if (in_tf->type == TF_TYPE_PREDEFINED) + tf = in_tf->tf; if (dpp->funcs->dpp_set_pregam_state) - dpp->funcs->dpp_set_pregam_state(dpp, tf, plane_state->scaling_linearity, - is_source_pixel_format_linear(plane_state->format)); + dpp->funcs->dpp_set_pregam_state(dpp, tf, params->scaling_linearity, + is_source_pixel_format_linear(params->format)); else dpp->funcs->dpp_set_pre_degam(dpp, tf); - if (plane_state->in_transfer_func.type == TF_TYPE_HWPWL) - pwl_params = &plane_state->in_transfer_func.pwl; - else if (plane_state->in_transfer_func.type == TF_TYPE_DISTRIBUTED_POINTS && - cm3_helper_translate_curve_to_degamma_hw_format(&plane_state->in_transfer_func, + if (in_tf->type == TF_TYPE_HWPWL) + pwl_params = &in_tf->pwl; + else if (in_tf->type == TF_TYPE_DISTRIBUTED_POINTS && + cm3_helper_translate_curve_to_degamma_hw_format(in_tf, &dpp->degamma_params)) pwl_params = &dpp->degamma_params; @@ -571,20 +567,46 @@ bool dcn32_set_input_transfer_func(struct set_input_transfer_func_params *params /* MCM and RMCM are mutually exclusive - tear the inactive one out before programming * the active one, which then owns the shared HUBP 3DLUT fast load. */ - if (plane_state->cm.flags.bits.rmcm_enable && hws->funcs.set_rmcm_luts) { + if (params->rmcm_enable && hws->funcs.set_rmcm_luts) { + const struct set_rmcm_luts_params rmcm_params = { + .dpp = params->dpp, + .hubp = params->hubp, + .rmcm = params->rmcm, + .rmcm_pool = params->rmcm_pool, + .rmcm_count = params->rmcm_count, + .mpcc_id = params->mpcc_id, + .shaper_enable = params->shaper_enable, + .lut3d_enable = params->lut3d_enable, + .lut3d_dma_enable = params->lut3d_dma_enable, + .cm = params->cm, + }; + if (hws->funcs.disable_mcm_luts) hws->funcs.disable_mcm_luts(params->mpc, params->mpcc_id); - result = hws->funcs.set_rmcm_luts(params); + result = hws->funcs.set_rmcm_luts(&rmcm_params); } else { if (hws->funcs.disable_rmcm_luts) - hws->funcs.disable_rmcm_luts(params->dc, params->rmcm, - params->hubp, params->mpcc_id); - - if (hws->funcs.set_mcm_luts) - result = hws->funcs.set_mcm_luts(params->dc, dpp, params->hubp, - params->primary_hubp, params->mpc, params->mpcc_id, - params->stream, plane_state); + hws->funcs.disable_rmcm_luts(params->rmcm_pool, params->rmcm_count, + params->rmcm, params->hubp, params->mpcc_id); + + if (hws->funcs.set_mcm_luts) { + const struct set_mcm_luts_params mcm_params = { + .dpp = params->dpp, + .hubp = params->hubp, + .primary_hubp = params->primary_hubp, + .mpc = params->mpc, + .mpcc_id = params->mpcc_id, + .blend_enable = params->blend_enable, + .shaper_enable = params->shaper_enable, + .lut3d_enable = params->lut3d_enable, + .lut3d_dma_enable = params->lut3d_dma_enable, + .rmcm_enable = params->rmcm_enable, + .cm = params->cm, + }; + + result = hws->funcs.set_mcm_luts(&mcm_params); + } } return result; diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.h b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.h index 3db34bff3847..3c6650ef7b53 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.h +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.h @@ -48,10 +48,7 @@ void dcn32_cab_for_ss_control(struct dc *dc, bool enable); void dcn32_commit_subvp_config(struct dc *dc, struct dc_state *context); -bool dcn32_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp, - struct hubp *primary_hubp, struct mpc *mpc, int mpcc_id, - struct dc_stream_state *stream, - struct dc_plane_state *plane_state); +bool dcn32_set_mcm_luts(const struct set_mcm_luts_params *params); bool dcn32_set_input_transfer_func(struct set_input_transfer_func_params *params); diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c index d24569870a2d..8ecd7aac5367 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c @@ -893,7 +893,8 @@ void dcn35_plane_atomic_disable(struct dc *dc, struct pipe_ctx *pipe_ctx) /* Clearing 3DLUT fast load writes to HUBP, so it must precede hubp_clk_cntl() below */ if (hws->funcs.disable_rmcm_luts) - hws->funcs.disable_rmcm_luts(dc, pipe_ctx->plane_res.rmcm, hubp, pipe_ctx->plane_res.mpcc_inst); + hws->funcs.disable_rmcm_luts(dc->res_pool->rmcm, dc->res_pool->res_cap->num_rmcm, + pipe_ctx->plane_res.rmcm, hubp, pipe_ctx->plane_res.mpcc_inst); dc->hwss.wait_for_mpcc_disconnect(dc, dc->res_pool, pipe_ctx); diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c index 26b9137dc017..01ee57c88ca7 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c @@ -419,12 +419,15 @@ void dcn401_trigger_3dlut_dma_load(struct pipe_ctx *pipe_ctx) } } -bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp, - struct hubp *primary_hubp, struct mpc *mpc, int mpcc_id, - struct dc_stream_state *stream, - struct dc_plane_state *plane_state) +bool dcn401_set_mcm_luts(const struct set_mcm_luts_params *params) { - const struct dc_plane_cm *cm = &plane_state->cm; + struct dpp *dpp = params->dpp; + struct hubp *hubp = params->hubp; + struct hubp *primary_hubp = params->primary_hubp; + struct mpc *mpc = params->mpc; + int mpcc_id = params->mpcc_id; + const struct dc_3dlut_dma *cm_lut3d_dma = ¶ms->cm->lut3d_dma; + const struct dc_3dlut *lut3d_func = ¶ms->cm->lut3d_func; union mcm_lut_params m_lut_params; struct dc_3dlut_dma lut3d_dma; bool lut_enable; @@ -432,9 +435,6 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp, bool rval; bool result = true; - (void)dc; - (void)stream; - /* decide LUT bank based on current in use */ mpc->funcs->get_lut_mode(mpc, MCM_LUT_1DLUT, mpcc_id, &lut_enable, &lut_bank_a); if (!lut_enable) { @@ -453,17 +453,17 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp, mpc->funcs->set_movable_cm_location(mpc, MPCC_MOVABLE_CM_LOCATION_BEFORE, mpcc_id); /* 1D LUT */ - lut_enable = cm->flags.bits.blend_enable != 0u; - if (cm->flags.bits.rmcm_enable) + lut_enable = params->blend_enable; + if (params->rmcm_enable) lut_enable = false; memset(&m_lut_params, 0, sizeof(m_lut_params)); if (lut_enable) { - if (cm->blend_func.type == TF_TYPE_HWPWL) - m_lut_params.pwl = &cm->blend_func.pwl; - else if (cm->blend_func.type == TF_TYPE_DISTRIBUTED_POINTS) { - rval = cm3_helper_translate_curve_to_hw_format(plane_state->ctx, - &cm->blend_func, + if (params->cm->blend_func.type == TF_TYPE_HWPWL) + m_lut_params.pwl = ¶ms->cm->blend_func.pwl; + else if (params->cm->blend_func.type == TF_TYPE_DISTRIBUTED_POINTS) { + rval = cm3_helper_translate_curve_to_hw_format(dpp->ctx, + ¶ms->cm->blend_func, &dpp->regamma_params, false); m_lut_params.pwl = rval ? &dpp->regamma_params : NULL; @@ -482,18 +482,18 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp, mpc->funcs->populate_lut(mpc, MCM_LUT_1DLUT, &m_lut_params, lut_bank_a, mpcc_id); /* Shaper */ - lut_enable = cm->flags.bits.shaper_enable != 0u; - if (cm->flags.bits.rmcm_enable) + lut_enable = params->shaper_enable; + if (params->rmcm_enable) lut_enable = false; if (lut_enable) { memset(&m_lut_params, 0, sizeof(m_lut_params)); - if (cm->shaper_func.type == TF_TYPE_HWPWL) - m_lut_params.pwl = &cm->shaper_func.pwl; - else if (cm->shaper_func.type == TF_TYPE_DISTRIBUTED_POINTS) { + if (params->cm->shaper_func.type == TF_TYPE_HWPWL) + m_lut_params.pwl = ¶ms->cm->shaper_func.pwl; + else if (params->cm->shaper_func.type == TF_TYPE_DISTRIBUTED_POINTS) { ASSERT(false); - rval = cm3_helper_translate_curve_to_hw_format(plane_state->ctx, - &cm->shaper_func, + rval = cm3_helper_translate_curve_to_hw_format(dpp->ctx, + ¶ms->cm->shaper_func, &dpp->shaper_params, true); m_lut_params.pwl = rval ? &dpp->shaper_params : NULL; @@ -516,15 +516,16 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp, */ /* 3DLUT */ - lut_enable = cm->flags.bits.lut3d_enable != 0u; - if (cm->flags.bits.rmcm_enable) + lut_enable = params->lut3d_enable; + if (params->rmcm_enable) lut_enable = false; - if (lut_enable && cm->flags.bits.lut3d_dma_enable) { + if (lut_enable && params->lut3d_dma_enable) { /* Fast (DMA) Load Mode */ /* MPC */ if (mpc->funcs->program_lut_mode) - mpc->funcs->program_lut_mode(mpc, MCM_LUT_3DLUT, lut_enable, lut_bank_a, cm->lut3d_dma.size, mpcc_id); + mpc->funcs->program_lut_mode(mpc, MCM_LUT_3DLUT, lut_enable, lut_bank_a, + cm_lut3d_dma->size, mpcc_id); /* only supports 12 bit */ if (mpc->funcs->program_lut_read_write_control) @@ -537,13 +538,13 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp, if (primary_hubp->inst == hubp->inst) { /* only program if this is the primary dpp pipe for the given plane */ if (hubp->funcs->hubp_program_3dlut_fl_config) - hubp->funcs->hubp_program_3dlut_fl_config(hubp, &cm->lut3d_dma); + hubp->funcs->hubp_program_3dlut_fl_config(hubp, cm_lut3d_dma); if (hubp->funcs->hubp_program_3dlut_fl_crossbar) - hubp->funcs->hubp_program_3dlut_fl_crossbar(hubp, cm->lut3d_dma.format); + hubp->funcs->hubp_program_3dlut_fl_crossbar(hubp, cm_lut3d_dma->format); if (hubp->funcs->hubp_program_3dlut_fl_addr) - hubp->funcs->hubp_program_3dlut_fl_addr(hubp, &cm->lut3d_dma.addr); + hubp->funcs->hubp_program_3dlut_fl_addr(hubp, &cm_lut3d_dma->addr); if (hubp->funcs->hubp_enable_3dlut_fl) { hubp->funcs->hubp_enable_3dlut_fl(hubp, true); @@ -555,9 +556,8 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp, } } else { /* re-trigger primary HUBP to load 3DLUT */ - if (primary_hubp->funcs->hubp_enable_3dlut_fl) { + if (primary_hubp->funcs->hubp_enable_3dlut_fl) primary_hubp->funcs->hubp_enable_3dlut_fl(primary_hubp, true); - } /* clear FL setup on this pipe's HUBP */ memset(&lut3d_dma, 0, sizeof(lut3d_dma)); @@ -571,8 +571,8 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp, /* Legacy (Host) Load Mode */ memset(&m_lut_params, 0, sizeof(m_lut_params)); - if (cm->flags.bits.lut3d_enable && cm->lut3d_func.state.bits.initialized) { - m_lut_params.lut3d = &cm->lut3d_func.lut_3d; + if (params->lut3d_enable && lut3d_func->state.bits.initialized) { + m_lut_params.lut3d = &lut3d_func->lut_3d; } else { lut_enable = false; } @@ -583,7 +583,7 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp, MCM_LUT_3DLUT, lut_enable, lut_bank_a, - cm->lut3d_func.lut_3d.use_tetrahedral_9 ? CM_LUT_SIZE_999 : CM_LUT_SIZE_171717, + lut3d_func->lut_3d.use_tetrahedral_9 ? CM_LUT_SIZE_999 : CM_LUT_SIZE_171717, mpcc_id); if (lut_enable) { @@ -591,7 +591,7 @@ bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp, mpc->funcs->program_lut_read_write_control(mpc, MCM_LUT_3DLUT, lut_bank_a, - cm->lut3d_func.lut_3d.use_12bits ? 12 : 10, + lut3d_func->lut_3d.use_12bits ? 12 : 10, mpcc_id); if (mpc->funcs->update_3dlut_fast_load_select) @@ -2521,8 +2521,10 @@ void dcn401_program_pipe_sequence( pipe_ctx->plane_state->update_bits.gamma_change || pipe_ctx->plane_state->update_bits.lut_3d || pipe_ctx->update_flags.bits.enable)) { + struct set_input_transfer_func_params itf_params; - hwss_add_dpp_set_input_transfer_func(seq_state, dc, pipe_ctx); + hwss_resolve_set_input_transfer_func_params(dc, pipe_ctx, &itf_params); + hwss_add_dpp_set_input_transfer_func(seq_state, &itf_params); } /* dcn10_translate_regamma_to_hw_format takes 750us to finish diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h index c95d929b453c..456f997286e3 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.h @@ -37,10 +37,7 @@ void dcn401_program_gamut_remap(struct program_gamut_remap_params *params); void dcn401_init_hw(struct dc *dc); -bool dcn401_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp, - struct hubp *primary_hubp, struct mpc *mpc, int mpcc_id, - struct dc_stream_state *stream, - struct dc_plane_state *plane_state); +bool dcn401_set_mcm_luts(const struct set_mcm_luts_params *params); bool dcn401_set_output_transfer_func(struct set_output_transfer_func_params *params); void dcn401_trigger_3dlut_dma_load(struct pipe_ctx *pipe_ctx); void dcn401_calculate_dccg_tmds_div_value(struct pipe_ctx *pipe_ctx, diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c index 62876d489b8e..14a9f5240bd2 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.c @@ -448,12 +448,16 @@ static void dcn42_detach_rmcm(struct rmcm *rmcm) * instance that could still point at this MPCC. One the driver has not programmed yet counts, * as its MPC_RMCM_CNTL may still hold a boot value. */ -void dcn42_release_rmcm_from_mpcc(struct dc *dc, int mpcc_id, const struct rmcm *keep) +void dcn42_release_rmcm_from_mpcc(struct rmcm **rmcm_pool, int rmcm_count, + int mpcc_id, const struct rmcm *keep) { int i; - for (i = 0; i < dc->res_pool->res_cap->num_rmcm && i < MAX_RMCM_INST; i++) { - struct rmcm *rmcm = dc->res_pool->rmcm[i]; + if (!rmcm_pool) + return; + + for (i = 0; i < rmcm_count && i < MAX_RMCM_INST; i++) { + struct rmcm *rmcm = rmcm_pool[i]; if (!rmcm || !rmcm->funcs) continue; @@ -472,7 +476,8 @@ void dcn42_release_rmcm_from_mpcc(struct dc *dc, int mpcc_id, const struct rmcm /* Leaves mpcc_id with no RMCM in its path. A NULL hubp keeps the shared 3DLUT fast load * untouched, for when another block already owns that HUBP. */ -void dcn42_disable_rmcm_luts(struct dc *dc, struct rmcm *rmcm, struct hubp *hubp, int mpcc_id) +void dcn42_disable_rmcm_luts(struct rmcm **rmcm_pool, int rmcm_count, + struct rmcm *rmcm, struct hubp *hubp, int mpcc_id) { if (rmcm && rmcm->funcs) { /* HW blocks 3DLUT writes until FL mode is cleared from HUBP on VUpdate, so @@ -485,14 +490,15 @@ void dcn42_disable_rmcm_luts(struct dc *dc, struct rmcm *rmcm, struct hubp *hubp dcn42_detach_rmcm(rmcm); } - dcn42_release_rmcm_from_mpcc(dc, mpcc_id, NULL); + dcn42_release_rmcm_from_mpcc(rmcm_pool, rmcm_count, mpcc_id, NULL); } -bool dcn42_set_rmcm_luts(struct set_input_transfer_func_params *params) +bool dcn42_set_rmcm_luts(const struct set_rmcm_luts_params *params) { struct dpp *dpp_base = params->dpp; struct hubp *hubp = params->hubp; - const struct dc_plane_cm *cm = ¶ms->plane_state->cm; + const struct dc_transfer_func *shaper_func = ¶ms->cm->shaper_func; + const struct dc_3dlut_dma *cm_lut3d_dma = ¶ms->cm->lut3d_dma; struct rmcm *rmcm = params->rmcm; int rmcm_inst; union rmcm_lut_params m_lut_params = {0}; @@ -526,15 +532,15 @@ bool dcn42_set_rmcm_luts(struct set_input_transfer_func_params *params) } /* Shaper */ - lut_enable = cm->flags.bits.shaper_enable != 0; + lut_enable = params->shaper_enable; if (lut_enable) { memset(&m_lut_params, 0, sizeof(m_lut_params)); - if (cm->shaper_func.type == TF_TYPE_HWPWL) - m_lut_params.pwl = &cm->shaper_func.pwl; - else if (cm->shaper_func.type == TF_TYPE_DISTRIBUTED_POINTS) { + if (shaper_func->type == TF_TYPE_HWPWL) + m_lut_params.pwl = &shaper_func->pwl; + else if (shaper_func->type == TF_TYPE_DISTRIBUTED_POINTS) { ASSERT(false); - rval = cm_helper_translate_curve_to_hw_format(params->plane_state->ctx, - &cm->shaper_func, + rval = cm_helper_translate_curve_to_hw_format(dpp_base->ctx, + shaper_func, &dpp_base->shaper_params, true); m_lut_params.pwl = rval ? &dpp_base->shaper_params : NULL; @@ -558,13 +564,13 @@ bool dcn42_set_rmcm_luts(struct set_input_transfer_func_params *params) */ /* 3DLUT */ - lut_enable = cm->flags.bits.lut3d_enable != 0; - if (lut_enable && cm->flags.bits.lut3d_dma_enable) { + lut_enable = params->lut3d_enable; + if (lut_enable && params->lut3d_dma_enable) { /* Fast (DMA) Load Mode */ if (rmcm->funcs->program_lut_mode) rmcm->funcs->program_lut_mode(rmcm, MCM_LUT_3DLUT, lut_enable, lut_bank_a, - cm->lut3d_dma.size, - cm->lut3d_dma.bias, cm->lut3d_dma.scale, + cm_lut3d_dma->size, + cm_lut3d_dma->bias, cm_lut3d_dma->scale, rmcm_inst); if (rmcm->funcs->program_lut_read_write_control) @@ -575,13 +581,13 @@ bool dcn42_set_rmcm_luts(struct set_input_transfer_func_params *params) /* HUBP */ if (hubp->funcs->hubp_program_3dlut_fl_config) - hubp->funcs->hubp_program_3dlut_fl_config(hubp, &cm->lut3d_dma); + hubp->funcs->hubp_program_3dlut_fl_config(hubp, cm_lut3d_dma); if (hubp->funcs->hubp_program_3dlut_fl_crossbar) - hubp->funcs->hubp_program_3dlut_fl_crossbar(hubp, cm->lut3d_dma.format); + hubp->funcs->hubp_program_3dlut_fl_crossbar(hubp, cm_lut3d_dma->format); if (hubp->funcs->hubp_program_3dlut_fl_addr) - hubp->funcs->hubp_program_3dlut_fl_addr(hubp, &cm->lut3d_dma.addr); + hubp->funcs->hubp_program_3dlut_fl_addr(hubp, &cm_lut3d_dma->addr); if (hubp->funcs->hubp_enable_3dlut_fl) { hubp->funcs->hubp_enable_3dlut_fl(hubp, true); @@ -618,7 +624,7 @@ bool dcn42_set_rmcm_luts(struct set_input_transfer_func_params *params) /* Connect to the MPCC only once the LUTs are loaded. Teardown is done by * disable_rmcm_luts, at plane teardown or when the plane switches back to MCM. */ - dcn42_release_rmcm_from_mpcc(params->dc, params->mpcc_id, rmcm); + dcn42_release_rmcm_from_mpcc(params->rmcm_pool, params->rmcm_count, params->mpcc_id, rmcm); if (rmcm->funcs->connect_mpcc) rmcm->funcs->connect_mpcc(rmcm, rmcm_inst, params->mpcc_id); @@ -626,16 +632,12 @@ bool dcn42_set_rmcm_luts(struct set_input_transfer_func_params *params) return result; } -bool dcn42_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp, - struct hubp *primary_hubp, struct mpc *mpc, int mpcc_id, - struct dc_stream_state *stream, - struct dc_plane_state *plane_state) +bool dcn42_set_mcm_luts(const struct set_mcm_luts_params *params) { bool result; /* MCM */ - result = dcn401_set_mcm_luts(dc, dpp, hubp, primary_hubp, mpc, mpcc_id, - stream, plane_state); + result = dcn401_set_mcm_luts(params); return result; } diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.h b/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.h index 2e5523617f29..2121c9f31128 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.h +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn42/dcn42_hwseq.h @@ -15,17 +15,16 @@ void dcn42_program_cm_hist( struct pipe_ctx *pipe_ctx, const struct dc_plane_state *plane_state); -bool dcn42_set_mcm_luts(struct dc *dc, struct dpp *dpp, struct hubp *hubp, - struct hubp *primary_hubp, struct mpc *mpc, int mpcc_id, - struct dc_stream_state *stream, - struct dc_plane_state *plane_state); +bool dcn42_set_mcm_luts(const struct set_mcm_luts_params *params); -void dcn42_disable_rmcm_luts(struct dc *dc, struct rmcm *rmcm, struct hubp *hubp, int mpcc_id); -void dcn42_release_rmcm_from_mpcc(struct dc *dc, int mpcc_id, const struct rmcm *keep); +void dcn42_disable_rmcm_luts(struct rmcm **rmcm_pool, int rmcm_count, + struct rmcm *rmcm, struct hubp *hubp, int mpcc_id); +void dcn42_release_rmcm_from_mpcc(struct rmcm **rmcm_pool, int rmcm_count, + int mpcc_id, const struct rmcm *keep); void dcn42_disable_mcm_luts(struct mpc *mpc, int mpcc_id); void dcn42_trigger_3dlut_dma_load(struct pipe_ctx *pipe_ctx); -bool dcn42_set_rmcm_luts(struct set_input_transfer_func_params *params); +bool dcn42_set_rmcm_luts(const struct set_rmcm_luts_params *params); void dcn42_hardware_release(struct dc *dc); diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c index 67b778001bce..a0367632d01a 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c @@ -52,11 +52,12 @@ #define FN(reg_name, field_name) \ hws->shifts->field_name, hws->masks->field_name -bool dcn60_set_rmcm_luts(struct set_input_transfer_func_params *params) +bool dcn60_set_rmcm_luts(const struct set_rmcm_luts_params *params) { struct dpp *dpp_base = params->dpp; struct hubp *hubp = params->hubp; - const struct dc_plane_cm *cm = ¶ms->plane_state->cm; + const struct dc_transfer_func *shaper_func = ¶ms->cm->shaper_func; + const struct dc_3dlut_dma *cm_lut3d_dma = ¶ms->cm->lut3d_dma; struct rmcm *rmcm = params->rmcm; int rmcm_inst; union rmcm_lut_params m_lut_params = {0}; @@ -74,15 +75,15 @@ bool dcn60_set_rmcm_luts(struct set_input_transfer_func_params *params) rmcm_inst = rmcm->inst; /* Shaper */ - lut_enable = cm->flags.bits.shaper_enable != 0; + lut_enable = params->shaper_enable; if (lut_enable) { memset(&m_lut_params, 0, sizeof(m_lut_params)); - if (cm->shaper_func.type == TF_TYPE_HWPWL) - m_lut_params.pwl = &cm->shaper_func.pwl; - else if (cm->shaper_func.type == TF_TYPE_DISTRIBUTED_POINTS) { + if (shaper_func->type == TF_TYPE_HWPWL) + m_lut_params.pwl = &shaper_func->pwl; + else if (shaper_func->type == TF_TYPE_DISTRIBUTED_POINTS) { ASSERT(false); - rval = cm_helper_translate_curve_to_hw_format(params->plane_state->ctx, - &cm->shaper_func, + rval = cm_helper_translate_curve_to_hw_format(dpp_base->ctx, + shaper_func, &dpp_base->shaper_params, true); m_lut_params.pwl = rval ? &dpp_base->shaper_params : NULL; @@ -106,13 +107,13 @@ bool dcn60_set_rmcm_luts(struct set_input_transfer_func_params *params) */ /* 3DLUT */ - lut_enable = cm->flags.bits.lut3d_enable != 0; - if (lut_enable && cm->flags.bits.lut3d_dma_enable) { + lut_enable = params->lut3d_enable; + if (lut_enable && params->lut3d_dma_enable) { /* Fast (DMA) Load Mode */ if (rmcm->funcs->program_lut_mode) rmcm->funcs->program_lut_mode(rmcm, MCM_LUT_3DLUT, lut_enable, true, - cm->lut3d_dma.size, - cm->lut3d_dma.bias, cm->lut3d_dma.scale, + cm_lut3d_dma->size, + cm_lut3d_dma->bias, cm_lut3d_dma->scale, rmcm_inst); if (rmcm->funcs->program_lut_read_write_control) @@ -123,13 +124,13 @@ bool dcn60_set_rmcm_luts(struct set_input_transfer_func_params *params) /* HUBP */ if (hubp->funcs->hubp_program_3dlut_fl_config) - hubp->funcs->hubp_program_3dlut_fl_config(hubp, &cm->lut3d_dma); + hubp->funcs->hubp_program_3dlut_fl_config(hubp, cm_lut3d_dma); if (hubp->funcs->hubp_program_3dlut_fl_crossbar) - hubp->funcs->hubp_program_3dlut_fl_crossbar(hubp, cm->lut3d_dma.format); + hubp->funcs->hubp_program_3dlut_fl_crossbar(hubp, cm_lut3d_dma->format); if (hubp->funcs->hubp_program_3dlut_fl_addr) - hubp->funcs->hubp_program_3dlut_fl_addr(hubp, &cm->lut3d_dma.addr); + hubp->funcs->hubp_program_3dlut_fl_addr(hubp, &cm_lut3d_dma->addr); if (hubp->funcs->hubp_enable_3dlut_fl) { hubp->funcs->hubp_enable_3dlut_fl(hubp, true); @@ -165,7 +166,7 @@ bool dcn60_set_rmcm_luts(struct set_input_transfer_func_params *params) /* Connect to the MPCC only once the LUTs are loaded. Teardown is done by * disable_rmcm_luts, at plane teardown or when the plane switches back to MCM. */ - dcn42_release_rmcm_from_mpcc(params->dc, params->mpcc_id, rmcm); + dcn42_release_rmcm_from_mpcc(params->rmcm_pool, params->rmcm_count, params->mpcc_id, rmcm); if (rmcm->funcs->connect_mpcc) rmcm->funcs->connect_mpcc(rmcm, rmcm_inst, params->mpcc_id); diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.h b/drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.h index b88f4304b1b9..d37d9f47c223 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.h +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.h @@ -31,6 +31,6 @@ void dcn60_program_perfmon(struct dc *dc, struct dc_state *context); bool dcn60_apply_idle_power_optimizations(struct dc *dc, bool enable); bool dcn60_dsc_pg_status(struct dce_hwseq *hws, unsigned int dsc_inst); -bool dcn60_set_rmcm_luts(struct set_input_transfer_func_params *params); +bool dcn60_set_rmcm_luts(const struct set_rmcm_luts_params *params); #endif /* __DC_HWSS_DCN60_H__ */ diff --git a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h index dac709188891..3bf9a15be3dc 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +++ b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h @@ -101,16 +101,58 @@ struct update_plane_addr_params { }; struct set_input_transfer_func_params { - struct dc *dc; + struct dce_hwseq *hws; struct dpp *dpp; struct hubp *hubp; struct hubp *primary_hubp; struct mpc *mpc; struct rmcm *rmcm; + /* Borrowed res_pool->rmcm array, valid for the driver lifetime */ + struct rmcm **rmcm_pool; + int rmcm_count; int mpcc_id; - struct dc_stream_state *stream; struct input_pixel_processor *ipp; - struct dc_plane_state *plane_state; + enum surface_pixel_format format; + enum dc_scaling_linearity scaling_linearity; + bool always_use_regamma; + bool blend_enable; + bool shaper_enable; + bool lut3d_enable; + bool lut3d_dma_enable; + bool rmcm_enable; + /* Borrowed from the plane state, must stay valid until the step executes */ + const struct dc_transfer_func *in_transfer_func; + const struct dc_gamma *gamma_correction; + const struct dc_plane_cm *cm; +}; + +/* Arguments of the set_mcm_luts hook, built from set_input_transfer_func_params. */ +struct set_mcm_luts_params { + struct dpp *dpp; + struct hubp *hubp; + struct hubp *primary_hubp; + struct mpc *mpc; + int mpcc_id; + bool blend_enable; + bool shaper_enable; + bool lut3d_enable; + bool lut3d_dma_enable; + bool rmcm_enable; + const struct dc_plane_cm *cm; +}; + +/* Arguments of the set_rmcm_luts hook, built from set_input_transfer_func_params. */ +struct set_rmcm_luts_params { + struct dpp *dpp; + struct hubp *hubp; + struct rmcm *rmcm; + struct rmcm **rmcm_pool; + int rmcm_count; + int mpcc_id; + bool shaper_enable; + bool lut3d_enable; + bool lut3d_dma_enable; + const struct dc_plane_cm *cm; }; struct program_gamut_remap_params { @@ -2735,6 +2777,12 @@ void hwss_hubp_wait_for_dcc_meta_prop(struct dc *dc, struct pipe_ctx *top_pipe_t void hwss_set_input_transfer_func(struct dc *dc, struct pipe_ctx *pipe_ctx); +void hwss_resolve_set_input_transfer_func_params(struct dc *dc, + struct pipe_ctx *pipe_ctx, + struct set_input_transfer_func_params *params); + +void hwss_dpp_set_input_transfer_func(union block_sequence_params *params); + void hwss_add_optc_pipe_control_lock(struct block_sequence_state *seq_state, struct dc *dc, struct pipe_ctx *pipe_ctx, bool lock); @@ -2751,7 +2799,7 @@ void hwss_add_hubp_update_plane_addr(struct block_sequence_state *seq_state, struct dc *dc, struct pipe_ctx *pipe_ctx); void hwss_add_dpp_set_input_transfer_func(struct block_sequence_state *seq_state, - struct dc *dc, struct pipe_ctx *pipe_ctx); + const struct set_input_transfer_func_params *params); void hwss_add_dpp_program_gamut_remap(struct block_sequence_state *seq_state, struct pipe_ctx *pipe_ctx); diff --git a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer_private.h b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer_private.h index e4001656a330..9eabb391397c 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer_private.h +++ b/drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer_private.h @@ -74,6 +74,8 @@ struct tg_color; struct output_pixel_processor; struct mpcc_blnd_cfg; struct rmcm; +struct dc_transfer_func; +struct dc_3dlut; struct hwseq_private_funcs { @@ -193,16 +195,15 @@ struct hwseq_private_funcs { bool (*wait_for_blank_complete)(struct output_pixel_processor *opp); void (*dccg_init)(struct dce_hwseq *hws); bool (*set_blend_lut)(struct dpp *dpp, - struct dc_plane_state *plane_state); + const struct dc_transfer_func *blend_func); bool (*set_shaper_3dlut)(struct dpp *dpp, - struct dc_plane_state *plane_state); - bool (*set_mcm_luts)(struct dc *dc, struct dpp *dpp, struct hubp *hubp, - struct hubp *primary_hubp, struct mpc *mpc, int mpcc_id, - struct dc_stream_state *stream, - struct dc_plane_state *plane_state); - bool (*set_rmcm_luts)(struct set_input_transfer_func_params *params); + const struct dc_transfer_func *shaper_func, + const struct dc_3dlut *lut3d_func); + bool (*set_mcm_luts)(const struct set_mcm_luts_params *params); + bool (*set_rmcm_luts)(const struct set_rmcm_luts_params *params); void (*disable_mcm_luts)(struct mpc *mpc, int mpcc_id); - void (*disable_rmcm_luts)(struct dc *dc, struct rmcm *rmcm, struct hubp *hubp, int mpcc_id); + void (*disable_rmcm_luts)(struct rmcm **rmcm_pool, int rmcm_count, + struct rmcm *rmcm, struct hubp *hubp, int mpcc_id); void (*PLAT_58856_wa)(struct dc_state *context, struct pipe_ctx *pipe_ctx); void (*setup_hpo_hw_control)(const struct dce_hwseq *hws, bool enable); diff --git a/drivers/gpu/drm/amd/display/dc/inc/core_types.h b/drivers/gpu/drm/amd/display/dc/inc/core_types.h index 09395f5d4e13..538b82edbb77 100644 --- a/drivers/gpu/drm/amd/display/dc/inc/core_types.h +++ b/drivers/gpu/drm/amd/display/dc/inc/core_types.h @@ -72,8 +72,6 @@ struct resource_context; struct clk_bw_params; struct dc_mcache_params; -#define MAX_RMCM_INST 2 - struct resource_funcs { enum engine_id (*get_preferred_eng_id_dpia)(unsigned int dpia_index); void (*destroy)(struct resource_pool **pool); diff --git a/drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h b/drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h index 6109d22e1093..56ed1b18c717 100644 --- a/drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h +++ b/drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h @@ -45,6 +45,8 @@ #define MAX_PIPES 6 #define MAX_PHANTOM_PIPES (MAX_PIPES / 2) +#define MAX_RMCM_INST 2 + #define MAX_DPIA 6 #define MAX_CONNECTOR 6 #define MAX_VIRTUAL_LINKS 4 -- 2.56.1