questions about gtk simple applications running on wayland

Zhao, Juan J juan.j.zhao at intel.com
Sun Oct 30 21:13:59 PDT 2011


After understanding the process of wl_client_connection_data->wl_closure_invoke->shell_set_toplevel, some solution for this problem is found: we need check the object type before taking actions in shell_set_toplevel.

Since the clients send the request to the server that "please let the item 9 in wl_map object do shell_set_toplevel". In fact, the item 9 in wl_map is wl_buffer object. But shell_set_toplevel's parameter only treated it as wl_surface. So there is segment fault and random errors.
The solution can be checking the interface name before doing operations, like this:
        if((struct wl_interface *)(((struct wl_object *)surface_resource)->interface)->name!="wl_surface")
        {
                printf("set wl_buffer to the toplevel in shell_set_toplevel, return!");
                return;
        }
By the way, the boundary check for the damage is also necessary.

With this solution, "simple" in gtk application can run OK with wayland compositor with X11 backend.
Any other suggestions?
If no, I will send out the patch later.


-----
*^_^* BRs,
Juan



From: Zhao, Juan J
Sent: Friday, October 28, 2011 8:19 PM
To: wayland-devel at lists.freedesktop.org
Subject: RE: questions about gtk simple applications running on wayland

Updates today:
In the client side: Gtk call wl_egl_pixmap_create_buffer to create the buffer and then use wl_surface_attach to attach this buffer to its surface.
In the server side: drm_create_buffer is called and add that buffer resource to this client. And wl_map_insert_at will be called. That buffer resource is inserted to the map. Then surface_attach will be called, this buffer will be saved to one wlsc_surface.

Then in the client side, gtk call wl_shell_set_toplevel, wl_connection_vmarshal will be called.
In the server side, shell_set_toplevel is called. The third parameter is the previous buffer object created by drm_create_buffer not the wlsc_surface.
Should I need to look into wl_connection_vmarshal to check each parameter sent to the server?

-----
*^_^* BRs,
Juan


From: Zhao, Juan J
Sent: Thursday, October 27, 2011 4:15 PM
To: Zhao, Juan J; wayland-devel at lists.freedesktop.org
Subject: RE: questions about gtk simple applications running on wayland

Some updates for this question.
In gtk side, if I run "wl_shell_set_toplevel" once the surface is created by "wl_compositor_create_surface", everything is OK.
But later, gtk application will bind some image to this surface. And then call "wl_shell_set_toplevel".

In the server side, the function shell_set_toplevel's third parameter is only "wl_buffer" but not "wlsc_surface".
The server used some point which is not for wlsc_surface, and then, random result shows: like the height and width is too big....
Any thoughts?

-----
*^_^* BRs,
Juan


From: wayland-devel-bounces+juan.j.zhao=intel.com at lists.freedesktop.org [mailto:wayland-devel-bounces+juan.j.zhao=intel.com at lists.freedesktop.org] On Behalf Of Zhao, Juan J
Sent: Thursday, October 27, 2011 9:26 AM
To: wayland-devel at lists.freedesktop.org
Subject: questions about gtk simple applications running on wayland

Hey there,
  These days, I'm trying to run some simple gtk applications on wayland.
  I built gtk, and fix some mismatched wayland interface. But there are still some problems.
  It is announced that gtk applications can run on X11 backend wayland compositor. So I choose this backend at first.
  Simple wayland client demos can run OK. But when running gtk applications, I will find that server will meet segment fault.
  The segment fault is directly caused by shell_set_toplevel->wlsc_surface_damage->wlsc_surface_damage_rectangle->pixman_region32_union_rect. The width and height is more than 10,000+.
  Looks like some boundaries check should be added here. Because the server should not crashed by some unhealthy clients.
And maybe we can still send some message to the client:"Hey, you did something wrong...and I will ignore your request"

Obviously, this is not the root cause. I went on track the shell_top_level's resource. This resource is inserted to wl_map by bind_shell.
There are something strange here. When adding these resource, it is a kind of wl_shell resource. But when using it in shell_set_toplevel, it become a wlsc_surface resource....
Did I misunderstand something here? Any thoughts for me for going ahead to fix this problem to the root cause?



-----
*^_^* BRs,
Juan


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20111031/214d501a/attachment-0001.html>


More information about the wayland-devel mailing list