Mesa (gallium-0.2): g3dvl: Return BadAlloc if we can' t create an XvMC surface.

Younes Manton ymanton at kemper.freedesktop.org
Mon Jan 19 02:48:32 UTC 2009


Module: Mesa
Branch: gallium-0.2
Commit: 11f91936f21c1ab0b38f0f84bb2cbf82f9cadece
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=11f91936f21c1ab0b38f0f84bb2cbf82f9cadece

Author: Younes Manton <younes.m at gmail.com>
Date:   Tue Jan 13 22:58:43 2009 -0500

g3dvl: Return BadAlloc if we can't create an XvMC surface.

---

 src/gallium/state_trackers/g3dvl/vl_surface.c |    6 ++++++
 src/xvmc/surface.c                            |   15 +++++++--------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/gallium/state_trackers/g3dvl/vl_surface.c b/src/gallium/state_trackers/g3dvl/vl_surface.c
index 911469f..612438f 100644
--- a/src/gallium/state_trackers/g3dvl/vl_surface.c
+++ b/src/gallium/state_trackers/g3dvl/vl_surface.c
@@ -51,6 +51,12 @@ int vlCreateSurface
 
 	sfc->texture = vlGetPipeScreen(screen)->texture_create(vlGetPipeScreen(screen), &template);
 
+	if (!sfc->texture)
+	{
+		FREE(sfc);
+		return 1;
+	}
+
 	*surface = sfc;
 
 	return 0;
diff --git a/src/xvmc/surface.c b/src/xvmc/surface.c
index 67c179e..7c5f45b 100644
--- a/src/xvmc/surface.c
+++ b/src/xvmc/surface.c
@@ -73,14 +73,13 @@ Status XvMCCreateSurface(Display *display, XvMCContext *context, XvMCSurface *su
 
 	assert(display == vlGetNativeDisplay(vlGetDisplay(vlContextGetScreen(vl_ctx))));
 
-	vlCreateSurface
-	(
-		vlContextGetScreen(vl_ctx),
-		context->width,
-		context->height,
-		vlGetPictureFormat(vl_ctx),
-		&vl_sfc
-	);
+	if (vlCreateSurface(vlContextGetScreen(vl_ctx),
+	                    context->width, context->height,
+	                    vlGetPictureFormat(vl_ctx),
+	                    &vl_sfc))
+	{
+		return BadAlloc;
+	}
 
 	vlBindToContext(vl_sfc, vl_ctx);
 




More information about the mesa-commit mailing list