Fix nouveau_pipe_create() / nouveau_context_init(): raise an error if the screen...
authorVictor Stinner <victor.stinner@haypocalc.com>
Fri, 6 Mar 2009 12:52:19 +0000 (13:52 +0100)
committerBen Skeggs <bskeggs@redhat.com>
Sat, 7 Mar 2009 07:49:08 +0000 (17:49 +1000)
src/gallium/winsys/drm/nouveau/common/nouveau_context.c
src/gallium/winsys/drm/nouveau/common/nouveau_winsys.c

index 25c98456ac4cd2a1eb62435652d1717e0263bf8d..d9321eaa3f969aeeb7f63cb0f998cfbe634c84ef 100644 (file)
@@ -132,8 +132,10 @@ nouveau_context_init(struct nouveau_screen *nv_screen,
                struct pipe_screen *pscreen;
 
                pipe = nouveau_pipe_create(nv);
-               if (!pipe)
+               if (!pipe) {
                        NOUVEAU_ERR("Couldn't create hw pipe\n");
+                       return 1;
+               }
                pscreen = nvc->pscreen;
 
                nv->cap.hw_vertex_buffer =
@@ -199,7 +201,7 @@ nouveau_context_cleanup(struct nouveau_context *nv)
                        nv->nv_screen->nvc = NULL;
                }
        }
-       
+
        /* XXX: Who cleans up the pipe? */
 }
 
index b6199f8e6db3005eb75be81df094d0249243f4d2..52c3b022475ace9781c680a89976902866024657 100644 (file)
@@ -133,8 +133,13 @@ nouveau_pipe_create(struct nouveau_context *nv)
 
        ws = nouveau_create_pipe_winsys(nv);
 
-       if (!nvc->pscreen)
+       if (!nvc->pscreen) {
                nvc->pscreen = hws_create(ws, nvws);
+               if (!nvc->pscreen) {
+                       NOUVEAU_ERR("Couldn't create hw screen\n");
+                       return NULL;
+               }
+       }
        nvc->pctx[nv->pctx_id] = hw_create(nvc->pscreen, nv->pctx_id);
        return nvc->pctx[nv->pctx_id];
 }