From 6464787bfd1888ea93ebfe53528ceac3c27c993f Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Sun, 12 Nov 2006 02:05:40 +0000 Subject: [PATCH] Dont call exit() from the DRI driver, with AIGLX this is particularly nasty --- src/mesa/drivers/dri/nouveau/nouveau_context.c | 3 ++- src/mesa/drivers/dri/nouveau/nouveau_fifo.c | 14 ++++++++++---- src/mesa/drivers/dri/nouveau/nouveau_fifo.h | 2 +- src/mesa/drivers/dri/nouveau/nouveau_msg.h | 2 -- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c index 00f0646b1b6..ff00782c991 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_context.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c @@ -79,7 +79,8 @@ GLboolean nouveauCreateContext( const __GLcontextModes *glVisual, return GL_FALSE; /* Create the hardware context */ - nouveauFifoInit(nmesa); + if (!nouveauFifoInit(nmesa)) + return GL_FALSE; nouveauObjectInit(nmesa); /* Init default driver functions then plug in our nouveau-specific functions diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fifo.c b/src/mesa/drivers/dri/nouveau/nouveau_fifo.c index 5793909705b..94d6773d33a 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_fifo.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_fifo.c @@ -109,19 +109,25 @@ void nouveauWaitForIdle(nouveauContextPtr nmesa) } // here we call the fifo initialization ioctl and fill in stuff accordingly -void nouveauFifoInit(nouveauContextPtr nmesa) +GLboolean nouveauFifoInit(nouveauContextPtr nmesa) { drm_nouveau_fifo_alloc_t fifo_init; int ret; ret=drmCommandWriteRead(nmesa->driFd, DRM_NOUVEAU_FIFO_ALLOC, &fifo_init, sizeof(fifo_init)); - if (ret) + if (ret) { FATAL("Fifo initialization ioctl failed (returned %d)\n",ret); + return GL_FALSE; + } - if (drmMap(nmesa->driFd, fifo_init.cmdbuf, fifo_init.cmdbuf_size, &nmesa->fifo.buffer)) + if (drmMap(nmesa->driFd, fifo_init.cmdbuf, fifo_init.cmdbuf_size, &nmesa->fifo.buffer)) { FATAL("Unable to map the fifo\n",ret); - if (drmMap(nmesa->driFd, fifo_init.ctrl, fifo_init.ctrl_size, &nmesa->fifo.mmio)) + return GL_FALSE; + } + if (drmMap(nmesa->driFd, fifo_init.ctrl, fifo_init.ctrl_size, &nmesa->fifo.mmio)) { FATAL("Unable to map the control regs\n",ret); + return GL_FALSE; + } MESSAGE("Fifo init ok. Using context %d\n", fifo_init.channel); } diff --git a/src/mesa/drivers/dri/nouveau/nouveau_fifo.h b/src/mesa/drivers/dri/nouveau/nouveau_fifo.h index c2f8633dccb..afe4017d60a 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_fifo.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_fifo.h @@ -113,7 +113,7 @@ extern void WAIT_RING(nouveauContextPtr nmesa,u_int32_t size); }while(0) extern void nouveauWaitForIdle(nouveauContextPtr nmesa); -extern void nouveauFifoInit(nouveauContextPtr nmesa); +extern GLboolean nouveauFifoInit(nouveauContextPtr nmesa); #endif /* __NOUVEAU_FIFO_H__ */ diff --git a/src/mesa/drivers/dri/nouveau/nouveau_msg.h b/src/mesa/drivers/dri/nouveau/nouveau_msg.h index 7b8f89e7745..5dea2189c72 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_msg.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_msg.h @@ -54,7 +54,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. fprintf(stderr, "File %s function %s line %d\n", __FILE__, __FUNCTION__, __LINE__); \ fprintf(stderr, a, ## __VA_ARGS__);\ fprintf(stderr, "***************************************************************************\n");\ - exit(0);\ }while(0) #define FATAL(a, ...) do{\ @@ -62,7 +61,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. fprintf(stderr, "File %s function %s line %d\n", __FILE__, __FUNCTION__, __LINE__); \ fprintf(stderr, a, ## __VA_ARGS__);\ fprintf(stderr, "***************************************************************************\n");\ - exit(0);\ }while(0) #endif /* __NOUVEAU_MSG_H__ */ -- 2.30.2