Re: [PATCH v2.5] drm/msm/dsi: switch to DRM_PANEL_BRIDGE #forregzbot
On 13.11.22 11:23, Thorsten Leemhuis wrote: > [Note: this mail is primarily send for documentation purposes and/or for > regzbot, my Linux kernel regression tracking bot. That's why I removed > most or all folks from the list of recipients, but left any that looked > like a mailing lists. These mails usually contain '#forregzbot' in the > subject, to make them easy to spot and filter out.] > > [TLDR: I'm adding this regression report to the list of tracked > regressions; all text from me you find below is based on a few templates > paragraphs you might have encountered already already in similar form.] > > Hi, this is your Linux kernel regression tracker. > > On 11.11.22 16:30, Caleb Connolly wrote: >> >> This patch has caused a regression on 6.1-rc for some devices that use >> DSI panels. The new behaviour results in the DSI controller being >> switched off before the panel unprepare hook is called. As a result, >> panel drivers which call mipi_dsi_dcs_write() or similar in unprepare() >> fail. >> >> I've noticed it specifically on the OnePlus 6 (with upstream Samsung >> s0fef00 panel driver) and the SHIFT6mq with an out of tree driver. > > Thanks for the report. To be sure below issue doesn't fall through the > cracks unnoticed, I'm adding it to regzbot, my Linux kernel regression > tracking bot: > > #regzbot ^introduced 007ac0262b0d > #regzbot title drm: msm: DSI controller being switched off before the > panel unprepare hook is called > #regzbot ignore-activity #regzbot inconclusive: reporter MIA
Re: [PATCH v2.5] drm/msm/dsi: switch to DRM_PANEL_BRIDGE
Hi, this is your Linux kernel regression tracker. On 13.11.22 14:28, Dmitry Baryshkov wrote: > Hi Caleb, > > On Fri, 11 Nov 2022 at 18:30, Caleb Connolly > wrote: >> >> Hi, >> >> This patch has caused a regression on 6.1-rc for some devices that use >> DSI panels. The new behaviour results in the DSI controller being >> switched off before the panel unprepare hook is called. As a result, >> panel drivers which call mipi_dsi_dcs_write() or similar in >> unprepare() fail. > > Thanks for the notice. Can you move your command stream to > panel_disable() hook? (even if it's just as a temporary workaround) Caleb, did you look into what Dmitry suggested? This issue is on my list of tracked regressions in 6.1 and time is running out to get it fixed before the release. Or was there any progress to get this fixed and I just missed it? Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) P.S.: As the Linux kernel's regression tracker I deal with a lot of reports and sometimes miss something important when writing mails like this. If that's the case here, don't hesitate to tell me in a public reply, it's in everyone's interest to set the public record straight. #regzbot ignore-activity > From what I see from other panels, some of them call > mipi_dsi_dcs_set_display_off() in the unprepare() hook, while others > do it in disable(). > > Yes, this is (again) the DSI host vs device order here. Short story: > the DRM has a notion of 'the display pipe (i.e. clocks and timing > signals) feeding the bridge being running'. That's the difference > between enable/pre_enable and disable/post_disable. For the DSI we > have a third state, when the DSI clock and ln0 allow transferring > commands to the panel, but the image is not enabled. > > There was a somewhat promising patchset at [1], but it seems it went > out of the radar. I can try working on an alternative (explicit) > approach if I have time. > > With respect to your panel. Let me quote the docs: 'Before stopping > video transmission from the display controller it can be necessary to > turn off the panel to avoid visual glitches. This is done in the > .disable() function. Analogously to .enable() this typically involves > turning off the backlight and waiting for some time to make sure no > image is visible on the panel. It is then safe for the display > controller to cease transmission of video data.' > > So, if we stop the call chain after switching the DSI host off but > before calling the panel's unprepare() hook, will we see any > artifacts/image leftover/etc. on the panel? Generally I have the > feeling that all panels should call mipi_dsi_dcs_set_display_off() in > the .disable() hook, not in the .unprepare() one. > > [1] > https://lore.kernel.org/dri-devel/cover.1646406653.git.dave.steven...@raspberrypi.com/ > >> >> I've noticed it specifically on the OnePlus 6 (with upstream Samsung >> s0fef00 panel driver) and the SHIFT6mq with an out of tree driver. >> >> On 12/07/2022 14:22, Dmitry Baryshkov wrote: >>> Currently the DSI driver has two separate paths: one if the next device >>> in a chain is a bridge and another one if the panel is connected >>> directly to the DSI host. Simplify the code path by using panel-bridge >>> driver (already selected in Kconfig) and dropping support for >>> handling the panel directly. >>> >>> Signed-off-by: Dmitry Baryshkov >>> --- >>> >>> I'm not sending this as a separate patchset (I'd like to sort out mdp5 >>> first), but more of a preview of changes related to >>> msm_dsi_manager_ext_bridge_init(). >>> >>> --- >>> drivers/gpu/drm/msm/dsi/dsi.c | 35 +--- >>> drivers/gpu/drm/msm/dsi/dsi.h | 16 +- >>> drivers/gpu/drm/msm/dsi/dsi_host.c| 25 --- >>> drivers/gpu/drm/msm/dsi/dsi_manager.c | 283 +++--- >>> 4 files changed, 36 insertions(+), 323 deletions(-) > > [skipped the patch itself] >
Re: [PATCH v2.5] drm/msm/dsi: switch to DRM_PANEL_BRIDGE
Hi Caleb, On Fri, 11 Nov 2022 at 18:30, Caleb Connolly wrote: > > Hi, > > This patch has caused a regression on 6.1-rc for some devices that use > DSI panels. The new behaviour results in the DSI controller being > switched off before the panel unprepare hook is called. As a result, > panel drivers which call mipi_dsi_dcs_write() or similar in > unprepare() fail. Thanks for the notice. Can you move your command stream to panel_disable() hook? (even if it's just as a temporary workaround) >From what I see from other panels, some of them call mipi_dsi_dcs_set_display_off() in the unprepare() hook, while others do it in disable(). Yes, this is (again) the DSI host vs device order here. Short story: the DRM has a notion of 'the display pipe (i.e. clocks and timing signals) feeding the bridge being running'. That's the difference between enable/pre_enable and disable/post_disable. For the DSI we have a third state, when the DSI clock and ln0 allow transferring commands to the panel, but the image is not enabled. There was a somewhat promising patchset at [1], but it seems it went out of the radar. I can try working on an alternative (explicit) approach if I have time. With respect to your panel. Let me quote the docs: 'Before stopping video transmission from the display controller it can be necessary to turn off the panel to avoid visual glitches. This is done in the .disable() function. Analogously to .enable() this typically involves turning off the backlight and waiting for some time to make sure no image is visible on the panel. It is then safe for the display controller to cease transmission of video data.' So, if we stop the call chain after switching the DSI host off but before calling the panel's unprepare() hook, will we see any artifacts/image leftover/etc. on the panel? Generally I have the feeling that all panels should call mipi_dsi_dcs_set_display_off() in the .disable() hook, not in the .unprepare() one. [1] https://lore.kernel.org/dri-devel/cover.1646406653.git.dave.steven...@raspberrypi.com/ > > I've noticed it specifically on the OnePlus 6 (with upstream Samsung > s0fef00 panel driver) and the SHIFT6mq with an out of tree driver. > > On 12/07/2022 14:22, Dmitry Baryshkov wrote: > > Currently the DSI driver has two separate paths: one if the next device > > in a chain is a bridge and another one if the panel is connected > > directly to the DSI host. Simplify the code path by using panel-bridge > > driver (already selected in Kconfig) and dropping support for > > handling the panel directly. > > > > Signed-off-by: Dmitry Baryshkov > > --- > > > > I'm not sending this as a separate patchset (I'd like to sort out mdp5 > > first), but more of a preview of changes related to > > msm_dsi_manager_ext_bridge_init(). > > > > --- > > drivers/gpu/drm/msm/dsi/dsi.c | 35 +--- > > drivers/gpu/drm/msm/dsi/dsi.h | 16 +- > > drivers/gpu/drm/msm/dsi/dsi_host.c| 25 --- > > drivers/gpu/drm/msm/dsi/dsi_manager.c | 283 +++--- > > 4 files changed, 36 insertions(+), 323 deletions(-) [skipped the patch itself] -- With best wishes Dmitry
Re: [PATCH v2.5] drm/msm/dsi: switch to DRM_PANEL_BRIDGE #forregzbot
[Note: this mail is primarily send for documentation purposes and/or for regzbot, my Linux kernel regression tracking bot. That's why I removed most or all folks from the list of recipients, but left any that looked like a mailing lists. These mails usually contain '#forregzbot' in the subject, to make them easy to spot and filter out.] [TLDR: I'm adding this regression report to the list of tracked regressions; all text from me you find below is based on a few templates paragraphs you might have encountered already already in similar form.] Hi, this is your Linux kernel regression tracker. On 11.11.22 16:30, Caleb Connolly wrote: > > This patch has caused a regression on 6.1-rc for some devices that use > DSI panels. The new behaviour results in the DSI controller being > switched off before the panel unprepare hook is called. As a result, > panel drivers which call mipi_dsi_dcs_write() or similar in unprepare() > fail. > > I've noticed it specifically on the OnePlus 6 (with upstream Samsung > s0fef00 panel driver) and the SHIFT6mq with an out of tree driver. Thanks for the report. To be sure below issue doesn't fall through the cracks unnoticed, I'm adding it to regzbot, my Linux kernel regression tracking bot: #regzbot ^introduced 007ac0262b0d #regzbot title drm: msm: DSI controller being switched off before the panel unprepare hook is called #regzbot ignore-activity This isn't a regression? This issue or a fix for it are already discussed somewhere else? It was fixed already? You want to clarify when the regression started to happen? Or point out I got the title or something else totally wrong? Then just reply -- ideally with also telling regzbot about it, as explained here: https://linux-regtracking.leemhuis.info/tracked-regression/ Reminder for developers: When fixing the issue, add 'Link:' tags pointing to the report (the mail this one replies to), as explained for in the Linux kernel's documentation; above webpage explains why this is important for tracked regressions. Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) P.S.: As the Linux kernel's regression tracker I deal with a lot of reports and sometimes miss something important when writing mails like this. If that's the case here, don't hesitate to tell me in a public reply, it's in everyone's interest to set the public record straight. > On 12/07/2022 14:22, Dmitry Baryshkov wrote: >> Currently the DSI driver has two separate paths: one if the next device >> in a chain is a bridge and another one if the panel is connected >> directly to the DSI host. Simplify the code path by using panel-bridge >> driver (already selected in Kconfig) and dropping support for >> handling the panel directly. >> >> Signed-off-by: Dmitry Baryshkov >> --- >> >> I'm not sending this as a separate patchset (I'd like to sort out mdp5 >> first), but more of a preview of changes related to >> msm_dsi_manager_ext_bridge_init(). >> >> --- >> drivers/gpu/drm/msm/dsi/dsi.c | 35 +--- >> drivers/gpu/drm/msm/dsi/dsi.h | 16 +- >> drivers/gpu/drm/msm/dsi/dsi_host.c | 25 --- >> drivers/gpu/drm/msm/dsi/dsi_manager.c | 283 +++--- >> 4 files changed, 36 insertions(+), 323 deletions(-) >> >> diff --git a/drivers/gpu/drm/msm/dsi/dsi.c >> b/drivers/gpu/drm/msm/dsi/dsi.c >> index 1625328fa430..4edb9167e600 100644 >> --- a/drivers/gpu/drm/msm/dsi/dsi.c >> +++ b/drivers/gpu/drm/msm/dsi/dsi.c >> @@ -6,14 +6,6 @@ >> #include "dsi.h" >> #include "dsi_cfg.h" >> >> -struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi) >> -{ >> - if (!msm_dsi || !msm_dsi_device_connected(msm_dsi)) >> - return NULL; >> - >> - return msm_dsi->encoder; >> -} >> - >> bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi) >> { >> unsigned long host_flags = >> msm_dsi_host_get_mode_flags(msm_dsi->host); >> @@ -220,7 +212,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, >> struct drm_device *dev, >> struct drm_encoder *encoder) >> { >> struct msm_drm_private *priv; >> - struct drm_bridge *ext_bridge; >> int ret; >> >> if (WARN_ON(!encoder) || WARN_ON(!msm_dsi) || WARN_ON(!dev)) >> @@ -254,26 +245,10 @@ int msm_dsi_modeset_init(struct msm_dsi >> *msm_dsi, struct drm_device *dev, >> goto fail; >> } >> >> - /* >> - * check if the dsi encoder output is connected to a panel or an >> - * external bridge. We create a connector only if we're connected >> to a >> - * drm_panel device. When we're connected to an external bridge, we >> - * assume that the drm_bridge driver will create the connector >> itself. >> - */ >> - ext_bridge = msm_dsi_host_get_bridge(msm_dsi->host); >> - >> - if (ext_bridge) >> - msm_dsi->connector = >> - msm_dsi_manager_ext_bridge_init(msm_dsi->id); >> - else >> - msm_dsi->connector = >> - msm_dsi_manager_connector_init(msm_dsi->id); >> - >> - if
Re: [PATCH v2.5] drm/msm/dsi: switch to DRM_PANEL_BRIDGE
Hi, This patch has caused a regression on 6.1-rc for some devices that use DSI panels. The new behaviour results in the DSI controller being switched off before the panel unprepare hook is called. As a result, panel drivers which call mipi_dsi_dcs_write() or similar in unprepare() fail. I've noticed it specifically on the OnePlus 6 (with upstream Samsung s0fef00 panel driver) and the SHIFT6mq with an out of tree driver. On 12/07/2022 14:22, Dmitry Baryshkov wrote: Currently the DSI driver has two separate paths: one if the next device in a chain is a bridge and another one if the panel is connected directly to the DSI host. Simplify the code path by using panel-bridge driver (already selected in Kconfig) and dropping support for handling the panel directly. Signed-off-by: Dmitry Baryshkov --- I'm not sending this as a separate patchset (I'd like to sort out mdp5 first), but more of a preview of changes related to msm_dsi_manager_ext_bridge_init(). --- drivers/gpu/drm/msm/dsi/dsi.c | 35 +--- drivers/gpu/drm/msm/dsi/dsi.h | 16 +- drivers/gpu/drm/msm/dsi/dsi_host.c| 25 --- drivers/gpu/drm/msm/dsi/dsi_manager.c | 283 +++--- 4 files changed, 36 insertions(+), 323 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index 1625328fa430..4edb9167e600 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -6,14 +6,6 @@ #include "dsi.h" #include "dsi_cfg.h" -struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi) -{ - if (!msm_dsi || !msm_dsi_device_connected(msm_dsi)) - return NULL; - - return msm_dsi->encoder; -} - bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi) { unsigned long host_flags = msm_dsi_host_get_mode_flags(msm_dsi->host); @@ -220,7 +212,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, struct drm_encoder *encoder) { struct msm_drm_private *priv; - struct drm_bridge *ext_bridge; int ret; if (WARN_ON(!encoder) || WARN_ON(!msm_dsi) || WARN_ON(!dev)) @@ -254,26 +245,10 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, goto fail; } - /* -* check if the dsi encoder output is connected to a panel or an -* external bridge. We create a connector only if we're connected to a -* drm_panel device. When we're connected to an external bridge, we -* assume that the drm_bridge driver will create the connector itself. -*/ - ext_bridge = msm_dsi_host_get_bridge(msm_dsi->host); - - if (ext_bridge) - msm_dsi->connector = - msm_dsi_manager_ext_bridge_init(msm_dsi->id); - else - msm_dsi->connector = - msm_dsi_manager_connector_init(msm_dsi->id); - - if (IS_ERR(msm_dsi->connector)) { - ret = PTR_ERR(msm_dsi->connector); + ret = msm_dsi_manager_ext_bridge_init(msm_dsi->id); + if (ret) { DRM_DEV_ERROR(dev->dev, "failed to create dsi connector: %d\n", ret); - msm_dsi->connector = NULL; goto fail; } @@ -287,12 +262,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, msm_dsi->bridge = NULL; } - /* don't destroy connector if we didn't make it */ - if (msm_dsi->connector && !msm_dsi->external_bridge) - msm_dsi->connector->funcs->destroy(msm_dsi->connector); - - msm_dsi->connector = NULL; - return ret; } diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h index 580a1e6358bf..703e4c88d7fb 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.h +++ b/drivers/gpu/drm/msm/dsi/dsi.h @@ -12,7 +12,6 @@ #include #include #include -#include #include "msm_drv.h" #include "disp/msm_disp_snapshot.h" @@ -49,8 +48,6 @@ struct msm_dsi { struct drm_device *dev; struct platform_device *pdev; - /* connector managed by us when we're connected to a drm_panel */ - struct drm_connector *connector; /* internal dsi bridge attached to MDP interface */ struct drm_bridge *bridge; @@ -58,10 +55,8 @@ struct msm_dsi { struct msm_dsi_phy *phy; /* -* panel/external_bridge connected to dsi bridge output, only one of the -* two can be valid at a time +* external_bridge connected to dsi bridge output */ - struct drm_panel *panel; struct drm_bridge *external_bridge; struct device *phy_dev; @@ -76,8 +71,7 @@ struct msm_dsi { /* dsi manager */ struct drm_bridge *msm_dsi_manager_bridge_init(u8 id); void msm_dsi_manager_bridge_destroy(struct drm_bridge *bridge); -struct drm_connector *msm_dsi_manager_connector_init(u8 id); -struct drm_connector
Re: [Freedreno] [PATCH v2.5] drm/msm/dsi: switch to DRM_PANEL_BRIDGE
On 8/22/2022 10:53 AM, Dmitry Baryshkov wrote: On 15/07/2022 00:54, Abhinav Kumar wrote: On 7/12/2022 6:22 AM, Dmitry Baryshkov wrote: Currently the DSI driver has two separate paths: one if the next device in a chain is a bridge and another one if the panel is connected directly to the DSI host. Simplify the code path by using panel-bridge driver (already selected in Kconfig) and dropping support for handling the panel directly. Signed-off-by: Dmitry Baryshkov --- I'm not sending this as a separate patchset (I'd like to sort out mdp5 first), but more of a preview of changes related to msm_dsi_manager_ext_bridge_init(). --- drivers/gpu/drm/msm/dsi/dsi.c | 35 +--- drivers/gpu/drm/msm/dsi/dsi.h | 16 +- drivers/gpu/drm/msm/dsi/dsi_host.c | 25 --- drivers/gpu/drm/msm/dsi/dsi_manager.c | 283 +++--- 4 files changed, 36 insertions(+), 323 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index 1625328fa430..4edb9167e600 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -6,14 +6,6 @@ #include "dsi.h" #include "dsi_cfg.h" -struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi) -{ - if (!msm_dsi || !msm_dsi_device_connected(msm_dsi)) - return NULL; - - return msm_dsi->encoder; -} - bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi) { unsigned long host_flags = msm_dsi_host_get_mode_flags(msm_dsi->host); @@ -220,7 +212,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, struct drm_encoder *encoder) { struct msm_drm_private *priv; - struct drm_bridge *ext_bridge; int ret; if (WARN_ON(!encoder) || WARN_ON(!msm_dsi) || WARN_ON(!dev)) @@ -254,26 +245,10 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, goto fail; } - /* - * check if the dsi encoder output is connected to a panel or an - * external bridge. We create a connector only if we're connected to a - * drm_panel device. When we're connected to an external bridge, we - * assume that the drm_bridge driver will create the connector itself. - */ - ext_bridge = msm_dsi_host_get_bridge(msm_dsi->host); - - if (ext_bridge) - msm_dsi->connector = - msm_dsi_manager_ext_bridge_init(msm_dsi->id); - else - msm_dsi->connector = - msm_dsi_manager_connector_init(msm_dsi->id); - - if (IS_ERR(msm_dsi->connector)) { - ret = PTR_ERR(msm_dsi->connector); + ret = msm_dsi_manager_ext_bridge_init(msm_dsi->id); + if (ret) { DRM_DEV_ERROR(dev->dev, "failed to create dsi connector: %d\n", ret); - msm_dsi->connector = NULL; goto fail; } @@ -287,12 +262,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, msm_dsi->bridge = NULL; } - /* don't destroy connector if we didn't make it */ - if (msm_dsi->connector && !msm_dsi->external_bridge) - msm_dsi->connector->funcs->destroy(msm_dsi->connector); - - msm_dsi->connector = NULL; From what i can see all the usages of msm_dsi->connector are removed after this change. So can we drop that? The connector field is dropped from the msm_dsi struct. If you are asking about the msm_dsi_modeset_init(), we can not drop it since we require the DRM device with GEM being initialized in order to allocate DSI DMA buffer. We can think about moving DMA buffer allocation towards the usage point, however this is definitely a separate commit. [skipped] Yes, got it. *msm_dsi_manager_ext_bridge_init(u8 id) ret = drm_bridge_attach(encoder, ext_bridge, int_bridge, DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (ret == -EINVAL) { - struct drm_connector *connector; - struct list_head *connector_list; - - /* link the internal dsi bridge to the external bridge */ - drm_bridge_attach(encoder, ext_bridge, int_bridge, 0); - /* - * we need the drm_connector created by the external bridge - * driver (or someone else) to feed it to our driver's - * priv->connector[] list, mainly for msm_fbdev_init() + * link the internal dsi bridge to the external bridge, + * connector is created by the next bridge. */ - connector_list = >mode_config.connector_list; + ret = drm_bridge_attach(encoder, ext_bridge, int_bridge, 0); + if (ret < 0) + return ret; + } else { + struct drm_connector *connector; - list_for_each_entry(connector, connector_list, head) { - if (drm_connector_has_possible_encoder(connector, encoder)) - return connector; + /* We are in charge of the connector, create one now. */ + connector = drm_bridge_connector_init(dev, encoder); + if (IS_ERR(connector)) { + DRM_ERROR("Unable to
Re: [Freedreno] [PATCH v2.5] drm/msm/dsi: switch to DRM_PANEL_BRIDGE
On 15/07/2022 00:54, Abhinav Kumar wrote: On 7/12/2022 6:22 AM, Dmitry Baryshkov wrote: Currently the DSI driver has two separate paths: one if the next device in a chain is a bridge and another one if the panel is connected directly to the DSI host. Simplify the code path by using panel-bridge driver (already selected in Kconfig) and dropping support for handling the panel directly. Signed-off-by: Dmitry Baryshkov --- I'm not sending this as a separate patchset (I'd like to sort out mdp5 first), but more of a preview of changes related to msm_dsi_manager_ext_bridge_init(). --- drivers/gpu/drm/msm/dsi/dsi.c | 35 +--- drivers/gpu/drm/msm/dsi/dsi.h | 16 +- drivers/gpu/drm/msm/dsi/dsi_host.c | 25 --- drivers/gpu/drm/msm/dsi/dsi_manager.c | 283 +++--- 4 files changed, 36 insertions(+), 323 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index 1625328fa430..4edb9167e600 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -6,14 +6,6 @@ #include "dsi.h" #include "dsi_cfg.h" -struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi) -{ - if (!msm_dsi || !msm_dsi_device_connected(msm_dsi)) - return NULL; - - return msm_dsi->encoder; -} - bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi) { unsigned long host_flags = msm_dsi_host_get_mode_flags(msm_dsi->host); @@ -220,7 +212,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, struct drm_encoder *encoder) { struct msm_drm_private *priv; - struct drm_bridge *ext_bridge; int ret; if (WARN_ON(!encoder) || WARN_ON(!msm_dsi) || WARN_ON(!dev)) @@ -254,26 +245,10 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, goto fail; } - /* - * check if the dsi encoder output is connected to a panel or an - * external bridge. We create a connector only if we're connected to a - * drm_panel device. When we're connected to an external bridge, we - * assume that the drm_bridge driver will create the connector itself. - */ - ext_bridge = msm_dsi_host_get_bridge(msm_dsi->host); - - if (ext_bridge) - msm_dsi->connector = - msm_dsi_manager_ext_bridge_init(msm_dsi->id); - else - msm_dsi->connector = - msm_dsi_manager_connector_init(msm_dsi->id); - - if (IS_ERR(msm_dsi->connector)) { - ret = PTR_ERR(msm_dsi->connector); + ret = msm_dsi_manager_ext_bridge_init(msm_dsi->id); + if (ret) { DRM_DEV_ERROR(dev->dev, "failed to create dsi connector: %d\n", ret); - msm_dsi->connector = NULL; goto fail; } @@ -287,12 +262,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, msm_dsi->bridge = NULL; } - /* don't destroy connector if we didn't make it */ - if (msm_dsi->connector && !msm_dsi->external_bridge) - msm_dsi->connector->funcs->destroy(msm_dsi->connector); - - msm_dsi->connector = NULL; From what i can see all the usages of msm_dsi->connector are removed after this change. So can we drop that? The connector field is dropped from the msm_dsi struct. If you are asking about the msm_dsi_modeset_init(), we can not drop it since we require the DRM device with GEM being initialized in order to allocate DSI DMA buffer. We can think about moving DMA buffer allocation towards the usage point, however this is definitely a separate commit. [skipped] *msm_dsi_manager_ext_bridge_init(u8 id) ret = drm_bridge_attach(encoder, ext_bridge, int_bridge, DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (ret == -EINVAL) { - struct drm_connector *connector; - struct list_head *connector_list; - - /* link the internal dsi bridge to the external bridge */ - drm_bridge_attach(encoder, ext_bridge, int_bridge, 0); - /* - * we need the drm_connector created by the external bridge - * driver (or someone else) to feed it to our driver's - * priv->connector[] list, mainly for msm_fbdev_init() + * link the internal dsi bridge to the external bridge, + * connector is created by the next bridge. */ - connector_list = >mode_config.connector_list; + ret = drm_bridge_attach(encoder, ext_bridge, int_bridge, 0); + if (ret < 0) + return ret; + } else { + struct drm_connector *connector; - list_for_each_entry(connector, connector_list, head) { - if (drm_connector_has_possible_encoder(connector, encoder)) - return connector; + /* We are in charge of the connector, create one now. */ + connector = drm_bridge_connector_init(dev, encoder); + if (IS_ERR(connector)) { + DRM_ERROR("Unable to create bridge connector\n"); + return PTR_ERR(connector);
Re: [Freedreno] [PATCH v2.5] drm/msm/dsi: switch to DRM_PANEL_BRIDGE
On 7/12/2022 6:22 AM, Dmitry Baryshkov wrote: Currently the DSI driver has two separate paths: one if the next device in a chain is a bridge and another one if the panel is connected directly to the DSI host. Simplify the code path by using panel-bridge driver (already selected in Kconfig) and dropping support for handling the panel directly. Signed-off-by: Dmitry Baryshkov --- I'm not sending this as a separate patchset (I'd like to sort out mdp5 first), but more of a preview of changes related to msm_dsi_manager_ext_bridge_init(). --- drivers/gpu/drm/msm/dsi/dsi.c | 35 +--- drivers/gpu/drm/msm/dsi/dsi.h | 16 +- drivers/gpu/drm/msm/dsi/dsi_host.c| 25 --- drivers/gpu/drm/msm/dsi/dsi_manager.c | 283 +++--- 4 files changed, 36 insertions(+), 323 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index 1625328fa430..4edb9167e600 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -6,14 +6,6 @@ #include "dsi.h" #include "dsi_cfg.h" -struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi) -{ - if (!msm_dsi || !msm_dsi_device_connected(msm_dsi)) - return NULL; - - return msm_dsi->encoder; -} - bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi) { unsigned long host_flags = msm_dsi_host_get_mode_flags(msm_dsi->host); @@ -220,7 +212,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, struct drm_encoder *encoder) { struct msm_drm_private *priv; - struct drm_bridge *ext_bridge; int ret; if (WARN_ON(!encoder) || WARN_ON(!msm_dsi) || WARN_ON(!dev)) @@ -254,26 +245,10 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, goto fail; } - /* -* check if the dsi encoder output is connected to a panel or an -* external bridge. We create a connector only if we're connected to a -* drm_panel device. When we're connected to an external bridge, we -* assume that the drm_bridge driver will create the connector itself. -*/ - ext_bridge = msm_dsi_host_get_bridge(msm_dsi->host); - - if (ext_bridge) - msm_dsi->connector = - msm_dsi_manager_ext_bridge_init(msm_dsi->id); - else - msm_dsi->connector = - msm_dsi_manager_connector_init(msm_dsi->id); - - if (IS_ERR(msm_dsi->connector)) { - ret = PTR_ERR(msm_dsi->connector); + ret = msm_dsi_manager_ext_bridge_init(msm_dsi->id); + if (ret) { DRM_DEV_ERROR(dev->dev, "failed to create dsi connector: %d\n", ret); - msm_dsi->connector = NULL; goto fail; } @@ -287,12 +262,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, msm_dsi->bridge = NULL; } - /* don't destroy connector if we didn't make it */ - if (msm_dsi->connector && !msm_dsi->external_bridge) - msm_dsi->connector->funcs->destroy(msm_dsi->connector); - - msm_dsi->connector = NULL; From what i can see all the usages of msm_dsi->connector are removed after this change. So can we drop that? - return ret; } diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h index 580a1e6358bf..703e4c88d7fb 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.h +++ b/drivers/gpu/drm/msm/dsi/dsi.h @@ -12,7 +12,6 @@ #include #include #include -#include #include "msm_drv.h" #include "disp/msm_disp_snapshot.h" @@ -49,8 +48,6 @@ struct msm_dsi { struct drm_device *dev; struct platform_device *pdev; - /* connector managed by us when we're connected to a drm_panel */ - struct drm_connector *connector; /* internal dsi bridge attached to MDP interface */ struct drm_bridge *bridge; @@ -58,10 +55,8 @@ struct msm_dsi { struct msm_dsi_phy *phy; /* -* panel/external_bridge connected to dsi bridge output, only one of the -* two can be valid at a time +* external_bridge connected to dsi bridge output */ - struct drm_panel *panel; struct drm_bridge *external_bridge; struct device *phy_dev; @@ -76,8 +71,7 @@ struct msm_dsi { /* dsi manager */ struct drm_bridge *msm_dsi_manager_bridge_init(u8 id); void msm_dsi_manager_bridge_destroy(struct drm_bridge *bridge); -struct drm_connector *msm_dsi_manager_connector_init(u8 id); -struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id); +int msm_dsi_manager_ext_bridge_init(u8 id); int msm_dsi_manager_cmd_xfer(int id, const struct mipi_dsi_msg *msg); bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len); int msm_dsi_manager_register(struct msm_dsi *msm_dsi); @@ -87,11 +81,9 @@ void
[PATCH v2.5] drm/msm/dsi: switch to DRM_PANEL_BRIDGE
Currently the DSI driver has two separate paths: one if the next device in a chain is a bridge and another one if the panel is connected directly to the DSI host. Simplify the code path by using panel-bridge driver (already selected in Kconfig) and dropping support for handling the panel directly. Signed-off-by: Dmitry Baryshkov --- I'm not sending this as a separate patchset (I'd like to sort out mdp5 first), but more of a preview of changes related to msm_dsi_manager_ext_bridge_init(). --- drivers/gpu/drm/msm/dsi/dsi.c | 35 +--- drivers/gpu/drm/msm/dsi/dsi.h | 16 +- drivers/gpu/drm/msm/dsi/dsi_host.c| 25 --- drivers/gpu/drm/msm/dsi/dsi_manager.c | 283 +++--- 4 files changed, 36 insertions(+), 323 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index 1625328fa430..4edb9167e600 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -6,14 +6,6 @@ #include "dsi.h" #include "dsi_cfg.h" -struct drm_encoder *msm_dsi_get_encoder(struct msm_dsi *msm_dsi) -{ - if (!msm_dsi || !msm_dsi_device_connected(msm_dsi)) - return NULL; - - return msm_dsi->encoder; -} - bool msm_dsi_is_cmd_mode(struct msm_dsi *msm_dsi) { unsigned long host_flags = msm_dsi_host_get_mode_flags(msm_dsi->host); @@ -220,7 +212,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, struct drm_encoder *encoder) { struct msm_drm_private *priv; - struct drm_bridge *ext_bridge; int ret; if (WARN_ON(!encoder) || WARN_ON(!msm_dsi) || WARN_ON(!dev)) @@ -254,26 +245,10 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, goto fail; } - /* -* check if the dsi encoder output is connected to a panel or an -* external bridge. We create a connector only if we're connected to a -* drm_panel device. When we're connected to an external bridge, we -* assume that the drm_bridge driver will create the connector itself. -*/ - ext_bridge = msm_dsi_host_get_bridge(msm_dsi->host); - - if (ext_bridge) - msm_dsi->connector = - msm_dsi_manager_ext_bridge_init(msm_dsi->id); - else - msm_dsi->connector = - msm_dsi_manager_connector_init(msm_dsi->id); - - if (IS_ERR(msm_dsi->connector)) { - ret = PTR_ERR(msm_dsi->connector); + ret = msm_dsi_manager_ext_bridge_init(msm_dsi->id); + if (ret) { DRM_DEV_ERROR(dev->dev, "failed to create dsi connector: %d\n", ret); - msm_dsi->connector = NULL; goto fail; } @@ -287,12 +262,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, msm_dsi->bridge = NULL; } - /* don't destroy connector if we didn't make it */ - if (msm_dsi->connector && !msm_dsi->external_bridge) - msm_dsi->connector->funcs->destroy(msm_dsi->connector); - - msm_dsi->connector = NULL; - return ret; } diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h index 580a1e6358bf..703e4c88d7fb 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.h +++ b/drivers/gpu/drm/msm/dsi/dsi.h @@ -12,7 +12,6 @@ #include #include #include -#include #include "msm_drv.h" #include "disp/msm_disp_snapshot.h" @@ -49,8 +48,6 @@ struct msm_dsi { struct drm_device *dev; struct platform_device *pdev; - /* connector managed by us when we're connected to a drm_panel */ - struct drm_connector *connector; /* internal dsi bridge attached to MDP interface */ struct drm_bridge *bridge; @@ -58,10 +55,8 @@ struct msm_dsi { struct msm_dsi_phy *phy; /* -* panel/external_bridge connected to dsi bridge output, only one of the -* two can be valid at a time +* external_bridge connected to dsi bridge output */ - struct drm_panel *panel; struct drm_bridge *external_bridge; struct device *phy_dev; @@ -76,8 +71,7 @@ struct msm_dsi { /* dsi manager */ struct drm_bridge *msm_dsi_manager_bridge_init(u8 id); void msm_dsi_manager_bridge_destroy(struct drm_bridge *bridge); -struct drm_connector *msm_dsi_manager_connector_init(u8 id); -struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id); +int msm_dsi_manager_ext_bridge_init(u8 id); int msm_dsi_manager_cmd_xfer(int id, const struct mipi_dsi_msg *msg); bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len); int msm_dsi_manager_register(struct msm_dsi *msm_dsi); @@ -87,11 +81,9 @@ void msm_dsi_manager_tpg_enable(void); /* msm dsi */ static inline bool msm_dsi_device_connected(struct msm_dsi *msm_dsi) { - return msm_dsi->panel || msm_dsi->external_bridge; + return