Re: [PATCH RESEND] xfree86: prune duplicate monitor modes.

2016-01-27 Thread Eric Anholt
Michel Dänzer  writes:

> From: Leo Liu 
>
> same monitor modes added causing memory leak
> when looping `xrandr --prop'.
>
> Signed-off-by: Leo Liu 
> Signed-off-by: Michel Dänzer 
> ---
>
> More than two years later... Can somebody pick this up?
>
>  hw/xfree86/modes/xf86EdidModes.c |   22 ++
>  1 file changed, 22 insertions(+)
>
> diff --git a/hw/xfree86/modes/xf86EdidModes.c
> b/hw/xfree86/modes/xf86EdidModes.c
> index 4ee862d..261780b 100644
> --- a/hw/xfree86/modes/xf86EdidModes.c
> +++ b/hw/xfree86/modes/xf86EdidModes.c
> @@ -1143,6 +1143,27 @@ handle_detailed_monset(struct
> detailed_monitor_section *det_mon, void *data)
>  }
>  }
>  +static void
> +xf86PruneDuplicateMonitorModes(MonPtr Monitor)
> +{
> +DisplayModePtr master, clone, next;
> +
> +for (master = Monitor->Modes;
> + master && master != Monitor->Last;
> + master = master->next) {
> +for (clone = master->next;
> + clone && clone != Monitor->Modes;
> + clone = next) {
> +next = clone->next;
> +if (xf86ModesEqual (master, clone)) {
> +if (Monitor->Last == clone)
> +Monitor->Last = clone->prev;
> +xf86DeleteMode (>Modes, clone);
> +}
> +}
> +}
> +}
> +
>  /*
>   * Fill out MonPtr with xf86MonPtr information.
>   */
> @@ -1204,5 +1225,6 @@ xf86EdidMonitorSet(int scrnIndex, MonPtr Monitor,
> xf86MonPtr DDC)
>  Monitor->Modes = Modes;
>  Monitor->Last = Mode;
>  }
> +xf86PruneDuplicateMonitorModes(Monitor);
>  }
>  }

It looks like xf86EdidMonitorSet() is just appending the new DDC modes
to the monitor.  If you switch monitors, I think you get the DDC modes
From both.  Shouldn't we just be deleting the old M_T_DRIVER modes right
before appending?


signature.asc
Description: PGP signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH RESEND] xfree86: prune duplicate monitor modes.

2015-12-10 Thread Michel Dänzer
From: Leo Liu 

same monitor modes added causing memory leak
when looping `xrandr --prop'.

Signed-off-by: Leo Liu 
Signed-off-by: Michel Dänzer 
---

More than two years later... Can somebody pick this up?

 hw/xfree86/modes/xf86EdidModes.c |   22 ++
 1 file changed, 22 insertions(+)

diff --git a/hw/xfree86/modes/xf86EdidModes.c
b/hw/xfree86/modes/xf86EdidModes.c
index 4ee862d..261780b 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -1143,6 +1143,27 @@ handle_detailed_monset(struct
detailed_monitor_section *det_mon, void *data)
 }
 }
 +static void
+xf86PruneDuplicateMonitorModes(MonPtr Monitor)
+{
+DisplayModePtr master, clone, next;
+
+for (master = Monitor->Modes;
+ master && master != Monitor->Last;
+ master = master->next) {
+for (clone = master->next;
+ clone && clone != Monitor->Modes;
+ clone = next) {
+next = clone->next;
+if (xf86ModesEqual (master, clone)) {
+if (Monitor->Last == clone)
+Monitor->Last = clone->prev;
+xf86DeleteMode (>Modes, clone);
+}
+}
+}
+}
+
 /*
  * Fill out MonPtr with xf86MonPtr information.
  */
@@ -1204,5 +1225,6 @@ xf86EdidMonitorSet(int scrnIndex, MonPtr Monitor,
xf86MonPtr DDC)
 Monitor->Modes = Modes;
 Monitor->Last = Mode;
 }
+xf86PruneDuplicateMonitorModes(Monitor);
 }
 }
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH RESEND] xfree86: prune duplicate monitor modes.

2013-08-07 Thread Michel Dänzer
From: Leo Liu leo@amd.com

same monitor modes added causing memory leak
when looping `xrandr --prop'.

Signed-off-by: Leo Liu leo@amd.com
Signed-off-by: Michel Dänzer michel.daen...@amd.com
---
 hw/xfree86/modes/xf86EdidModes.c |   22 ++
 1 file changed, 22 insertions(+)

diff --git a/hw/xfree86/modes/xf86EdidModes.c b/hw/xfree86/modes/xf86EdidModes.c
index 4ee862d..261780b 100644
--- a/hw/xfree86/modes/xf86EdidModes.c
+++ b/hw/xfree86/modes/xf86EdidModes.c
@@ -1143,6 +1143,27 @@ handle_detailed_monset(struct detailed_monitor_section 
*det_mon, void *data)
 }
 }
 
+static void
+xf86PruneDuplicateMonitorModes(MonPtr Monitor)
+{
+DisplayModePtr master, clone, next;
+
+for (master = Monitor-Modes;
+ master  master != Monitor-Last;
+ master = master-next) {
+for (clone = master-next;
+ clone  clone != Monitor-Modes;
+ clone = next) {
+next = clone-next;
+if (xf86ModesEqual (master, clone)) {
+if (Monitor-Last == clone)
+Monitor-Last = clone-prev;
+xf86DeleteMode (Monitor-Modes, clone);
+}
+}
+}
+}
+
 /*
  * Fill out MonPtr with xf86MonPtr information.
  */
@@ -1204,5 +1225,6 @@ xf86EdidMonitorSet(int scrnIndex, MonPtr Monitor, 
xf86MonPtr DDC)
 Monitor-Modes = Modes;
 Monitor-Last = Mode;
 }
+xf86PruneDuplicateMonitorModes(Monitor);
 }
 }
-- 
1.7.9.5

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel