Re: [PATCH v2 3/3] xwayland: Destroy xwl_output when wl_output gets removed

2015-07-15 Thread Marek Chalupa
Hmm, it looks like there's new bug with this patch. I remember it worked 
pretty well before, but now it is not true anymore. Sometimes, after 
destroying the output with xterm opened on the other output, the xterm 
stops reacting on button press event. With xterm opened on both outputs, 
this does not happen. And sometimes weston crashes, but it is probably 
different (weston's) bug.


Looks like caused by call to RRCrtcDestroy in xwl_output_destroy, any 
idea why? I don't know much about X's internals...


On 07/15/2015 11:21 AM, Marek Chalupa wrote:



On 05/16/2015 07:38 AM, Dima Ryazanov wrote:

This makes Xwayland correctly handle a monitor getting unplugged.

Signed-off-by: Dima Ryazanov 
---
  hw/xwayland/xwayland-output.c |  1 +
  hw/xwayland/xwayland.c| 10 +-
  hw/xwayland/xwayland.h|  1 +
  3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/hw/xwayland/xwayland-output.c
b/hw/xwayland/xwayland-output.c
index 41937b8..9ef8a48 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -163,6 +163,7 @@ xwl_output_create(struct xwl_screen *xwl_screen,
uint32_t id)

  xwl_output->output = wl_registry_bind(xwl_screen->registry, id,
&wl_output_interface, 2);
+xwl_output->server_output_id = id;
  wl_output_add_listener(xwl_output->output, &output_listener,
xwl_output);

  snprintf(name, sizeof name, "XWAYLAND%d", serial++);
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 7e8d667..7c2eaed 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -410,7 +410,15 @@ registry_global(void *data, struct wl_registry
*registry, uint32_t id,
  static void
  global_remove(void *data, struct wl_registry *registry, uint32_t name)
  {
-/* Nothing to do here, wl_compositor and wl_shm should not be
removed */
+struct xwl_screen *xwl_screen = data;
+struct xwl_output *xwl_output;
+
+xorg_list_for_each_entry(xwl_output, &xwl_screen->output_list,
link) {
+if (xwl_output->server_output_id == name) {
+xwl_output_destroy(xwl_output);
+break;
+}
+}
  }

  static const struct wl_registry_listener registry_listener = {
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index cfb343d..70875e7 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -130,6 +130,7 @@ struct xwl_seat {
  struct xwl_output {
  struct xorg_list link;
  struct wl_output *output;
+uint32_t server_output_id;
  struct xwl_screen *xwl_screen;
  RROutputPtr randr_output;
  RRCrtcPtr randr_crtc;



As I wrote before, I'm not in favor of patch 1 in this series. However,
this patch needs patch 1 to work properly, so I'm in for using the
version 1 of patch 1
(http://lists.freedesktop.org/archives/wayland-devel/2015-May/021909.html)

With above mentioned this series is:

Reviewed-by: Marek Chalupa 

Regards,
Marek

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH v2 3/3] xwayland: Destroy xwl_output when wl_output gets removed

2015-07-15 Thread Marek Chalupa



On 05/16/2015 07:38 AM, Dima Ryazanov wrote:

This makes Xwayland correctly handle a monitor getting unplugged.

Signed-off-by: Dima Ryazanov 
---
  hw/xwayland/xwayland-output.c |  1 +
  hw/xwayland/xwayland.c| 10 +-
  hw/xwayland/xwayland.h|  1 +
  3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 41937b8..9ef8a48 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -163,6 +163,7 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t 
id)

  xwl_output->output = wl_registry_bind(xwl_screen->registry, id,
&wl_output_interface, 2);
+xwl_output->server_output_id = id;
  wl_output_add_listener(xwl_output->output, &output_listener, xwl_output);

  snprintf(name, sizeof name, "XWAYLAND%d", serial++);
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 7e8d667..7c2eaed 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -410,7 +410,15 @@ registry_global(void *data, struct wl_registry *registry, 
uint32_t id,
  static void
  global_remove(void *data, struct wl_registry *registry, uint32_t name)
  {
-/* Nothing to do here, wl_compositor and wl_shm should not be removed */
+struct xwl_screen *xwl_screen = data;
+struct xwl_output *xwl_output;
+
+xorg_list_for_each_entry(xwl_output, &xwl_screen->output_list, link) {
+if (xwl_output->server_output_id == name) {
+xwl_output_destroy(xwl_output);
+break;
+}
+}
  }

  static const struct wl_registry_listener registry_listener = {
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index cfb343d..70875e7 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -130,6 +130,7 @@ struct xwl_seat {
  struct xwl_output {
  struct xorg_list link;
  struct wl_output *output;
+uint32_t server_output_id;
  struct xwl_screen *xwl_screen;
  RROutputPtr randr_output;
  RRCrtcPtr randr_crtc;



As I wrote before, I'm not in favor of patch 1 in this series. However, 
this patch needs patch 1 to work properly, so I'm in for using the 
version 1 of patch 1 
(http://lists.freedesktop.org/archives/wayland-devel/2015-May/021909.html)


With above mentioned this series is:

Reviewed-by: Marek Chalupa 

Regards,
Marek
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH v2 3/3] xwayland: Destroy xwl_output when wl_output gets removed

2015-05-15 Thread Dima Ryazanov
This makes Xwayland correctly handle a monitor getting unplugged.

Signed-off-by: Dima Ryazanov 
---
 hw/xwayland/xwayland-output.c |  1 +
 hw/xwayland/xwayland.c| 10 +-
 hw/xwayland/xwayland.h|  1 +
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 41937b8..9ef8a48 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -163,6 +163,7 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t 
id)
 
 xwl_output->output = wl_registry_bind(xwl_screen->registry, id,
   &wl_output_interface, 2);
+xwl_output->server_output_id = id;
 wl_output_add_listener(xwl_output->output, &output_listener, xwl_output);
 
 snprintf(name, sizeof name, "XWAYLAND%d", serial++);
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 7e8d667..7c2eaed 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -410,7 +410,15 @@ registry_global(void *data, struct wl_registry *registry, 
uint32_t id,
 static void
 global_remove(void *data, struct wl_registry *registry, uint32_t name)
 {
-/* Nothing to do here, wl_compositor and wl_shm should not be removed */
+struct xwl_screen *xwl_screen = data;
+struct xwl_output *xwl_output;
+
+xorg_list_for_each_entry(xwl_output, &xwl_screen->output_list, link) {
+if (xwl_output->server_output_id == name) {
+xwl_output_destroy(xwl_output);
+break;
+}
+}
 }
 
 static const struct wl_registry_listener registry_listener = {
diff --git a/hw/xwayland/xwayland.h b/hw/xwayland/xwayland.h
index cfb343d..70875e7 100644
--- a/hw/xwayland/xwayland.h
+++ b/hw/xwayland/xwayland.h
@@ -130,6 +130,7 @@ struct xwl_seat {
 struct xwl_output {
 struct xorg_list link;
 struct wl_output *output;
+uint32_t server_output_id;
 struct xwl_screen *xwl_screen;
 RROutputPtr randr_output;
 RRCrtcPtr randr_crtc;
-- 
2.4.0

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel