From: Wayne Lin <Wayne.Lin@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: stylon.wang@amd.com, Aric Cyr <Aric.Cyr@amd.com>,
Sunpeng.Li@amd.com, Harry.Wentland@amd.com,
qingqing.zhuo@amd.com, Rodrigo.Siqueira@amd.com,
roman.li@amd.com, Wenjing Liu <wenjing.liu@amd.com>,
solomon.chiu@amd.com, Aurabindo.Pillai@amd.com,
wayne.lin@amd.com, Bhawanpreet.Lakha@amd.com,
agustin.gutierrez@amd.com, pavle.kotarac@amd.com
Subject: [PATCH 5/8] drm/amd/display: add more link_hwss types and method to decide which one
Date: Wed, 19 Jan 2022 16:24:40 +0800 [thread overview]
Message-ID: <20220119082443.1046810-6-Wayne.Lin@amd.com> (raw)
In-Reply-To: <20220119082443.1046810-1-Wayne.Lin@amd.com>
From: Wenjing Liu <wenjing.liu@amd.com>
[why]
as we add more link_hwss we are making a generic way to determine which type
of link_hwss we should use.
Later on we may think of introduce a link policy layer. it could be a thin layer
that decide the type of link_hwss we use. So instead of passing in link and link_res
we can just pass in link_policy and swtich based on link_policy->get_link_hwss_type.
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
---
.../drm/amd/display/dc/core/dc_link_hwss.c | 53 ++++++++++++++++---
.../gpu/drm/amd/display/dc/inc/link_hwss.h | 3 ++
2 files changed, 50 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c
index 93392c67c909..c65955eafaa2 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c
@@ -844,7 +844,16 @@ void setup_dp_hpo_stream(struct pipe_ctx *pipe_ctx, bool enable)
}
}
-/******************************* dio_link_hwss ********************************/
+static void set_dummy_throttled_vcp_size(struct pipe_ctx *pipe_ctx,
+ struct fixed31_32 throttled_vcp_size);
+
+/************************* below goes to dio_link_hwss ************************/
+static bool can_use_dio_link_hwss(const struct dc_link *link,
+ const struct link_resource *link_res)
+{
+ return link->link_enc != NULL;
+}
+
static void set_dio_throttled_vcp_size(struct pipe_ctx *pipe_ctx,
struct fixed31_32 throttled_vcp_size)
{
@@ -855,7 +864,17 @@ static void set_dio_throttled_vcp_size(struct pipe_ctx *pipe_ctx,
throttled_vcp_size);
}
-/***************************** hpo_dp_link_hwss *******************************/
+static const struct dc_link_hwss dio_link_hwss = {
+ .set_throttled_vcp_size = set_dio_throttled_vcp_size,
+};
+
+/*********************** below goes to hpo_dp_link_hwss ***********************/
+static bool can_use_dp_hpo_link_hwss(const struct dc_link *link,
+ const struct link_resource *link_res)
+{
+ return link_res->hpo_dp_link_enc != NULL;
+}
+
static void set_dp_hpo_throttled_vcp_size(struct pipe_ctx *pipe_ctx,
struct fixed31_32 throttled_vcp_size)
{
@@ -898,15 +917,33 @@ static const struct dc_link_hwss hpo_dp_link_hwss = {
*/
.set_hblank_min_symbol_width = set_dp_hpo_hblank_min_symbol_width,
};
+/*********************** below goes to dpia_link_hwss *************************/
+static bool can_use_dpia_link_hwss(const struct dc_link *link,
+ const struct link_resource *link_res)
+{
+ return link->is_dig_mapping_flexible &&
+ link->dc->res_pool->funcs->link_encs_assign;
+}
-static const struct dc_link_hwss dio_link_hwss = {
- .set_throttled_vcp_size = set_dio_throttled_vcp_size,
+static const struct dc_link_hwss dpia_link_hwss = {
+ .set_throttled_vcp_size = set_dummy_throttled_vcp_size,
+};
+
+/*********************** below goes to link_hwss ******************************/
+static void set_dummy_throttled_vcp_size(struct pipe_ctx *pipe_ctx,
+ struct fixed31_32 throttled_vcp_size)
+{
+ return;
+}
+
+static const struct dc_link_hwss dummy_link_hwss = {
+ .set_throttled_vcp_size = set_dummy_throttled_vcp_size,
};
const struct dc_link_hwss *dc_link_hwss_get(const struct dc_link *link,
const struct link_resource *link_res)
{
- if (link_res->hpo_dp_link_enc)
+ if (can_use_dp_hpo_link_hwss(link, link_res))
/* TODO: some assumes that if decided link settings is 128b/132b
* channel coding format hpo_dp_link_enc should be used.
* Others believe that if hpo_dp_link_enc is available in link
@@ -925,8 +962,12 @@ const struct dc_link_hwss *dc_link_hwss_get(const struct dc_link *link,
* do work for all functions
*/
return &hpo_dp_link_hwss;
- else
+ else if (can_use_dpia_link_hwss(link, link_res))
+ return &dpia_link_hwss;
+ else if (can_use_dio_link_hwss(link, link_res))
return &dio_link_hwss;
+ else
+ return &dummy_link_hwss;
}
#undef DC_LOGGER
diff --git a/drivers/gpu/drm/amd/display/dc/inc/link_hwss.h b/drivers/gpu/drm/amd/display/dc/inc/link_hwss.h
index bd3b2b807431..8eff386da95e 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/link_hwss.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/link_hwss.h
@@ -78,6 +78,9 @@ struct fixed31_32;
struct pipe_ctx;
struct dc_link_hwss {
+ /* you must define a dummy implementation and assign the function to
+ * dummy_link_hwss if you don't want to check for NULL pointer
+ */
void (*set_throttled_vcp_size)(struct pipe_ctx *pipe_ctx,
struct fixed31_32 throttled_vcp_size);
--
2.25.1
next prev parent reply other threads:[~2022-01-19 8:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-19 8:24 [PATCH 0/8] DC improvement patches Wayne Lin
2022-01-19 8:24 ` [PATCH 1/8] drm/amd/display: factor out dp detection link training and mst top detection Wayne Lin
2022-01-19 8:24 ` [PATCH 2/8] drm/amd/display: Add work around to enforce TBT3 compatibility Wayne Lin
2022-01-19 8:24 ` [PATCH 3/8] drm/amd/display: Drop DCN for DP2.x logic Wayne Lin
2022-01-19 8:24 ` [PATCH 4/8] drm/amd/display: abstract encoder related hwseq across different types Wayne Lin
2022-01-19 8:24 ` Wayne Lin [this message]
2022-01-19 8:24 ` [PATCH 6/8] drm/amd/display: rename dc_link_hwss struct to link_hwss Wayne Lin
2022-01-19 8:24 ` [PATCH 7/8] drm/amd/display: fix a coding error causing set throttled vcp size skipped for dpia Wayne Lin
2022-01-19 8:24 ` [PATCH 8/8] drm/amd/display: Don't update drm connector when read local EDID Wayne Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220119082443.1046810-6-Wayne.Lin@amd.com \
--to=wayne.lin@amd.com \
--cc=Aric.Cyr@amd.com \
--cc=Aurabindo.Pillai@amd.com \
--cc=Bhawanpreet.Lakha@amd.com \
--cc=Harry.Wentland@amd.com \
--cc=Rodrigo.Siqueira@amd.com \
--cc=Sunpeng.Li@amd.com \
--cc=agustin.gutierrez@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=pavle.kotarac@amd.com \
--cc=qingqing.zhuo@amd.com \
--cc=roman.li@amd.com \
--cc=solomon.chiu@amd.com \
--cc=stylon.wang@amd.com \
--cc=wenjing.liu@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.