Mesa/u_Fix-crash-in-swrast-when-setting-a-texture-for-a-pix.patch
Stefan Dirsch 7a0930bbe6 Accepting request 131614 from home:klausi123:X11
Heavily break the system? ok lets do it!
(Just kidding)

This is just to show some work towards mesa 8.1, but this snapshot actually works :)
Three new development packages added!
If you accept this there will be a new libdrm and a newer nouveau driver

OBS-URL: https://build.opensuse.org/request/show/131614
OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/Mesa?expand=0&rev=240
2012-08-27 09:57:08 +00:00

50 lines
1.8 KiB
Diff

From 26de08de6f27a5fe5fc6aaeee0ebedf40626ab04 Mon Sep 17 00:00:00 2001
From: Tobias Johannes Klausmann <tobias.johannes.klausmann@mni.thm.de>
Date: Fri, 20 Apr 2012 11:52:31 +0200
Subject: [PATCH] When glXBindTexImageEXT is called and SWrast is used there
will be a crash when sPriv->swrast_loader->getImage() is
called from swrastSetTexBuffer2(). Reason: no memory has
been allocated for the destination thus texImage->Data is
NULL. Call ctx->Driver.TexImage2D() to initialize this. If
memory has been allocated in a previous call free it first.
Signed-off-by: Egbert Eich <eich@freedesktop.org>
for 8.0.1
Ported to 8.0.2
Ported to 8.1
---
src/mesa/drivers/dri/swrast/swrast.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c
index d18dd09..dd7d0c0 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -66,6 +66,7 @@
static void swrastSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
GLint texture_format, __DRIdrawable *dPriv)
{
+ GET_CURRENT_CONTEXT(ctx);
struct dri_context *dri_ctx;
int x, y, w, h;
__DRIscreen *sPriv = dPriv->driScreenPriv;
@@ -96,6 +97,13 @@ static void swrastSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
_mesa_init_teximage_fields(&dri_ctx->Base, texImage,
w, h, 1, 0, internalFormat, texFormat);
+
+ if (texImage->Data)
+ ctx->Driver.FreeTexImageData(ctx, texImage);
+
+ ctx->Driver.TexImage2D(ctx, target, 0, internalFormat,
+ w, h, 0, texture_format, GL_UNSIGNED_INT_8_8_8_8,
+ NULL, &ctx->Unpack, texObj, texImage);
sPriv->swrast_loader->getImage(dPriv, x, y, w, h, (char *)swImage->Buffer,
dPriv->loaderPrivate);
--
1.7.7