Skip to contentSkip to conversation

Fix nouveau_pipe_create() / nouveau_context_init()

PATCH In review Victor Stinner 2 participants 2 messages Mar 6, 2009 – Mar 7, 2009 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix nouveau_pipe_create() / nouveau_context_init()

My first patch to help the gallium driver :-)

Fix nouveau_pipe_create() / nouveau_context_init(): raise an error if the screen/pipe creation failed.

Victor

From 69086668a51278c0e985ef3018df14477e41416b Mon Sep 17 00:00:00 2001
From: Victor Stinner <victor.stinner-XgyrR7WU8tJ8UrSeD/[email protected]>
Date: Fri, 6 Mar 2009 13:52:19 +0100
Subject: [PATCH] Fix nouveau_pipe_create() / nouveau_context_init(): raise an error if
the screen/pipe creation failed

---
 .../winsys/drm/nouveau/common/nouveau_context.c    |    6 ++++--
 .../winsys/drm/nouveau/common/nouveau_winsys.c     |    7 ++++++-
 2 files changed, 10 insertions(+), 3 deletions(-)
src/gallium/winsys/drm/nouveau/common/nouveau_context.c +4 -2
index 25c9845..d9321ea 100644
@@ -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? */
 }
 
src/gallium/winsys/drm/nouveau/common/nouveau_winsys.c +6 -1
index b6199f8..52c3b02 100644
@@ -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];
 }
Signature · 1 line
1.5.6.3

_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): 49B11E41.8050804-XgyrR7WU8tJ8UrSeD/[email protected]