Commit 5d34b050 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'drm-msm-fixes-2024-08-19' of https://gitlab.freedesktop.org/drm/msm into drm-fixes

Fixes for v6.11-rc5

1) Fixes from the virtual plane series, namely
   - fix the list of formats for QCM2290 since it has no YUV support
   - minor fix in dpu_plane_atomic_check_pipe() to check only for csc and
     not csc and scaler while allowing yuv formats
   - take rotation into account while allocating virtual planes

2) Fix to cleanup FB if dpu_format_populate_layout() fails. This fixes the
   warning splat during DRM file closure

3) Fix to reset the phy link params before re-starting link training. This
   fixes the 100% link training failure when someone starts modetest while
   cable is connected

4) Long pending fix to fix a visual corruption seen for 4k modes. Root-cause
   was we cannot support 4k@30 with 30bpp with 2 lanes so this is a critical
   fix to use 24bpp for such cases

5) Fix to move dpu encoder's connector assignment to atomic_enable(). This
   fixes the NULL ptr crash for cases when there is an atomic_enable()
   without atomic_modeset() after atomic_disable() . This happens for
   connectors_changed case of crtc. It fixes a NULL ptr crash reported
   during hotplug.

6) Fix to simplify DPU's debug macros without which dynamic debug does not
   work as expected

7) Fix the highest bank bit setting for sc7180

8) adreno: fix error return if missing firmware-name
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
From: Rob Clark <robdclark@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/CAF6AEGvxF2p3-AsjUydmSYrA0Vb+Ea7nh3VtNX0pT0Ae_Me-Kw@mail.gmail.com
parents 47ac09b9 624ab9cd
...@@ -99,7 +99,7 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname, ...@@ -99,7 +99,7 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname,
* was a bad idea, and is only provided for backwards * was a bad idea, and is only provided for backwards
* compatibility for older targets. * compatibility for older targets.
*/ */
return -ENODEV; return -ENOENT;
} }
if (IS_ERR(fw)) { if (IS_ERR(fw)) {
......
...@@ -1171,8 +1171,6 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc, ...@@ -1171,8 +1171,6 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc,
cstate->num_mixers = num_lm; cstate->num_mixers = num_lm;
dpu_enc->connector = conn_state->connector;
for (i = 0; i < dpu_enc->num_phys_encs; i++) { for (i = 0; i < dpu_enc->num_phys_encs; i++) {
struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i]; struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i];
...@@ -1270,6 +1268,8 @@ static void dpu_encoder_virt_atomic_enable(struct drm_encoder *drm_enc, ...@@ -1270,6 +1268,8 @@ static void dpu_encoder_virt_atomic_enable(struct drm_encoder *drm_enc,
dpu_enc->commit_done_timedout = false; dpu_enc->commit_done_timedout = false;
dpu_enc->connector = drm_atomic_get_new_connector_for_encoder(state, drm_enc);
cur_mode = &dpu_enc->base.crtc->state->adjusted_mode; cur_mode = &dpu_enc->base.crtc->state->adjusted_mode;
dpu_enc->wide_bus_en = dpu_encoder_is_widebus_enabled(drm_enc); dpu_enc->wide_bus_en = dpu_encoder_is_widebus_enabled(drm_enc);
......
...@@ -308,8 +308,8 @@ static const u32 wb2_formats_rgb_yuv[] = { ...@@ -308,8 +308,8 @@ static const u32 wb2_formats_rgb_yuv[] = {
{ \ { \
.maxdwnscale = SSPP_UNITY_SCALE, \ .maxdwnscale = SSPP_UNITY_SCALE, \
.maxupscale = SSPP_UNITY_SCALE, \ .maxupscale = SSPP_UNITY_SCALE, \
.format_list = plane_formats_yuv, \ .format_list = plane_formats, \
.num_formats = ARRAY_SIZE(plane_formats_yuv), \ .num_formats = ARRAY_SIZE(plane_formats), \
.virt_format_list = plane_formats, \ .virt_format_list = plane_formats, \
.virt_num_formats = ARRAY_SIZE(plane_formats), \ .virt_num_formats = ARRAY_SIZE(plane_formats), \
} }
......
...@@ -31,24 +31,14 @@ ...@@ -31,24 +31,14 @@
* @fmt: Pointer to format string * @fmt: Pointer to format string
*/ */
#define DPU_DEBUG(fmt, ...) \ #define DPU_DEBUG(fmt, ...) \
do { \ DRM_DEBUG_DRIVER(fmt, ##__VA_ARGS__)
if (drm_debug_enabled(DRM_UT_KMS)) \
DRM_DEBUG(fmt, ##__VA_ARGS__); \
else \
pr_debug(fmt, ##__VA_ARGS__); \
} while (0)
/** /**
* DPU_DEBUG_DRIVER - macro for hardware driver logging * DPU_DEBUG_DRIVER - macro for hardware driver logging
* @fmt: Pointer to format string * @fmt: Pointer to format string
*/ */
#define DPU_DEBUG_DRIVER(fmt, ...) \ #define DPU_DEBUG_DRIVER(fmt, ...) \
do { \ DRM_DEBUG_DRIVER(fmt, ##__VA_ARGS__)
if (drm_debug_enabled(DRM_UT_DRIVER)) \
DRM_ERROR(fmt, ##__VA_ARGS__); \
else \
pr_debug(fmt, ##__VA_ARGS__); \
} while (0)
#define DPU_ERROR(fmt, ...) pr_err("[dpu error]" fmt, ##__VA_ARGS__) #define DPU_ERROR(fmt, ...) pr_err("[dpu error]" fmt, ##__VA_ARGS__)
#define DPU_ERROR_RATELIMITED(fmt, ...) pr_err_ratelimited("[dpu error]" fmt, ##__VA_ARGS__) #define DPU_ERROR_RATELIMITED(fmt, ...) pr_err_ratelimited("[dpu error]" fmt, ##__VA_ARGS__)
......
...@@ -681,6 +681,9 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane, ...@@ -681,6 +681,9 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane,
new_state->fb, &layout); new_state->fb, &layout);
if (ret) { if (ret) {
DPU_ERROR_PLANE(pdpu, "failed to get format layout, %d\n", ret); DPU_ERROR_PLANE(pdpu, "failed to get format layout, %d\n", ret);
if (pstate->aspace)
msm_framebuffer_cleanup(new_state->fb, pstate->aspace,
pstate->needs_dirtyfb);
return ret; return ret;
} }
...@@ -744,10 +747,9 @@ static int dpu_plane_atomic_check_pipe(struct dpu_plane *pdpu, ...@@ -744,10 +747,9 @@ static int dpu_plane_atomic_check_pipe(struct dpu_plane *pdpu,
min_src_size = MSM_FORMAT_IS_YUV(fmt) ? 2 : 1; min_src_size = MSM_FORMAT_IS_YUV(fmt) ? 2 : 1;
if (MSM_FORMAT_IS_YUV(fmt) && if (MSM_FORMAT_IS_YUV(fmt) &&
(!pipe->sspp->cap->sblk->scaler_blk.len || !pipe->sspp->cap->sblk->csc_blk.len) {
!pipe->sspp->cap->sblk->csc_blk.len)) {
DPU_DEBUG_PLANE(pdpu, DPU_DEBUG_PLANE(pdpu,
"plane doesn't have scaler/csc for yuv\n"); "plane doesn't have csc for yuv\n");
return -EINVAL; return -EINVAL;
} }
...@@ -864,6 +866,10 @@ static int dpu_plane_atomic_check(struct drm_plane *plane, ...@@ -864,6 +866,10 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
max_linewidth = pdpu->catalog->caps->max_linewidth; max_linewidth = pdpu->catalog->caps->max_linewidth;
drm_rect_rotate(&pipe_cfg->src_rect,
new_plane_state->fb->width, new_plane_state->fb->height,
new_plane_state->rotation);
if ((drm_rect_width(&pipe_cfg->src_rect) > max_linewidth) || if ((drm_rect_width(&pipe_cfg->src_rect) > max_linewidth) ||
_dpu_plane_calc_clk(&crtc_state->adjusted_mode, pipe_cfg) > max_mdp_clk_rate) { _dpu_plane_calc_clk(&crtc_state->adjusted_mode, pipe_cfg) > max_mdp_clk_rate) {
/* /*
...@@ -913,6 +919,14 @@ static int dpu_plane_atomic_check(struct drm_plane *plane, ...@@ -913,6 +919,14 @@ static int dpu_plane_atomic_check(struct drm_plane *plane,
r_pipe_cfg->dst_rect.x1 = pipe_cfg->dst_rect.x2; r_pipe_cfg->dst_rect.x1 = pipe_cfg->dst_rect.x2;
} }
drm_rect_rotate_inv(&pipe_cfg->src_rect,
new_plane_state->fb->width, new_plane_state->fb->height,
new_plane_state->rotation);
if (r_pipe->sspp)
drm_rect_rotate_inv(&r_pipe_cfg->src_rect,
new_plane_state->fb->width, new_plane_state->fb->height,
new_plane_state->rotation);
ret = dpu_plane_atomic_check_pipe(pdpu, pipe, pipe_cfg, fmt, &crtc_state->adjusted_mode); ret = dpu_plane_atomic_check_pipe(pdpu, pipe, pipe_cfg, fmt, &crtc_state->adjusted_mode);
if (ret) if (ret)
return ret; return ret;
......
...@@ -1286,6 +1286,8 @@ static int dp_ctrl_link_train(struct dp_ctrl_private *ctrl, ...@@ -1286,6 +1286,8 @@ static int dp_ctrl_link_train(struct dp_ctrl_private *ctrl,
link_info.rate = ctrl->link->link_params.rate; link_info.rate = ctrl->link->link_params.rate;
link_info.capabilities = DP_LINK_CAP_ENHANCED_FRAMING; link_info.capabilities = DP_LINK_CAP_ENHANCED_FRAMING;
dp_link_reset_phy_params_vx_px(ctrl->link);
dp_aux_link_configure(ctrl->aux, &link_info); dp_aux_link_configure(ctrl->aux, &link_info);
if (drm_dp_max_downspread(dpcd)) if (drm_dp_max_downspread(dpcd))
......
...@@ -90,22 +90,22 @@ static int dp_panel_read_dpcd(struct dp_panel *dp_panel) ...@@ -90,22 +90,22 @@ static int dp_panel_read_dpcd(struct dp_panel *dp_panel)
static u32 dp_panel_get_supported_bpp(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) 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; 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; link_info = &dp_panel->link_info;
data_rate_khz = link_info->num_lanes * link_info->rate * 8; 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) if (mode_pclk_khz * bpp <= data_rate_khz)
break; return bpp;
bpp -= 6; bpp -= 6;
} } while (bpp > min_supported_bpp);
return bpp; return min_supported_bpp;
} }
int dp_panel_read_sink_caps(struct dp_panel *dp_panel, int dp_panel_read_sink_caps(struct dp_panel *dp_panel,
...@@ -423,8 +423,9 @@ int dp_panel_init_panel_info(struct dp_panel *dp_panel) ...@@ -423,8 +423,9 @@ int dp_panel_init_panel_info(struct dp_panel *dp_panel)
drm_mode->clock); drm_mode->clock);
drm_dbg_dp(panel->drm_dev, "bpp = %d\n", dp_panel->dp_mode.bpp); drm_dbg_dp(panel->drm_dev, "bpp = %d\n", dp_panel->dp_mode.bpp);
dp_panel->dp_mode.bpp = max_t(u32, 18, dp_panel->dp_mode.bpp = dp_panel_get_mode_bpp(dp_panel, dp_panel->dp_mode.bpp,
min_t(u32, dp_panel->dp_mode.bpp, 30)); dp_panel->dp_mode.drm_mode.clock);
drm_dbg_dp(panel->drm_dev, "updated bpp = %d\n", drm_dbg_dp(panel->drm_dev, "updated bpp = %d\n",
dp_panel->dp_mode.bpp); dp_panel->dp_mode.bpp);
......
...@@ -577,7 +577,7 @@ static const struct msm_mdss_data sc7180_data = { ...@@ -577,7 +577,7 @@ static const struct msm_mdss_data sc7180_data = {
.ubwc_enc_version = UBWC_2_0, .ubwc_enc_version = UBWC_2_0,
.ubwc_dec_version = UBWC_2_0, .ubwc_dec_version = UBWC_2_0,
.ubwc_static = 0x1e, .ubwc_static = 0x1e,
.highest_bank_bit = 0x3, .highest_bank_bit = 0x1,
.reg_bus_bw = 76800, .reg_bus_bw = 76800,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment