Re: [PATCH v2 1/2] drm/bridge-connector: reset the HDMI connector state

2024-07-01 Thread Maxime Ripard
On Tue, Jun 25, 2024 at 07:38:22PM GMT, Dmitry Baryshkov wrote:
> On Tue, Jun 25, 2024 at 05:49:54PM GMT, Maxime Ripard wrote:
> > On Tue, Jun 25, 2024 at 06:05:33PM GMT, Dmitry Baryshkov wrote:
> > > On Tue, 25 Jun 2024 at 18:02, Maxime Ripard  wrote:
> > > >
> > > > Hi,
> > > >
> > > > On Sun, Jun 23, 2024 at 08:40:12AM GMT, Dmitry Baryshkov wrote:
> > > > > On HDMI connectors which use drm_bridge_connector and 
> > > > > DRM_BRIDGE_OP_HDMI
> > > > > IGT chokes on the max_bpc property in several kms_properties tests due
> > > > > to the the drm_bridge_connector failing to reset HDMI-related
> > > > > properties.
> > > > >
> > > > > Call __drm_atomic_helper_connector_hdmi_reset() if there is a
> > > > > the drm_bridge_connector has bridge_hdmi.
> > > > >
> > > > > Note, the __drm_atomic_helper_connector_hdmi_reset() is moved to
> > > > > drm_atomic_state_helper.c because drm_bridge_connector.c can not 
> > > > > depend
> > > > > on DRM_DISPLAY_HDMI_STATE_HELPER. At the same time it is impossible to
> > > > > call this function from HDMI bridges, there is is no function that
> > > > > corresponds to the drm_connector_funcs::reset().
> > > >
> > > > Why can't it depend on DRM_DISPLAY_HDMI_STATE_HELPER?
> > > 
> > > Is it okay to have DRM_KMS_HELPER to depend unconditionally or select
> > > DRM_DISPLAY_HDMI_STATE_HELPER?
> > 
> > No, but it's not clear to me why drm_bridge_connector is part of
> > DRM_KMS_HELPER? It doesn't seem to be called from the core but only
> > drivers, just like DRM_PANEL_BRIDGE which has a separate config option
> 
> But then DRM_PANEL_BRIDGE is also linked into drm_kms_helper.ko.

And we don't seem to have any reason for that, it could be a separate
module afaik.

