Patch "drm/msm/dp: fix the max supported bpp logic" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/msm/dp: fix the max supported bpp logic

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-msm-dp-fix-the-max-supported-bpp-logic.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b0f05544e80cc9fd6598483f7487bc40e259de30
Author: Abhinav Kumar <quic_abhinavk@xxxxxxxxxxx>
Date:   Mon Aug 5 13:20:08 2024 -0700

    drm/msm/dp: fix the max supported bpp logic
    
    [ Upstream commit d19d5b8d8f6dab942ce5ddbcf34bf7275e778250 ]
    
    Fix the dp_panel_get_supported_bpp() API to return the minimum
    supported bpp correctly for relevant cases and use this API
    to correct the behavior of DP driver which hard-codes the max supported
    bpp to 30.
    
    This is incorrect because the number of lanes and max data rate
    supported by the lanes need to be taken into account.
    
    Replace the hardcoded limit with the appropriate math which accounts
    for the accurate number of lanes and max data rate.
    
    changes in v2:
            - Fix the dp_panel_get_supported_bpp() and use it
            - Drop the max_t usage as dp_panel_get_supported_bpp() already
              returns the min_bpp correctly now
    
    changes in v3:
            - replace min_t with just min as all params are u32
    
    Fixes: c943b4948b58 ("drm/msm/dp: add displayPort driver support")
    Reported-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
    Closes: https://gitlab.freedesktop.org/drm/msm/-/issues/43
    Tested-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> # SM8350-HDK
    Reviewed-by: Stephen Boyd <swboyd@xxxxxxxxxxxx>
    Patchwork: https://patchwork.freedesktop.org/patch/607073/
    Link: https://lore.kernel.org/r/20240805202009.1120981-1-quic_abhinavk@xxxxxxxxxxx
    Signed-off-by: Stephen Boyd <swboyd@xxxxxxxxxxxx>
    Signed-off-by: Abhinav Kumar <quic_abhinavk@xxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/msm/dp/dp_panel.c b/drivers/gpu/drm/msm/dp/dp_panel.c
index d38086650fcf7..f2cc0cc0b66b7 100644
--- a/drivers/gpu/drm/msm/dp/dp_panel.c
+++ b/drivers/gpu/drm/msm/dp/dp_panel.c
@@ -113,22 +113,22 @@ static int dp_panel_read_dpcd(struct dp_panel *dp_panel)
 static u32 dp_panel_get_supported_bpp(struct dp_panel *dp_panel,
 		u32 mode_edid_bpp, u32 mode_pclk_khz)
 {
-	struct dp_link_info *link_info;
+	const struct dp_link_info *link_info;
 	const u32 max_supported_bpp = 30, min_supported_bpp = 18;
-	u32 bpp = 0, data_rate_khz = 0;
+	u32 bpp, data_rate_khz;
 
-	bpp = min_t(u32, mode_edid_bpp, max_supported_bpp);
+	bpp = min(mode_edid_bpp, max_supported_bpp);
 
 	link_info = &dp_panel->link_info;
 	data_rate_khz = link_info->num_lanes * link_info->rate * 8;
 
-	while (bpp > min_supported_bpp) {
+	do {
 		if (mode_pclk_khz * bpp <= data_rate_khz)
-			break;
+			return bpp;
 		bpp -= 6;
-	}
+	} while (bpp > min_supported_bpp);
 
-	return bpp;
+	return min_supported_bpp;
 }
 
 static int dp_panel_update_modes(struct drm_connector *connector,
@@ -421,8 +421,9 @@ int dp_panel_init_panel_info(struct dp_panel *dp_panel)
 				drm_mode->clock);
 	drm_dbg_dp(panel->drm_dev, "bpp = %d\n", dp_panel->dp_mode.bpp);
 
-	dp_panel->dp_mode.bpp = max_t(u32, 18,
-				min_t(u32, dp_panel->dp_mode.bpp, 30));
+	dp_panel->dp_mode.bpp = dp_panel_get_mode_bpp(dp_panel, dp_panel->dp_mode.bpp,
+						      dp_panel->dp_mode.drm_mode.clock);
+
 	drm_dbg_dp(panel->drm_dev, "updated bpp = %d\n",
 				dp_panel->dp_mode.bpp);
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux