[Intel-gfx] [PATCH v6 3/3] drm/i915: Send hotplug event if edid had changed

2020-06-30 Thread Kunal Joshi
From: Stanislav Lisovskiy 

Added epoch counter checking to intel_encoder_hotplug
in order to be able process all the connector changes,
besides connection status. Also now any change in connector
would result in epoch counter change, so no multiple checks
are needed.

v2: Renamed change counter to epoch counter. Fixed type name.

v3: Fixed rebase conflict

v4: Remove duplicate drm_edid_equal checks from hdmi and dp,
lets use only once edid property is getting updated and
increment epoch counter from there.
Also lets now call drm_connector_update_edid_property
right after we get edid always to make sure there is a
unified way to handle edid change, without having to
change tons of source code as currently
drm_connector_update_edid_property is called only in
certain cases like reprobing and not right after edid is
actually updated.

v5: Fixed const modifiers, removed blank line

v6: Removed drm specific part from this patch, leaving only
i915 specific changes here.

Signed-off-by: Stanislav Lisovskiy 
---
 drivers/gpu/drm/i915/display/intel_hotplug.c | 24 
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c 
b/drivers/gpu/drm/i915/display/intel_hotplug.c
index 2e94c1413c02..80bcfff032e9 100644
--- a/drivers/gpu/drm/i915/display/intel_hotplug.c
+++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
@@ -283,6 +283,8 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
 {
struct drm_device *dev = connector->base.dev;
enum drm_connector_status old_status;
+   u64 old_epoch_counter;
+   bool ret = false;
 
drm_WARN_ON(dev, !mutex_is_locked(&dev->mode_config.mutex));
old_status = connector->base.status;
@@ -290,17 +292,19 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
connector->base.status =
drm_helper_probe_detect(&connector->base, NULL, false);
 
-   if (old_status == connector->base.status)
-   return INTEL_HOTPLUG_UNCHANGED;
-
-   drm_dbg_kms(&to_i915(dev)->drm,
-   "[CONNECTOR:%d:%s] status updated from %s to %s\n",
-   connector->base.base.id,
-   connector->base.name,
-   drm_get_connector_status_name(old_status),
-   drm_get_connector_status_name(connector->base.status));
+   if (old_epoch_counter != connector->base.epoch_counter)
+   ret = true;
 
-   return INTEL_HOTPLUG_CHANGED;
+   if (ret) {
+   DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to 
%s(epoch counter %llu)\n",
+ connector->base.base.id,
+ connector->base.name,
+ drm_get_connector_status_name(old_status),
+ 
drm_get_connector_status_name(connector->base.status),
+ connector->base.epoch_counter);
+   return INTEL_HOTPLUG_CHANGED;
+   }
+   return INTEL_HOTPLUG_UNCHANGED;
 }
 
 static bool intel_encoder_has_hpd_pulse(struct intel_encoder *encoder)
-- 
2.25.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v6 3/3] drm/i915: Send hotplug event if edid had changed

2020-06-26 Thread Kunal Joshi
From: Stanislav Lisovskiy 

Added epoch counter checking to intel_encoder_hotplug
in order to be able process all the connector changes,
besides connection status. Also now any change in connector
would result in epoch counter change, so no multiple checks
are needed.

v2: Renamed change counter to epoch counter. Fixed type name.

v3: Fixed rebase conflict

v4: Remove duplicate drm_edid_equal checks from hdmi and dp,
lets use only once edid property is getting updated and
increment epoch counter from there.
Also lets now call drm_connector_update_edid_property
right after we get edid always to make sure there is a
unified way to handle edid change, without having to
change tons of source code as currently
drm_connector_update_edid_property is called only in
certain cases like reprobing and not right after edid is
actually updated.

v5: Fixed const modifiers, removed blank line

v6: Removed drm specific part from this patch, leaving only
i915 specific changes here.

