* [PATCH] glx/dri3: Provide error diagnostics when DRI3 allocation fails
@ 2014-10-01 3:09 Keith Packard
2014-10-01 3:29 ` [Mesa-dev] " Matt Turner
0 siblings, 1 reply; 3+ messages in thread
From: Keith Packard @ 2014-10-01 3:09 UTC (permalink / raw)
To: mesa-dev; +Cc: dri-devel
Instead of just segfaulting in the driver when a buffer allocation fails,
report error messages indicating what went wrong so that we can debug things.
As a simple example, chromium wraps Mesa in a sandbox which doesn't allow
access to most syscalls, including the ability to create shared memory
segments for fences. Before, you'd get a simple segfault in mesa and your 3D
acceleration would fail. Now you get:
$ chromium --disable-gpu-blacklist
[10618:10643:0930/200525:ERROR:nss_util.cc(856)] After loading Root Certs, loaded==false: NSS error code: -8018
libGL: pci id for fd 12: 8086:0a16, driver i965
libGL: OpenDriver: trying /local-miki/src/mesa/mesa/lib/i965_dri.so
libGL: Can't open configuration file /home/keithp/.drirc: Operation not permitted.
libGL: Can't open configuration file /home/keithp/.drirc: Operation not permitted.
libGL error: DRI3 Fence object allocation failure Operation not permitted
[10618:10618:0930/200525:ERROR:command_buffer_proxy_impl.cc(153)] Could not send GpuCommandBufferMsg_Initialize.
[10618:10618:0930/200525:ERROR:webgraphicscontext3d_command_buffer_impl.cc(236)] CommandBufferProxy::Initialize failed.
[10618:10618:0930/200525:ERROR:webgraphicscontext3d_command_buffer_impl.cc(256)] Failed to initialize command buffer.
This made it pretty easy to diagnose the problem in the referenced bug report.
Bugzilla: https://code.google.com/p/chromium/issues/detail?id=415681
Signed-off-by: Keith Packard <keithp@keithp.com>
---
src/glx/dri3_glx.c | 33 +++++++++++++++++++++++++--------
1 file changed, 25 insertions(+), 8 deletions(-)
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index 753b8d8..5cae50e 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -816,11 +816,15 @@ dri3_alloc_render_buffer(struct glx_screen *glx_screen, Drawable draw,
*/
fence_fd = xshmfence_alloc_shm();
- if (fence_fd < 0)
+ if (fence_fd < 0) {
+ ErrorMessageF("DRI3 Fence object allocation failure %s\n", strerror(errno));
return NULL;
+ }
shm_fence = xshmfence_map_shm(fence_fd);
- if (shm_fence == NULL)
+ if (shm_fence == NULL) {
+ ErrorMessageF("DRI3 Fence object map failure %s\n", strerror(errno));
goto no_shm_fence;
+ }
/* Allocate the image from the driver
*/
@@ -829,8 +833,10 @@ dri3_alloc_render_buffer(struct glx_screen *glx_screen, Drawable draw,
goto no_buffer;
buffer->cpp = dri3_cpp_for_format(format);
- if (!buffer->cpp)
+ if (!buffer->cpp) {
+ ErrorMessageF("DRI3 buffer format %d invalid\n", format);
goto no_image;
+ }
if (!psc->is_different_gpu) {
buffer->image = (*psc->image->createImage) (psc->driScreen,
@@ -841,8 +847,10 @@ dri3_alloc_render_buffer(struct glx_screen *glx_screen, Drawable draw,
buffer);
pixmap_buffer = buffer->image;
- if (!buffer->image)
+ if (!buffer->image) {
+ ErrorMessageF("DRI3 other gpu image creation failure\n");
goto no_image;
+ }
} else {
buffer->image = (*psc->image->createImage) (psc->driScreen,
width, height,
@@ -850,8 +858,10 @@ dri3_alloc_render_buffer(struct glx_screen *glx_screen, Drawable draw,
0,
buffer);
- if (!buffer->image)
+ if (!buffer->image) {
+ ErrorMessageF("DRI3 gpu image creation failure\n");
goto no_image;
+ }
buffer->linear_buffer = (*psc->image->createImage) (psc->driScreen,
width, height,
@@ -861,19 +871,25 @@ dri3_alloc_render_buffer(struct glx_screen *glx_screen, Drawable draw,
buffer);
pixmap_buffer = buffer->linear_buffer;
- if (!buffer->linear_buffer)
+ if (!buffer->linear_buffer) {
+ ErrorMessageF("DRI3 gpu linear image creation failure\n");
goto no_linear_buffer;
+ }
}
/* X wants the stride, so ask the image for it
*/
- if (!(*psc->image->queryImage)(pixmap_buffer, __DRI_IMAGE_ATTRIB_STRIDE, &stride))
+ if (!(*psc->image->queryImage)(pixmap_buffer, __DRI_IMAGE_ATTRIB_STRIDE, &stride)) {
+ ErrorMessageF("DRI3 get image stride failed\n");
goto no_buffer_attrib;
+ }
buffer->pitch = stride;
- if (!(*psc->image->queryImage)(pixmap_buffer, __DRI_IMAGE_ATTRIB_FD, &buffer_fd))
+ if (!(*psc->image->queryImage)(pixmap_buffer, __DRI_IMAGE_ATTRIB_FD, &buffer_fd)) {
+ ErrorMessageF("DRI3 get image FD failed\n");
goto no_buffer_attrib;
+ }
xcb_dri3_pixmap_from_buffer(c,
(pixmap = xcb_generate_id(c)),
@@ -913,6 +929,7 @@ no_buffer:
xshmfence_unmap_shm(shm_fence);
no_shm_fence:
close(fence_fd);
+ ErrorMessageF("DRI3 alloc_render_buffer failed\n");
return NULL;
}
--
2.1.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Mesa-dev] [PATCH] glx/dri3: Provide error diagnostics when DRI3 allocation fails
2014-10-01 3:09 [PATCH] glx/dri3: Provide error diagnostics when DRI3 allocation fails Keith Packard
@ 2014-10-01 3:29 ` Matt Turner
2014-10-01 4:24 ` Keith Packard
0 siblings, 1 reply; 3+ messages in thread
From: Matt Turner @ 2014-10-01 3:29 UTC (permalink / raw)
To: Keith Packard
Cc: mesa-dev@lists.freedesktop.org, Maling list - DRI developers
On Tue, Sep 30, 2014 at 8:09 PM, Keith Packard <keithp@keithp.com> wrote:
> Instead of just segfaulting in the driver when a buffer allocation fails,
> report error messages indicating what went wrong so that we can debug things.
>
> As a simple example, chromium wraps Mesa in a sandbox which doesn't allow
> access to most syscalls, including the ability to create shared memory
> segments for fences. Before, you'd get a simple segfault in mesa and your 3D
> acceleration would fail. Now you get:
>
> $ chromium --disable-gpu-blacklist
> [10618:10643:0930/200525:ERROR:nss_util.cc(856)] After loading Root Certs, loaded==false: NSS error code: -8018
> libGL: pci id for fd 12: 8086:0a16, driver i965
> libGL: OpenDriver: trying /local-miki/src/mesa/mesa/lib/i965_dri.so
> libGL: Can't open configuration file /home/keithp/.drirc: Operation not permitted.
> libGL: Can't open configuration file /home/keithp/.drirc: Operation not permitted.
> libGL error: DRI3 Fence object allocation failure Operation not permitted
> [10618:10618:0930/200525:ERROR:command_buffer_proxy_impl.cc(153)] Could not send GpuCommandBufferMsg_Initialize.
> [10618:10618:0930/200525:ERROR:webgraphicscontext3d_command_buffer_impl.cc(236)] CommandBufferProxy::Initialize failed.
> [10618:10618:0930/200525:ERROR:webgraphicscontext3d_command_buffer_impl.cc(256)] Failed to initialize command buffer.
>
> This made it pretty easy to diagnose the problem in the referenced bug report.
>
> Bugzilla: https://code.google.com/p/chromium/issues/detail?id=415681
> Signed-off-by: Keith Packard <keithp@keithp.com>
> ---
Seems like a good plan.
Reviewed-by: Matt Turner <mattst88@gmail.com>
Should we add a Cc: for the stable branch?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] glx/dri3: Provide error diagnostics when DRI3 allocation fails
2014-10-01 3:29 ` [Mesa-dev] " Matt Turner
@ 2014-10-01 4:24 ` Keith Packard
0 siblings, 0 replies; 3+ messages in thread
From: Keith Packard @ 2014-10-01 4:24 UTC (permalink / raw)
To: Matt Turner; +Cc: mesa-dev@lists.freedesktop.org, Maling list - DRI developers
[-- Attachment #1.1: Type: text/plain, Size: 234 bytes --]
Matt Turner <mattst88@gmail.com> writes:
> Reviewed-by: Matt Turner <mattst88@gmail.com>
>
> Should we add a Cc: for the stable branch?
Also seems like a good plan. I've added that and pushed.
--
keith.packard@intel.com
[-- Attachment #1.2: Type: application/pgp-signature, Size: 810 bytes --]
[-- Attachment #2: Type: text/plain, Size: 156 bytes --]
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-10-01 4:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-01 3:09 [PATCH] glx/dri3: Provide error diagnostics when DRI3 allocation fails Keith Packard
2014-10-01 3:29 ` [Mesa-dev] " Matt Turner
2014-10-01 4:24 ` Keith Packard
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.