Re: how to add some log in mutter?

On Fri, Oct 11, 2019 at 08:33:03PM +0800, Halley Zhao wrote:
I gave some try;
log shows on my desktop pc, but not on my test device.
I'm curious why dma_buf_bind () isn't triggered on my device; from client
side, I do see wayland server( mutter ) reports the supported color format.
is there any other place to handle dmabuf interface bind?

Could it be that your test device doesn't use DMA-BUF? On your desktop,
I assume you're using mesa, which will use the Wayland DMA-BUF if you
have a new enough version, but is your test device also using the same
mesa version?

Assuming your test device is also running mutter or gnome-shell, it
should only bind via the dma_buf_bind() function in
meta-wayland-dma-buf.c; there is no other entry point.

Do you have complete WAYLAND_DEBUG=1 logs from your test device?


Jonas Ådahl <jadahl gmail com> 于2019年10月11日周五 下午7:49写道:

On Fri, Oct 11, 2019 at 06:55:42PM +0800, Halley Zhao via gnome-shell-list
Hi experts:
I want to debug somthing in mutter, the question is how to add log in

the background is:
on my platform(fc30), weston-simple-dmabuf-drm fail to run, it fails
call zwp_linux_buffer_params_v1_create().
after export WAYLAND_DEBUG=1, I don't get clue.
(create_dmabuf_buffer, 711)
(create_dmabuf_buffer,723)format: XR24, width: 256, height: 256, flags:
Error: zwp_linux_buffer_params.create failed.
Error: zwp_linux_buffer_params.create failed.
Error: zwp_linux_buffer_params.create failed.
then I decide to add some log in mutter to see where is the fail.
since is loaded by gnome-shell in the background, I
try to
write my debug log to disk file. but when I add some log in
it doesn't take effect. why?
what's the correct way to add log in mutter?

You should be able to use e.g.

    fprintf (stderr, "Log this message\n");


    g_message ("Log this message");


    g_warning ("Log this warning");

If you run gnome-shell or mutter from GDM, the log entries will end up
in the journal. You can look in the journal with for example

    journalctl -e $(which gnome-shell)

If you run mutter or gnome-shell manually from a tty, it's easiest to
run and reroute stdout and stderr directly to a file, e.g mutter >&

If your added log entries doesn't show up even though you are sure the
functions where you added your log entries were called, then double
check that the libmutter you compiled yourself is the one used by the
executable when you run.



here are code piece to add log:
static void _my_print_test_log(const char* file_name)
    FILE* _tmp_fp = NULL;
    _tmp_fp = fopen(file_name, "w+");
    if (_tmp_fp) {
      fprintf(_tmp_fp, "#### my test ####");

static void
dma_buf_bind (struct wl_client *client,
              void             *data,
              uint32_t          version,
              uint32_t          id)
  MetaWaylandCompositor *compositor = data;
  struct wl_resource *resource;

  resource = wl_resource_create (client, &zwp_linux_dmabuf_v1_interface,
                                 version, id);
  wl_resource_set_implementation (resource, &dma_buf_implementation,
                                  compositor, NULL);


  send_modifiers (resource, DRM_FORMAT_ARGB8888);
  send_modifiers (resource, DRM_FORMAT_XRGB8888);
  send_modifiers (resource, DRM_FORMAT_ARGB2101010);
  send_modifiers (resource, DRM_FORMAT_RGB565);

gnome-shell-list mailing list
gnome-shell-list gnome org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]