Re: [Freedreno] [PATCH v2 00/10] drm/msm: probe deferral fixes

2022-09-13 Thread Johan Hovold
On Tue, Sep 13, 2022 at 03:23:10PM -0500, Steev Klimaszewski wrote: > Hi Johan, > > On 9/13/22 3:53 AM, Johan Hovold wrote: > > The MSM DRM driver is currently broken in multiple ways with respect to > > probe deferral. Not only does the driver currently fail to probe again > > after a late deferr

Re: [Freedreno] [PATCH] drm/msm: Fix return type of mdp4_lvds_connector_mode_valid

2022-09-13 Thread Abhinav Kumar
Hi Nathan Thanks for the patch. On 9/13/2022 1:55 PM, Nathan Huckleberry wrote: The mode_valid field in drm_connector_helper_funcs is expected to be of type: enum drm_mode_status (* mode_valid) (struct drm_connector *connector, struct drm_display_mode *mode

Re: [Freedreno] [PATCH] drm/msm: Fix return type of mdp4_lvds_connector_mode_valid

2022-09-13 Thread Nathan Chancellor
On Tue, Sep 13, 2022 at 01:55:48PM -0700, Nathan Huckleberry wrote: > The mode_valid field in drm_connector_helper_funcs is expected to be of > type: > enum drm_mode_status (* mode_valid) (struct drm_connector *connector, > struct drm_display_mode *mode); > > T

Re: [Freedreno] [PATCH v2 00/10] drm/msm: probe deferral fixes

2022-09-13 Thread Steev Klimaszewski
Hi Johan, On 9/13/22 3:53 AM, Johan Hovold wrote: The MSM DRM driver is currently broken in multiple ways with respect to probe deferral. Not only does the driver currently fail to probe again after a late deferral, but due to a related use-after-free bug this also triggers NULL-pointer derefere

Re: [Freedreno] [PATCH v7 01/15] drm/msm/disp/dpu: clear dpu_assign_crtc and get crtc from connector state instead of dpu_enc

2022-09-13 Thread Dmitry Baryshkov
On 13/09/2022 20:04, Dmitry Baryshkov wrote: On 13/09/2022 17:51, Vinod Polimera wrote: Update crtc retrieval from dpu_enc to dpu_enc connector state, since new links get set as part of the dpu enc virt mode set. The dpu_enc->crtc cache is no more needed, hence cleaning it as part of this change

Re: [Freedreno] [PATCH v7 01/15] drm/msm/disp/dpu: clear dpu_assign_crtc and get crtc from connector state instead of dpu_enc

2022-09-13 Thread Dmitry Baryshkov
On 13/09/2022 17:51, Vinod Polimera wrote: Update crtc retrieval from dpu_enc to dpu_enc connector state, since new links get set as part of the dpu enc virt mode set. The dpu_enc->crtc cache is no more needed, hence cleaning it as part of this change. Signed-off-by: Vinod Polimera --- driver

Re: [Freedreno] [PATCH 0/2] Add support for HDR color formats

2022-09-13 Thread Jessica Zhang
Hi Dmitry, On 9/12/2022 11:33 AM, Dmitry Baryshkov wrote: On 01/09/2022 23:34, Jessica Zhang wrote: Add support for HDR color formats. XR30 linear/compressed format has been validated with null_platform_test on SC7180, and P010 linear has been validated with plane_test (also on SC7180). Are

[Freedreno] [PATCH v7 07/15] drm/bridge: use atomic enable/disable callbacks for panel bridge

2022-09-13 Thread Vinod Polimera
Use atomic variants for panel bridge callback functions such that certain states like self-refresh can be accessed as part of enable/disable sequence. Signed-off-by: Sankeerth Billakanti Signed-off-by: Vinod Polimera Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/panel.c | 20 +++

[Freedreno] [PATCH v7 12/15] drm/msm/disp/dpu: get timing engine status from intf status register

2022-09-13 Thread Vinod Polimera
Timing gen status can be read reliablly from intf status register rather than from the timing gen control register, which will readback as "0" after disable though the timing gen is still under going disable path. This support was added from DPU version 5.0.0. Signed-off-by: Vinod Polimera --- d

[Freedreno] [PATCH v7 11/15] drm/msm/disp/dpu: add PSR support for eDP interface in dpu driver

2022-09-13 Thread Vinod Polimera
Enable PSR on eDP interface using drm self-refresh librabry. This patch uses a trigger from self-refresh library to enter/exit into PSR, when there are no updates from framework. Signed-off-by: Kalyan Thota Signed-off-by: Vinod Polimera Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dis

[Freedreno] [PATCH v7 03/15] drm/msm/dp: use atomic callbacks for DP bridge ops

2022-09-13 Thread Vinod Polimera
Use atomic variants for DP bridge callback functions so that the atomic state can be accessed in the interface drivers. The atomic state will help the driver find out if the display is in self refresh state. Signed-off-by: Sankeerth Billakanti Signed-off-by: Vinod Polimera Reviewed-by: Dmitry Ba

[Freedreno] [PATCH v7 13/15] drm/msm/disp/dpu: wait for extra vsync till timing engine status is disabled

2022-09-13 Thread Vinod Polimera
There can be a race between timing gen disable and vblank irq. The wait post timing gen disable may return early but intf disable sequence might not be completed. Ensure that, intf status is disabled before we retire the function. Signed-off-by: Vinod Polimera --- .../gpu/drm/msm/disp/dpu1/dpu_e

[Freedreno] [PATCH v7 08/15] drm/bridge: add psr support for panel bridge callbacks

2022-09-13 Thread Vinod Polimera
This change will handle the psr entry exit cases in the panel bridge atomic callback functions. For example, the panel power should not turn off if the panel is entering psr. Signed-off-by: Sankeerth Billakanti Signed-off-by: Vinod Polimera --- drivers/gpu/drm/bridge/panel.c | 48 ++

[Freedreno] [PATCH v7 04/15] drm/msm/dp: Add basic PSR support for eDP

2022-09-13 Thread Vinod Polimera
Add support for basic panel self refresh (PSR) feature for eDP. Add a new interface to set PSR state in the sink from DPU. Program the eDP controller to issue PSR enter and exit SDP to the sink. Signed-off-by: Sankeerth Billakanti Signed-off-by: Vinod Polimera Reviewed-by: Dmitry Baryshkov ---

[Freedreno] [PATCH v7 10/15] drm/msm/disp/dpu: check for crtc enable rather than crtc active to release shared resources

2022-09-13 Thread Vinod Polimera
According to KMS documentation, The driver must not release any shared resources if active is set to false but enable still true. Fixes: ccc862b957c6 ("drm/msm/dpu: Fix reservation failures in modeset") Signed-off-by: Vinod Polimera Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu

[Freedreno] [PATCH v7 15/15] drm/msm/disp/dpu: clear active interface in the datapath cleanup

2022-09-13 Thread Vinod Polimera
Clear interface active register from the datapath for a clean shutdown of the datapath. Signed-off-by: Vinod Polimera --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu

[Freedreno] [PATCH v7 06/15] drm/msm/dp: disable self_refresh_aware after entering psr

2022-09-13 Thread Vinod Polimera
From: Sankeerth Billakanti Updated frames get queued if self_refresh_aware is set when the sink is in psr. To support bridge enable and avoid queuing of update frames, reset the self_refresh_aware state after entering psr. Signed-off-by: Sankeerth Billakanti Signed-off-by: Vinod Polimera ---

[Freedreno] [PATCH v7 02/15] drm: add helper functions to retrieve old and new crtc

2022-09-13 Thread Vinod Polimera
Add new helper functions, drm_atomic_get_old_crtc_for_encoder and drm_atomic_get_new_crtc_for_encoder to retrieve the corresponding crtc for the encoder. Signed-off-by: Sankeerth Billakanti Signed-off-by: Vinod Polimera Reviewed-by: Douglas Anderson --- drivers/gpu/drm/drm_atomic.c | 60 ++

[Freedreno] [PATCH v7 05/15] drm/msm/dp: use the eDP bridge ops to validate eDP modes

2022-09-13 Thread Vinod Polimera
The eDP and DP interfaces shared the bridge operations and the eDP specific changes were implemented under is_edp check. To add psr support for eDP, we started using a new set of eDP bridge ops. We are moving the eDP specific code in the dp_bridge_mode_valid function to a new eDP function, edp_brid

[Freedreno] [PATCH v7 14/15] drm/msm/disp/dpu: reset the datapath after timing engine disable

2022-09-13 Thread Vinod Polimera
Reset the datapath after disabling the timing gen, such that it can start on a clean slate when the intf is enabled back. This was a recommended sequence from the DPU HW programming guide. Signed-off-by: Vinod Polimera --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 1 + 1 file change

[Freedreno] [PATCH v7 09/15] drm/msm/disp/dpu: use atomic enable/disable callbacks for encoder functions

2022-09-13 Thread Vinod Polimera
Use atomic variants for encoder callback functions such that certain states like self-refresh can be accessed as part of enable/disable sequence. Signed-off-by: Kalyan Thota Signed-off-by: Vinod Polimera Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 10 ++-

[Freedreno] [PATCH v7 01/15] drm/msm/disp/dpu: clear dpu_assign_crtc and get crtc from connector state instead of dpu_enc

2022-09-13 Thread Vinod Polimera
Update crtc retrieval from dpu_enc to dpu_enc connector state, since new links get set as part of the dpu enc virt mode set. The dpu_enc->crtc cache is no more needed, hence cleaning it as part of this change. Signed-off-by: Vinod Polimera --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c| 4 ---

[Freedreno] [PATCH v7 00/15] Add PSR support for eDP

2022-09-13 Thread Vinod Polimera
Changes in v2: - Use dp bridge to set psr entry/exit instead of dpu_enocder. - Don't modify whitespaces. - Set self refresh aware from atomic_check. - Set self refresh aware only if psr is supported. - Provide a stub for msm_dp_display_set_psr. - Move dp functions to bridge code. Chang

Re: [Freedreno] [PATCH v6 01/10] drm/msm/disp/dpu: clear dpu_assign_crtc and get crtc from connector state instead of dpu_enc

2022-09-13 Thread Vinod Polimera
> -Original Message- > From: Doug Anderson > Sent: Friday, July 29, 2022 5:48 AM > To: Vinod Polimera (QUIC) > Cc: dri-devel ; linux-arm-msm m...@vger.kernel.org>; freedreno ; > open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS > ; LKML ; Rob > Clark ; Stephen Boyd ; > Kalyan

Re: [Freedreno] [PATCH v2 06/10] drm/msm/dp: fix aux-bus EP lifetime

2022-09-13 Thread Doug Anderson
Hi, On Tue, Sep 13, 2022 at 9:58 AM Johan Hovold wrote: > > Device-managed resources allocated post component bind must be tied to > the lifetime of the aggregate DRM device or they will not necessarily be > released when binding of the aggregate device is deferred. > > This can lead resource lea

Re: [Freedreno] [RFC PATCH 0/3] drm/msm/dp: several fixes for the IRQ handling

2022-09-13 Thread Johan Hovold
On Thu, Sep 01, 2022 at 12:15:24PM +0300, Dmitry Baryshkov wrote: > Johan Hovold has reported that returning a probe deferral from the > msm_dp_modeset_init() can cause issues because the IRQ is not freed > properly. This (compile-tested only) series tries to fix the issue by > moving devm_request_

[Freedreno] [PATCH v2 00/10] drm/msm: probe deferral fixes

2022-09-13 Thread Johan Hovold
The MSM DRM driver is currently broken in multiple ways with respect to probe deferral. Not only does the driver currently fail to probe again after a late deferral, but due to a related use-after-free bug this also triggers NULL-pointer dereferences. These bugs are not new but have become critica

[Freedreno] [PATCH v2 05/10] drm/msm/dp: fix IRQ lifetime

2022-09-13 Thread Johan Hovold
Device-managed resources allocated post component bind must be tied to the lifetime of the aggregate DRM device or they will not necessarily be released when binding of the aggregate device is deferred. This is specifically true for the DP IRQ, which will otherwise remain requested so that the nex

[Freedreno] [PATCH v2 10/10] drm/msm/dsi: drop modeset sanity checks

2022-09-13 Thread Johan Hovold
Drop the overly defensive modeset sanity checks of function parameters which have already been checked or used by the callers. Reviewed-by: Dmitry Baryshkov Signed-off-by: Johan Hovold --- drivers/gpu/drm/msm/dsi/dsi.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/dr

[Freedreno] [PATCH v2 09/10] drm/msm/dp: drop modeset sanity checks

2022-09-13 Thread Johan Hovold
Drop the overly defensive modeset sanity checks of function parameters which have already been checked or used by the callers. Reviewed-by: Dmitry Baryshkov Signed-off-by: Johan Hovold --- drivers/gpu/drm/msm/dp/dp_display.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --gi

[Freedreno] [PATCH v2 06/10] drm/msm/dp: fix aux-bus EP lifetime

2022-09-13 Thread Johan Hovold
Device-managed resources allocated post component bind must be tied to the lifetime of the aggregate DRM device or they will not necessarily be released when binding of the aggregate device is deferred. This can lead resource leaks or failure to bind the aggregate device when binding is later retr

[Freedreno] [PATCH v2 04/10] drm/msm/hdmi: fix memory corruption with too many bridges

2022-09-13 Thread Johan Hovold
Add the missing sanity check on the bridge counter to avoid corrupting data beyond the fixed-sized bridge array in case there are ever more than eight bridges. Fixes: a3376e3ec81c ("drm/msm: convert to drm_bridge") Cc: sta...@vger.kernel.org # 3.12 Signed-off-by: Johan Hovold --- drivers/gp

[Freedreno] [PATCH v2 07/10] drm/msm/dp: fix bridge lifetime

2022-09-13 Thread Johan Hovold
Device-managed resources allocated post component bind must be tied to the lifetime of the aggregate DRM device or they will not necessarily be released when binding of the aggregate device is deferred. This can lead resource leaks or failure to bind the aggregate device when binding is later retr

[Freedreno] [PATCH v2 03/10] drm/msm/dsi: fix memory corruption with too many bridges

2022-09-13 Thread Johan Hovold
Add the missing sanity check on the bridge counter to avoid corrupting data beyond the fixed-sized bridge array in case there are ever more than eight bridges. Fixes: a689554ba6ed ("drm/msm: Initial add DSI connector support") Cc: sta...@vger.kernel.org # 4.1 Signed-off-by: Johan Hovold ---

[Freedreno] [PATCH v2 01/10] drm/msm: fix use-after-free on probe deferral

2022-09-13 Thread Johan Hovold
The bridge counter was never reset when tearing down the DRM device so that stale pointers to deallocated structures would be accessed on the next tear down (e.g. after a second late bind deferral). Given enough bridges and a few probe deferrals this could currently also lead to data beyond the br

[Freedreno] [PATCH v2 08/10] drm/msm/hdmi: fix IRQ lifetime

2022-09-13 Thread Johan Hovold
Device-managed resources allocated post component bind must be tied to the lifetime of the aggregate DRM device or they will not necessarily be released when binding of the aggregate device is deferred. This is specifically true for the HDMI IRQ, which will otherwise remain requested so that the n

[Freedreno] [PATCH v2 02/10] drm/msm/dp: fix memory corruption with too many bridges

2022-09-13 Thread Johan Hovold
Add the missing sanity check on the bridge counter to avoid corrupting data beyond the fixed-sized bridge array in case there are ever more than eight bridges. Fixes: 8a3b4c17f863 ("drm/msm/dp: employ bridge mechanism for display enable and disable") Cc: sta...@vger.kernel.org # 5.17 Signed-

Re: [Freedreno] [PATCH 7/7] drm/msm: drop modeset sanity checks

2022-09-13 Thread Johan Hovold
On Mon, Sep 12, 2022 at 09:06:28PM +0300, Dmitry Baryshkov wrote: > On 12/09/2022 18:40, Johan Hovold wrote: > > Drop the overly defensive modeset sanity checks of function parameters > > which have already been checked or used by the callers. > > > > Signed-off-by: Johan Hovold > > Again, pleas

Re: [Freedreno] [PATCH 2/7] drm/msm: fix memory corruption with too many bridges

2022-09-13 Thread Johan Hovold
On Mon, Sep 12, 2022 at 08:55:55PM +0300, Dmitry Baryshkov wrote: > On 12/09/2022 18:40, Johan Hovold wrote: > > Add the missing sanity checks on the bridge counter to avoid corrupting > > data beyond the fixed-sized bridge array in case there are ever more > > than eight bridges. > > > > a3376e3e

Re: [Freedreno] [PATCH 1/7] drm/msm: fix use-after-free on probe deferral

2022-09-13 Thread Johan Hovold
On Mon, Sep 12, 2022 at 08:52:44PM +0300, Dmitry Baryshkov wrote: > On 12/09/2022 18:40, Johan Hovold wrote: > > The bridge counter was never reset when tearing down the DRM device so > > that stale pointers to deallocated structures would be accessed on the > > next tear down (e.g. after a second

Re: [Freedreno] [PATCH 4/7] drm/msm/dp: fix aux-bus EP lifetime

2022-09-13 Thread Johan Hovold
On Mon, Sep 12, 2022 at 04:55:58PM -0500, Steev Klimaszewski wrote: > > On 9/12/22 1:10 PM, Dmitry Baryshkov wrote: > > On 12/09/2022 18:40, Johan Hovold wrote: > >> Device-managed resources allocated post component bind must be tied to > >> the lifetime of the aggregate DRM device or they will no

Re: [Freedreno] [PATCH 4/7] drm/msm/dp: fix aux-bus EP lifetime

2022-09-13 Thread Johan Hovold
On Tue, Sep 13, 2022 at 07:35:15AM +0100, Doug Anderson wrote: > Hi, > > On Mon, Sep 12, 2022 at 7:10 PM Dmitry Baryshkov > wrote: > > > > On 12/09/2022 18:40, Johan Hovold wrote: > > > Device-managed resources allocated post component bind must be tied to > > > the lifetime of the aggregate DRM