Skip to content

Commit 3251b69

Browse files
Peichen Huangalexdeucher
authored andcommitted
drm/amd/display: Add dc cap for dp tunneling
[WHAT] 1. add dc cap for dp tunneling 2. add function to get index of host router Cc: Mario Limonciello <mario.limonciello@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Cruise Hung <cruise.hung@amd.com> Signed-off-by: Peichen Huang <PeiChen.Huang@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 29e178d) Cc: stable@vger.kernel.org
1 parent a55737d commit 3251b69

7 files changed

Lines changed: 55 additions & 1 deletion

File tree

drivers/gpu/drm/amd/display/dc/core/dc.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ static bool create_links(
241241
DC_LOG_DC("BIOS object table - end");
242242

243243
/* Create a link for each usb4 dpia port */
244+
dc->lowest_dpia_link_index = MAX_LINKS;
244245
for (i = 0; i < dc->res_pool->usb4_dpia_count; i++) {
245246
struct link_init_data link_init_params = {0};
246247
struct dc_link *link;
@@ -253,6 +254,9 @@ static bool create_links(
253254

254255
link = dc->link_srv->create_link(&link_init_params);
255256
if (link) {
257+
if (dc->lowest_dpia_link_index > dc->link_count)
258+
dc->lowest_dpia_link_index = dc->link_count;
259+
256260
dc->links[dc->link_count] = link;
257261
link->dc = dc;
258262
++dc->link_count;
@@ -6376,6 +6380,35 @@ unsigned int dc_get_det_buffer_size_from_state(const struct dc_state *context)
63766380
else
63776381
return 0;
63786382
}
6383+
/**
6384+
***********************************************************************************************
6385+
* dc_get_host_router_index: Get index of host router from a dpia link
6386+
*
6387+
* This function return a host router index of the target link. If the target link is dpia link.
6388+
*
6389+
* @param [in] link: target link
6390+
* @param [out] host_router_index: host router index of the target link
6391+
*
6392+
* @return: true if the host router index is found and valid.
6393+
*
6394+
***********************************************************************************************
6395+
*/
6396+
bool dc_get_host_router_index(const struct dc_link *link, unsigned int *host_router_index)
6397+
{
6398+
struct dc *dc = link->ctx->dc;
6399+
6400+
if (link->ep_type != DISPLAY_ENDPOINT_USB4_DPIA)
6401+
return false;
6402+
6403+
if (link->link_index < dc->lowest_dpia_link_index)
6404+
return false;
6405+
6406+
*host_router_index = (link->link_index - dc->lowest_dpia_link_index) / dc->caps.num_of_dpias_per_host_router;
6407+
if (*host_router_index < dc->caps.num_of_host_routers)
6408+
return true;
6409+
else
6410+
return false;
6411+
}
63796412

63806413
bool dc_is_cursor_limit_pending(struct dc *dc)
63816414
{

drivers/gpu/drm/amd/display/dc/dc.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ struct dmub_notification;
6666
#define MAX_STREAMS 6
6767
#define MIN_VIEWPORT_SIZE 12
6868
#define MAX_NUM_EDP 2
69-
#define MAX_HOST_ROUTERS_NUM 2
69+
#define MAX_HOST_ROUTERS_NUM 3
70+
#define MAX_DPIA_PER_HOST_ROUTER 2
7071

7172
/* Display Core Interfaces */
7273
struct dc_versions {
@@ -305,6 +306,8 @@ struct dc_caps {
305306
/* Conservative limit for DCC cases which require ODM4:1 to support*/
306307
uint32_t dcc_plane_width_limit;
307308
struct dc_scl_caps scl_caps;
309+
uint8_t num_of_host_routers;
310+
uint8_t num_of_dpias_per_host_router;
308311
};
309312

310313
struct dc_bug_wa {
@@ -1603,6 +1606,7 @@ struct dc {
16031606

16041607
uint8_t link_count;
16051608
struct dc_link *links[MAX_LINKS];
1609+
uint8_t lowest_dpia_link_index;
16061610
struct link_service *link_srv;
16071611

16081612
struct dc_state *current_state;
@@ -2595,6 +2599,8 @@ struct dc_power_profile dc_get_power_profile_for_dc_state(const struct dc_state
25952599

25962600
unsigned int dc_get_det_buffer_size_from_state(const struct dc_state *context);
25972601

2602+
bool dc_get_host_router_index(const struct dc_link *link, unsigned int *host_router_index);
2603+
25982604
/* DSC Interfaces */
25992605
#include "dc_dsc.h"
26002606

drivers/gpu/drm/amd/display/dc/resource/dcn31/dcn31_resource.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,6 +1954,9 @@ static bool dcn31_resource_construct(
19541954
dc->caps.color.mpc.ogam_rom_caps.hlg = 0;
19551955
dc->caps.color.mpc.ocsc = 1;
19561956

1957+
dc->caps.num_of_host_routers = 2;
1958+
dc->caps.num_of_dpias_per_host_router = 2;
1959+
19571960
/* Use pipe context based otg sync logic */
19581961
dc->config.use_pipe_ctx_sync_logic = true;
19591962
dc->config.disable_hbr_audio_dp2 = true;

drivers/gpu/drm/amd/display/dc/resource/dcn314/dcn314_resource.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,6 +1885,9 @@ static bool dcn314_resource_construct(
18851885

18861886
dc->caps.max_disp_clock_khz_at_vmin = 650000;
18871887

1888+
dc->caps.num_of_host_routers = 2;
1889+
dc->caps.num_of_dpias_per_host_router = 2;
1890+
18881891
/* Use pipe context based otg sync logic */
18891892
dc->config.use_pipe_ctx_sync_logic = true;
18901893

drivers/gpu/drm/amd/display/dc/resource/dcn35/dcn35_resource.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,6 +1894,9 @@ static bool dcn35_resource_construct(
18941894
dc->caps.color.mpc.ogam_rom_caps.hlg = 0;
18951895
dc->caps.color.mpc.ocsc = 1;
18961896

1897+
dc->caps.num_of_host_routers = 2;
1898+
dc->caps.num_of_dpias_per_host_router = 2;
1899+
18971900
/* max_disp_clock_khz_at_vmin is slightly lower than the STA value in order
18981901
* to provide some margin.
18991902
* It's expected for furture ASIC to have equal or higher value, in order to

drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,6 +1866,9 @@ static bool dcn351_resource_construct(
18661866
dc->caps.color.mpc.ogam_rom_caps.hlg = 0;
18671867
dc->caps.color.mpc.ocsc = 1;
18681868

1869+
dc->caps.num_of_host_routers = 2;
1870+
dc->caps.num_of_dpias_per_host_router = 2;
1871+
18691872
/* max_disp_clock_khz_at_vmin is slightly lower than the STA value in order
18701873
* to provide some margin.
18711874
* It's expected for furture ASIC to have equal or higher value, in order to

drivers/gpu/drm/amd/display/dc/resource/dcn36/dcn36_resource.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,6 +1867,9 @@ static bool dcn36_resource_construct(
18671867
dc->caps.color.mpc.ogam_rom_caps.hlg = 0;
18681868
dc->caps.color.mpc.ocsc = 1;
18691869

1870+
dc->caps.num_of_host_routers = 2;
1871+
dc->caps.num_of_dpias_per_host_router = 2;
1872+
18701873
/* max_disp_clock_khz_at_vmin is slightly lower than the STA value in order
18711874
* to provide some margin.
18721875
* It's expected for furture ASIC to have equal or higher value, in order to

0 commit comments

Comments
 (0)