When enabling mesa debug mode, weston will get seg fault?

Zhao, Halley halley.zhao at intel.com
Mon Jul 16 02:50:57 PDT 2012


It seems to be some mistake in adding YUV texture support. 
For xrgb, the following patch works for me. Additional consideration is required for yuv format( I can try it tomorrow).

>From 21682938f7ac2ab64e751b07e3bcda0516d4c6e9 Mon Sep 17 00:00:00 2001
From: Zhao Halley <halley.zhao at intel.com>
Date: Mon, 16 Jul 2012 17:44:42 +0800
Subject: [PATCH] egl/wayland: fix xrgb crash issue in debug version

---
 src/egl/drivers/dri2/egl_dri2.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index fcb2264..839df42 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1327,6 +1327,7 @@ dri2_wl_reference_buffer(void *user_data, uint32_t name,
    _EGLDisplay *disp = user_data;
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
    int i;
+   int dri_format;
 
    for (i = 0; i < ARRAY_SIZE(wl_drm_formats); i++)
       if (wl_drm_formats[i].wl_format == buffer->format) {
@@ -1337,11 +1338,30 @@ dri2_wl_reference_buffer(void *user_data, uint32_t name,
    if (buffer->driver_format == NULL)
       return;
 
+   switch (buffer->format) {
+   case WL_DRM_FORMAT_ARGB8888:
+        dri_format = __DRI_IMAGE_FORMAT_ARGB8888;
+        break;
+   case WL_DRM_FORMAT_XRGB8888:
+        dri_format = __DRI_IMAGE_FORMAT_XRGB8888;
+        break;
+   case WL_DRM_FORMAT_YUV410:
+   case WL_DRM_FORMAT_YUV411:
+   case WL_DRM_FORMAT_YUV420:
+   case WL_DRM_FORMAT_YUV422:
+   case WL_DRM_FORMAT_YUV444:
+   case WL_DRM_FORMAT_NV12:
+   case WL_DRM_FORMAT_NV16:
+        dri_format = __DRI_IMAGE_FORMAT_NONE;
+        break;
+   default:
+        assert(0); // other format are not supported by wayland yet
+   }
    buffer->driver_buffer =
       dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen,
                                            buffer->buffer.width,
                                            buffer->buffer.height, 
-                                           __DRI_IMAGE_FORMAT_NONE, name,
+                                           dri_format, name,
                                            buffer->stride[0] / 4,
                                            NULL);
 }
-- 
1.7.5.4


> -----Original Message-----
> From: wayland-devel-bounces+halley.zhao=intel.com at lists.freedesktop.org
> [mailto:wayland-devel-bounces+halley.zhao=intel.com at lists.freedesktop.org]
> On Behalf Of Juan Zhao
> Sent: Monday, July 16, 2012 4:20 PM
> To: wayland-devel
> Subject: When enabling mesa debug mode, weston will get seg fault?
> 
> Hi there,
> When I enabled mesa debug mode, westen reported one seg-fault error. Any
> ideas about it? Should we remove that assert for the "none" format, or some
> decent solution?
> The backtrace is like this:
> 
> 
> (gdb) bt
> #0  0xb7fe1424 in __kernel_vsyscall ()
> #1  0xb7d5ccc1 in raise () from /lib/libc.so.6
> #2  0xb7d600ee in abort () from /lib/libc.so.6
> #3  0xb7d55888 in __assert_fail () from /lib/libc.so.6
> #4  0xb7571350 in _mesa_get_format_bytes (format=MESA_FORMAT_NONE)
> at ./../main/formats.c:1556
> #5  0xb78fa176 in intel_create_image_from_name (screen=0x8062eb0,
> width=480, height=454, format=4104, name=5, pitch=512,
> loaderPrivate=0x0) at intel_screen.c:236
> #6  0xb7fd3e61 in dri2_wl_reference_buffer (user_data=0x8065800, name=5,
> buffer=0x805f300) at egl_dri2.c:1341
> #7  0xb7fcf267 in create_buffer (client=0x824d348, resource=0x826d390,
> id=20, name=5, width=480, height=454, format=875713112, offset0=0,
> stride0=2048, offset1=0, stride1=0, offset2=0, stride2=0) at
> wayland-drm.c:122
> #8  0xb7fcf37a in drm_create_buffer (client=0x824d348, resource=0x826d390,
> id=20, name=5, width=480, height=454, stride=2048,
> format=875713112) at wayland-drm.c:159
> #9  0xb7bb460a in ffi_call_SYSV () from /usr/lib/libffi.so.5
> #10 0xb7bb4360 in ffi_call () from /usr/lib/libffi.so.5
> #11 0xb7fb4691 in wl_closure_invoke (closure=0x8270ed0, target=0x826d390,
> func=0xb7fcf2ec <drm_create_buffer>, data=0x824d348) at connection.c:837
> #12 0xb7faffe3 in wl_client_connection_data (fd=41, mask=1,
> data=0x824d348) at wayland-server.c:284
> #13 0xb7fb2973 in wl_event_source_fd_dispatch (source=0x826d750,
> ep=0xbffff154) at event-loop.c:79
> #14 0xb7fb3163 in wl_event_loop_dispatch (loop=0x805c4e0, timeout=-1) at
> event-loop.c:410
> #15 0xb7fb0e12 in wl_display_run (display=0x805c4b0) at
> wayland-server.c:1100
> #16 0x080536d7 in main (argc=<value optimized out>, argv=0xbffff734) at
> compositor.c:3532
> 
> 
> 
> Thanks,
> Juan
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list