Signed-off-by: Stanislav Lisovskiy 
---
 drivers/gpu/drm/i915/display/intel_hotplug.c | 24 
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c 
b/drivers/gpu/drm/i915/display/intel_hotplug.c
index 2e94c1413c02..80bcfff032e9 100644
--- a/drivers/gpu/drm/i915/display/intel_hotplug.c
+++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
@@ -283,6 +283,8 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
 {
struct drm_device *dev = connector->base.dev;
enum drm_connector_status old_status;
+   u64 old_epoch_counter;
+   bool ret = false;
 
drm_WARN_ON(dev, !mutex_is_locked(&dev->mode_config.mutex));
old_status = connector->base.status;
@@ -290,17 +292,19 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
connector->base.status =
drm_helper_probe_detect(&connector->base, NULL, false);
 
-   if (old_status == connector->base.status)
-   return INTEL_HOTPLUG_UNCHANGED;
-
-   drm_dbg_kms(&to_i915(dev)->drm,
-   "[CONNECTOR:%d:%s] status updated from %s to %s\n",
-   connector->base.base.id,
-   connector->base.name,
-   drm_get_connector_status_name(old_status),
-   drm_get_connector_status_name(connector->base.status));
+   if (old_epoch_counter != connector->base.epoch_counter)
+   ret = true;
 
-   return INTEL_HOTPLUG_CHANGED;
+   if (ret) {
+   DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to 
%s(epoch counter %llu)\n",
+ connector->base.base.id,
+ connector->base.name,
+ drm_get_connector_status_name(old_status),
+ 
drm_get_connector_status_name(connector->base.status),
+ connector->base.epoch_counter);
+   return INTEL_HOTPLUG_CHANGED;
+   }
+   return INTEL_HOTPLUG_UNCHANGED;
 }
 
 static bool intel_encoder_has_hpd_pulse(struct intel_encoder *encoder)
-- 
2.25.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v6 3/3] drm/i915: Send hotplug event if edid had changed

2020-06-25 Thread Lisovskiy, Stanislav
On Thu, Jun 25, 2020 at 10:36:28AM +0200, Maarten Lankhorst wrote:
> Op 23-06-2020 om 20:57 schreef Kunal Joshi:
> > From: Stanislav Lisovskiy 
> >
> > Added epoch counter checking to intel_encoder_hotplug
> > in order to be able process all the connector changes,
> > besides connection status. Also now any change in connector
> > would result in epoch counter change, so no multiple checks
> > are needed.
> >
> > v2: Renamed change counter to epoch counter. Fixed type name.
> >
> > v3: Fixed rebase conflict
> >
> > v4: Remove duplicate drm_edid_equal checks from hdmi and dp,
> > lets use only once edid property is getting updated and
> > increment epoch counter from there.
> > Also lets now call drm_connector_update_edid_property
> > right after we get edid always to make sure there is a
> > unified way to handle edid change, without having to
> > change tons of source code as currently
> > drm_connector_update_edid_property is called only in
> > certain cases like reprobing and not right after edid is
> > actually updated.
> >
> > v5: Fixed const modifiers, removed blank line
> >
> > v6: Removed drm specific part from this patch, leaving only
> > i915 specific changes here.
> >
> > Signed-off-by: Stanislav Lisovskiy 
> > ---
> 
> Much better!
> 
> Reviewed-by: Maarten Lankhorst 
> 
> for whole series

I think it had been for year in that state already :)
At some point I was just distracted by some other things.

Stan

> 
> >  drivers/gpu/drm/i915/display/intel_hotplug.c | 26 +++-
> >  1 file changed, 15 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c 
> > b/drivers/gpu/drm/i915/display/intel_hotplug.c
> > index 2e94c1413c02..393813494523 100644
> > --- a/drivers/gpu/drm/i915/display/intel_hotplug.c
> > +++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
> > @@ -283,6 +283,8 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
> >  {
> > struct drm_device *dev = connector->base.dev;
> > enum drm_connector_status old_status;
> > +u64 old_epoch_counter;
> > +bool ret = false;
> >  
> > drm_WARN_ON(dev, !mutex_is_locked(&dev->mode_config.mutex));
> > old_status = connector->base.status;
> > @@ -290,17 +292,19 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
> > connector->base.status =
> > drm_helper_probe_detect(&connector->base, NULL, false);
> >  
> > -   if (old_status == connector->base.status)
> > -   return INTEL_HOTPLUG_UNCHANGED;
> > -
> > -   drm_dbg_kms(&to_i915(dev)->drm,
> > -   "[CONNECTOR:%d:%s] status updated from %s to %s\n",
> > -   connector->base.base.id,
> > -   connector->base.name,
> > -   drm_get_connector_status_name(old_status),
> > -   drm_get_connector_status_name(connector->base.status));
> > -
> > -   return INTEL_HOTPLUG_CHANGED;
> > +if (old_epoch_counter != connector->base.epoch_counter)
> > +ret = true;
> > +
> > +if(ret) {
> > +   DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to 
> > %s(epoch counter %llu)\n",
> > + connector->base.base.id,
> > + connector->base.name,
> > + drm_get_connector_status_name(old_status),
> > + 
> > drm_get_connector_status_name(connector->base.status),
> > + connector->base.epoch_counter);
> > +   return INTEL_HOTPLUG_CHANGED;
> > +}
> > +return INTEL_HOTPLUG_UNCHANGED;
> >  }
> >  
> >  static bool intel_encoder_has_hpd_pulse(struct intel_encoder *encoder)
> 
> 
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v6 3/3] drm/i915: Send hotplug event if edid had changed

2020-06-25 Thread Maarten Lankhorst
Op 23-06-2020 om 20:57 schreef Kunal Joshi:
> From: Stanislav Lisovskiy 
>
> Added epoch counter checking to intel_encoder_hotplug
> in order to be able process all the connector changes,
> besides connection status. Also now any change in connector
> would result in epoch counter change, so no multiple checks
> are needed.
>
> v2: Renamed change counter to epoch counter. Fixed type name.
>
> v3: Fixed rebase conflict
>
> v4: Remove duplicate drm_edid_equal checks from hdmi and dp,
> lets use only once edid property is getting updated and
> increment epoch counter from there.
> Also lets now call drm_connector_update_edid_property
> right after we get edid always to make sure there is a
> unified way to handle edid change, without having to
> change tons of source code as currently
> drm_connector_update_edid_property is called only in
> certain cases like reprobing and not right after edid is
> actually updated.
>
> v5: Fixed const modifiers, removed blank line
>
> v6: Removed drm specific part from this patch, leaving only
> i915 specific changes here.
>
> Signed-off-by: Stanislav Lisovskiy 
> ---

Much better!

Reviewed-by: Maarten Lankhorst 

for whole series

>  drivers/gpu/drm/i915/display/intel_hotplug.c | 26 +++-
>  1 file changed, 15 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c 
> b/drivers/gpu/drm/i915/display/intel_hotplug.c
> index 2e94c1413c02..393813494523 100644
> --- a/drivers/gpu/drm/i915/display/intel_hotplug.c
> +++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
> @@ -283,6 +283,8 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
>  {
>   struct drm_device *dev = connector->base.dev;
>   enum drm_connector_status old_status;
> +u64 old_epoch_counter;
> +bool ret = false;
>  
>   drm_WARN_ON(dev, !mutex_is_locked(&dev->mode_config.mutex));
>   old_status = connector->base.status;
> @@ -290,17 +292,19 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
>   connector->base.status =
>   drm_helper_probe_detect(&connector->base, NULL, false);
>  
> - if (old_status == connector->base.status)
> - return INTEL_HOTPLUG_UNCHANGED;
> -
> - drm_dbg_kms(&to_i915(dev)->drm,
> - "[CONNECTOR:%d:%s] status updated from %s to %s\n",
> - connector->base.base.id,
> - connector->base.name,
> - drm_get_connector_status_name(old_status),
> - drm_get_connector_status_name(connector->base.status));
> -
> - return INTEL_HOTPLUG_CHANGED;
> +if (old_epoch_counter != connector->base.epoch_counter)
> +ret = true;
> +
> +if(ret) {
> + DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to 
> %s(epoch counter %llu)\n",
> +   connector->base.base.id,
> +   connector->base.name,
> +   drm_get_connector_status_name(old_status),
> +   
> drm_get_connector_status_name(connector->base.status),
> +   connector->base.epoch_counter);
> + return INTEL_HOTPLUG_CHANGED;
> +}
> +return INTEL_HOTPLUG_UNCHANGED;
>  }
>  
>  static bool intel_encoder_has_hpd_pulse(struct intel_encoder *encoder)


___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v6 3/3] drm/i915: Send hotplug event if edid had changed

2020-06-23 Thread Kunal Joshi
From: Stanislav Lisovskiy 

Added epoch counter checking to intel_encoder_hotplug
in order to be able process all the connector changes,
besides connection status. Also now any change in connector
would result in epoch counter change, so no multiple checks
are needed.

v2: Renamed change counter to epoch counter. Fixed type name.

v3: Fixed rebase conflict

v4: Remove duplicate drm_edid_equal checks from hdmi and dp,
lets use only once edid property is getting updated and
increment epoch counter from there.
Also lets now call drm_connector_update_edid_property
right after we get edid always to make sure there is a
unified way to handle edid change, without having to
change tons of source code as currently
drm_connector_update_edid_property is called only in
certain cases like reprobing and not right after edid is
actually updated.

v5: Fixed const modifiers, removed blank line

v6: Removed drm specific part from this patch, leaving only
i915 specific changes here.