> I can't really say that I understand the definition of various helper
> modules, but my taste tells me that code from drm/*.c should not
> depend directly on the code from drm/display/*.c.

Sure, but the bridge connector could be under bridge just as well, or
part of the display helpers.

It's really a "leaf" driver as far as helpers are concerned.

Maxime


signature.asc
Description: PGP signature


Re: [PATCH v2 1/2] drm/bridge-connector: reset the HDMI connector state

2024-06-25 Thread Dmitry Baryshkov
On Tue, Jun 25, 2024 at 05:49:54PM GMT, Maxime Ripard wrote:
> On Tue, Jun 25, 2024 at 06:05:33PM GMT, Dmitry Baryshkov wrote:
> > On Tue, 25 Jun 2024 at 18:02, Maxime Ripard  wrote:
> > >
> > > Hi,
> > >
> > > On Sun, Jun 23, 2024 at 08:40:12AM GMT, Dmitry Baryshkov wrote:
> > > > On HDMI connectors which use drm_bridge_connector and DRM_BRIDGE_OP_HDMI
> > > > IGT chokes on the max_bpc property in several kms_properties tests due
> > > > to the the drm_bridge_connector failing to reset HDMI-related
> > > > properties.
> > > >
> > > > Call __drm_atomic_helper_connector_hdmi_reset() if there is a
> > > > the drm_bridge_connector has bridge_hdmi.
> > > >
> > > > Note, the __drm_atomic_helper_connector_hdmi_reset() is moved to
> > > > drm_atomic_state_helper.c because drm_bridge_connector.c can not depend
> > > > on DRM_DISPLAY_HDMI_STATE_HELPER. At the same time it is impossible to
> > > > call this function from HDMI bridges, there is is no function that
> > > > corresponds to the drm_connector_funcs::reset().
> > >
> > > Why can't it depend on DRM_DISPLAY_HDMI_STATE_HELPER?
> > 
> > Is it okay to have DRM_KMS_HELPER to depend unconditionally or select
> > DRM_DISPLAY_HDMI_STATE_HELPER?
> 
> No, but it's not clear to me why drm_bridge_connector is part of
> DRM_KMS_HELPER? It doesn't seem to be called from the core but only
> drivers, just like DRM_PANEL_BRIDGE which has a separate config option

But then DRM_PANEL_BRIDGE is also linked into drm_kms_helper.ko. I can't
really say that I understand the definition of various helper modules,
but my taste tells me that code from drm/*.c should not depend directly
on the code from drm/display/*.c.

-- 
With best wishes
Dmitry


Re: [PATCH v2 1/2] drm/bridge-connector: reset the HDMI connector state

2024-06-25 Thread Maxime Ripard
On Tue, Jun 25, 2024 at 06:05:33PM GMT, Dmitry Baryshkov wrote:
> On Tue, 25 Jun 2024 at 18:02, Maxime Ripard  wrote:
> >
> > Hi,
> >
> > On Sun, Jun 23, 2024 at 08:40:12AM GMT, Dmitry Baryshkov wrote:
> > > On HDMI connectors which use drm_bridge_connector and DRM_BRIDGE_OP_HDMI
> > > IGT chokes on the max_bpc property in several kms_properties tests due
> > > to the the drm_bridge_connector failing to reset HDMI-related
> > > properties.
> > >
> > > Call __drm_atomic_helper_connector_hdmi_reset() if there is a
> > > the drm_bridge_connector has bridge_hdmi.
> > >
> > > Note, the __drm_atomic_helper_connector_hdmi_reset() is moved to
> > > drm_atomic_state_helper.c because drm_bridge_connector.c can not depend
> > > on DRM_DISPLAY_HDMI_STATE_HELPER. At the same time it is impossible to
> > > call this function from HDMI bridges, there is is no function that
> > > corresponds to the drm_connector_funcs::reset().
> >
> > Why can't it depend on DRM_DISPLAY_HDMI_STATE_HELPER?
> 
> Is it okay to have DRM_KMS_HELPER to depend unconditionally or select
> DRM_DISPLAY_HDMI_STATE_HELPER?

No, but it's not clear to me why drm_bridge_connector is part of
DRM_KMS_HELPER? It doesn't seem to be called from the core but only
drivers, just like DRM_PANEL_BRIDGE which has a separate config option

Maxime


signature.asc
Description: PGP signature


Re: [PATCH v2 1/2] drm/bridge-connector: reset the HDMI connector state

2024-06-25 Thread Dmitry Baryshkov
On Tue, 25 Jun 2024 at 18:02, Maxime Ripard  wrote:
>
> Hi,
>
> On Sun, Jun 23, 2024 at 08:40:12AM GMT, Dmitry Baryshkov wrote:
> > On HDMI connectors which use drm_bridge_connector and DRM_BRIDGE_OP_HDMI
> > IGT chokes on the max_bpc property in several kms_properties tests due
> > to the the drm_bridge_connector failing to reset HDMI-related
> > properties.
> >
> > Call __drm_atomic_helper_connector_hdmi_reset() if there is a
> > the drm_bridge_connector has bridge_hdmi.
> >
> > Note, the __drm_atomic_helper_connector_hdmi_reset() is moved to
> > drm_atomic_state_helper.c because drm_bridge_connector.c can not depend
> > on DRM_DISPLAY_HDMI_STATE_HELPER. At the same time it is impossible to
> > call this function from HDMI bridges, there is is no function that
> > corresponds to the drm_connector_funcs::reset().
>
> Why can't it depend on DRM_DISPLAY_HDMI_STATE_HELPER?

Is it okay to have DRM_KMS_HELPER to depend unconditionally or select
DRM_DISPLAY_HDMI_STATE_HELPER?

-- 
With best wishes
Dmitry


Re: [PATCH v2 1/2] drm/bridge-connector: reset the HDMI connector state

2024-06-25 Thread Maxime Ripard
Hi,

On Sun, Jun 23, 2024 at 08:40:12AM GMT, Dmitry Baryshkov wrote:
> On HDMI connectors which use drm_bridge_connector and DRM_BRIDGE_OP_HDMI
> IGT chokes on the max_bpc property in several kms_properties tests due
> to the the drm_bridge_connector failing to reset HDMI-related
> properties.
> 
> Call __drm_atomic_helper_connector_hdmi_reset() if there is a
> the drm_bridge_connector has bridge_hdmi.
> 
> Note, the __drm_atomic_helper_connector_hdmi_reset() is moved to
> drm_atomic_state_helper.c because drm_bridge_connector.c can not depend
> on DRM_DISPLAY_HDMI_STATE_HELPER. At the same time it is impossible to
> call this function from HDMI bridges, there is is no function that
> corresponds to the drm_connector_funcs::reset().

Why can't it depend on DRM_DISPLAY_HDMI_STATE_HELPER?

Maxime


signature.asc
Description: PGP signature


Re: [PATCH v2 1/2] drm/bridge-connector: reset the HDMI connector state

2024-06-24 Thread Dmitry Baryshkov
On Tue, 25 Jun 2024 at 01:28, Abhinav Kumar  wrote:
>
>
>
> On 6/22/2024 10:40 PM, Dmitry Baryshkov wrote:
> > On HDMI connectors which use drm_bridge_connector and DRM_BRIDGE_OP_HDMI
> > IGT chokes on the max_bpc property in several kms_properties tests due
> > to the the drm_bridge_connector failing to reset HDMI-related
> > properties.
> >
> > Call __drm_atomic_helper_connector_hdmi_reset() if there is a
> > the drm_bridge_connector has bridge_hdmi.
> >
> > Note, the __drm_atomic_helper_connector_hdmi_reset() is moved to
> > drm_atomic_state_helper.c because drm_bridge_connector.c can not depend
> > on DRM_DISPLAY_HDMI_STATE_HELPER. At the same time it is impossible to
> > call this function from HDMI bridges, there is is no function that
> > corresponds to the drm_connector_funcs::reset().
> >
> > Fixes: 6b4468b0c6ba ("drm/bridge-connector: implement glue code for HDMI 
> > connector")
> > Signed-off-by: Dmitry Baryshkov 
> > ---
> >   drivers/gpu/drm/display/drm_hdmi_state_helper.c | 21 -
> >   drivers/gpu/drm/drm_atomic_state_helper.c   | 21 +
> >   drivers/gpu/drm/drm_bridge_connector.c  | 13 -
> >   include/drm/display/drm_hdmi_state_helper.h |  3 ---
> >   include/drm/drm_atomic_state_helper.h   |  2 ++
> >   5 files changed, 35 insertions(+), 25 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c 
> > b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> > index 2dab3ad8ce64..67f39857b0b4 100644
> > --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> > +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> > @@ -8,27 +8,6 @@
> >   #include 
> >   #include 
> >
> > -/**
> > - * __drm_atomic_helper_connector_hdmi_reset() - Initializes all HDMI 
> > @drm_connector_state resources
> > - * @connector: DRM connector
> > - * @new_conn_state: connector state to reset
> > - *
> > - * Initializes all HDMI resources from a @drm_connector_state without
> > - * actually allocating it. This is useful for HDMI drivers, in
> > - * combination with __drm_atomic_helper_connector_reset() or
> > - * drm_atomic_helper_connector_reset().
> > - */
> > -void __drm_atomic_helper_connector_hdmi_reset(struct drm_connector 
> > *connector,
> > -   struct drm_connector_state 
> > *new_conn_state)
> > -{
> > - unsigned int max_bpc = connector->max_bpc;
> > -
> > - new_conn_state->max_bpc = max_bpc;
> > - new_conn_state->max_requested_bpc = max_bpc;
> > - new_conn_state->hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_AUTO;
> > -}
> > -EXPORT_SYMBOL(__drm_atomic_helper_connector_hdmi_reset);
> > -
> >   static const struct drm_display_mode *
> >   connector_state_get_mode(const struct drm_connector_state *conn_state)
> >   {
> > diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c 
> > b/drivers/gpu/drm/drm_atomic_state_helper.c
> > index 519228eb1095..1518ada81b45 100644
> > --- a/drivers/gpu/drm/drm_atomic_state_helper.c
> > +++ b/drivers/gpu/drm/drm_atomic_state_helper.c
> > @@ -478,6 +478,27 @@ void drm_atomic_helper_connector_reset(struct 
> > drm_connector *connector)
> >   }
> >   EXPORT_SYMBOL(drm_atomic_helper_connector_reset);
> >
> > +/**
> > + * __drm_atomic_helper_connector_hdmi_reset() - Initializes all HDMI 
> > @drm_connector_state resources
> > + * @connector: DRM connector
> > + * @new_conn_state: connector state to reset
> > + *
> > + * Initializes all HDMI resources from a @drm_connector_state without
> > + * actually allocating it. This is useful for HDMI drivers, in
> > + * combination with __drm_atomic_helper_connector_reset() or
> > + * drm_atomic_helper_connector_reset().
> > + */
> > +void __drm_atomic_helper_connector_hdmi_reset(struct drm_connector 
> > *connector,
> > +   struct drm_connector_state 
> > *new_conn_state)
> > +{
> > + unsigned int max_bpc = connector->max_bpc;
> > +
> > + new_conn_state->max_bpc = max_bpc;
> > + new_conn_state->max_requested_bpc = max_bpc;
>
> I understand this is just code propagation but do we need a max_bpc
> local variable?
>
> We can just do
>
> new_conn_state->max_bpc = connector->max_bpc;
> new_conn_state->max_requested_bpc = connector->max_bpc;

Possible implementation, but I was really just doing code move.

>
> But apart from that nit, this LGTM.
>
> Reviewed-by: Abhinav Kumar 



-- 
With best wishes
Dmitry


Re: [PATCH v2 1/2] drm/bridge-connector: reset the HDMI connector state

2024-06-24 Thread Abhinav Kumar




On 6/22/2024 10:40 PM, Dmitry Baryshkov wrote:

On HDMI connectors which use drm_bridge_connector and DRM_BRIDGE_OP_HDMI
IGT chokes on the max_bpc property in several kms_properties tests due
to the the drm_bridge_connector failing to reset HDMI-related
properties.

Call __drm_atomic_helper_connector_hdmi_reset() if there is a
the drm_bridge_connector has bridge_hdmi.

Note, the __drm_atomic_helper_connector_hdmi_reset() is moved to
drm_atomic_state_helper.c because drm_bridge_connector.c can not depend
on DRM_DISPLAY_HDMI_STATE_HELPER. At the same time it is impossible to
call this function from HDMI bridges, there is is no function that
corresponds to the drm_connector_funcs::reset().

Fixes: 6b4468b0c6ba ("drm/bridge-connector: implement glue code for HDMI 
connector")
Signed-off-by: Dmitry Baryshkov 
---
  drivers/gpu/drm/display/drm_hdmi_state_helper.c | 21 -
  drivers/gpu/drm/drm_atomic_state_helper.c   | 21 +
  drivers/gpu/drm/drm_bridge_connector.c  | 13 -
  include/drm/display/drm_hdmi_state_helper.h |  3 ---
  include/drm/drm_atomic_state_helper.h   |  2 ++
  5 files changed, 35 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c 
b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
index 2dab3ad8ce64..67f39857b0b4 100644
--- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
+++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
@@ -8,27 +8,6 @@
  #include 
  #include 
  
-/**

- * __drm_atomic_helper_connector_hdmi_reset() - Initializes all HDMI 
@drm_connector_state resources
- * @connector: DRM connector
- * @new_conn_state: connector state to reset
- *
- * Initializes all HDMI resources from a @drm_connector_state without
- * actually allocating it. This is useful for HDMI drivers, in
- * combination with __drm_atomic_helper_connector_reset() or
- * drm_atomic_helper_connector_reset().
- */
-void __drm_atomic_helper_connector_hdmi_reset(struct drm_connector *connector,
- struct drm_connector_state 
*new_conn_state)
-{
-   unsigned int max_bpc = connector->max_bpc;
-
-   new_conn_state->max_bpc = max_bpc;
-   new_conn_state->max_requested_bpc = max_bpc;
-   new_conn_state->hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_AUTO;
-}
-EXPORT_SYMBOL(__drm_atomic_helper_connector_hdmi_reset);
-
  static const struct drm_display_mode *
  connector_state_get_mode(const struct drm_connector_state *conn_state)
  {
diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c 
b/drivers/gpu/drm/drm_atomic_state_helper.c
index 519228eb1095..1518ada81b45 100644
--- a/drivers/gpu/drm/drm_atomic_state_helper.c
+++ b/drivers/gpu/drm/drm_atomic_state_helper.c
@@ -478,6 +478,27 @@ void drm_atomic_helper_connector_reset(struct 
drm_connector *connector)
  }
  EXPORT_SYMBOL(drm_atomic_helper_connector_reset);
  
+/**

+ * __drm_atomic_helper_connector_hdmi_reset() - Initializes all HDMI 
@drm_connector_state resources
+ * @connector: DRM connector
+ * @new_conn_state: connector state to reset
+ *
+ * Initializes all HDMI resources from a @drm_connector_state without
+ * actually allocating it. This is useful for HDMI drivers, in
+ * combination with __drm_atomic_helper_connector_reset() or
+ * drm_atomic_helper_connector_reset().
+ */
+void __drm_atomic_helper_connector_hdmi_reset(struct drm_connector *connector,
+ struct drm_connector_state 
*new_conn_state)
+{
+   unsigned int max_bpc = connector->max_bpc;
+
+   new_conn_state->max_bpc = max_bpc;
+   new_conn_state->max_requested_bpc = max_bpc;


I understand this is just code propagation but do we need a max_bpc 
local variable?


We can just do

new_conn_state->max_bpc = connector->max_bpc;
new_conn_state->max_requested_bpc = connector->max_bpc;

But apart from that nit, this LGTM.

Reviewed-by: Abhinav Kumar