Signed-off-by: Stanislav Lisovskiy 
---
 drivers/gpu/drm/i915/display/intel_hotplug.c | 26 +++-
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c 
b/drivers/gpu/drm/i915/display/intel_hotplug.c
index 2e94c1413c02..393813494523 100644
--- a/drivers/gpu/drm/i915/display/intel_hotplug.c
+++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
@@ -283,6 +283,8 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
 {
struct drm_device *dev = connector->base.dev;
enum drm_connector_status old_status;
+u64 old_epoch_counter;
+bool ret = false;
 
drm_WARN_ON(dev, !mutex_is_locked(&dev->mode_config.mutex));
old_status = connector->base.status;
@@ -290,17 +292,19 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
connector->base.status =
drm_helper_probe_detect(&connector->base, NULL, false);
 
-   if (old_status == connector->base.status)
-   return INTEL_HOTPLUG_UNCHANGED;
-
-   drm_dbg_kms(&to_i915(dev)->drm,
-   "[CONNECTOR:%d:%s] status updated from %s to %s\n",
-   connector->base.base.id,
-   connector->base.name,
-   drm_get_connector_status_name(old_status),
-   drm_get_connector_status_name(connector->base.status));
-
-   return INTEL_HOTPLUG_CHANGED;
+if (old_epoch_counter != connector->base.epoch_counter)
+ret = true;
+
+if(ret) {
+   DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to 
%s(epoch counter %llu)\n",
+ connector->base.base.id,
+ connector->base.name,
+ drm_get_connector_status_name(old_status),
+ 
drm_get_connector_status_name(connector->base.status),
+ connector->base.epoch_counter);
+   return INTEL_HOTPLUG_CHANGED;
+}
+return INTEL_HOTPLUG_UNCHANGED;
 }
 
 static bool intel_encoder_has_hpd_pulse(struct intel_encoder *encoder)
-- 
2.25.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v6 3/3] drm/i915: Send hotplug event if edid had changed

2019-09-06 Thread Stanislav Lisovskiy
Added epoch counter checking to intel_encoder_hotplug
in order to be able process all the connector changes,
besides connection status. Also now any change in connector
would result in epoch counter change, so no multiple checks
are needed.

v2: Renamed change counter to epoch counter. Fixed type name.

v3: Fixed rebase conflict

v4: Remove duplicate drm_edid_equal checks from hdmi and dp,
lets use only once edid property is getting updated and
increment epoch counter from there.
Also lets now call drm_connector_update_edid_property
right after we get edid always to make sure there is a
unified way to handle edid change, without having to
change tons of source code as currently
drm_connector_update_edid_property is called only in
certain cases like reprobing and not right after edid is
actually updated.

v5: Fixed const modifiers, removed blank line

v6: Removed drm specific part from this patch, leaving only
i915 specific changes here.

Signed-off-by: Stanislav Lisovskiy 
---
 drivers/gpu/drm/i915/display/intel_hotplug.c | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c 
b/drivers/gpu/drm/i915/display/intel_hotplug.c
index fc29046d48ea..1e3e425dd78d 100644
--- a/drivers/gpu/drm/i915/display/intel_hotplug.c
+++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
@@ -280,23 +280,31 @@ intel_encoder_hotplug(struct intel_encoder *encoder,
 {
struct drm_device *dev = connector->base.dev;
enum drm_connector_status old_status;
+   u64 old_epoch_counter;
+   bool ret = false;
 
WARN_ON(!mutex_is_locked(&dev->mode_config.mutex));
old_status = connector->base.status;
 
+   old_epoch_counter = connector->base.epoch_counter;
+
connector->base.status =
drm_helper_probe_detect(&connector->base, NULL, false);
 
-   if (old_status == connector->base.status)
-   return INTEL_HOTPLUG_UNCHANGED;
+   if (old_epoch_counter != connector->base.epoch_counter)
+   ret = true;
 
-   DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to %s\n",
+   if (ret) {
+   DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %s to 
%s(epoch counter %llu)\n",
  connector->base.base.id,
  connector->base.name,
  drm_get_connector_status_name(old_status),
- drm_get_connector_status_name(connector->base.status));
+ drm_get_connector_status_name(connector->base.status),
+ connector->base.epoch_counter);
+   return INTEL_HOTPLUG_CHANGED;
+   }
 
-   return INTEL_HOTPLUG_CHANGED;
+   return INTEL_HOTPLUG_UNCHANGED;
 }
 
 static bool intel_encoder_has_hpd_pulse(struct intel_encoder *encoder)
-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx