SHA256
1
0
forked from pool/Mesa
Mesa/u_Fix-crash-in-swrast-when-setting-a-texture-for-a-pix.patch
Stefan Dirsch 5f49dc1836 Accepting request 73243 from home:eeich:branches:X11:XOrg
- u_Fix-crash-in-swrast-when-setting-a-texture-for-a-pix.patch:
  Update this patch closing a giant memory leak.

- Replace patches:
  * add: u_GLX-SWrast-Make-GLX-with-SWrast-enabled-work-on-olde.patch
    This patch falls back to indirect rendering if SWrast doesn't work
    with older Xservers as no common configs/visuals can be found.
  * remove: Mesa_indirect_old_xserver_compatibility.diff
    this patch is superseded.
  * rename: 0001-Fix-crash-in-swrast-when-setting-a-texture-for-a-pix.patch
    to u_Fix-crash-in-swrast-when-setting-a-texture-for-a-pix.patch

- Remove: intel-add-gem-string.patch
  This patch was barking up the wrong tree anyway.
  As discussed with Martin Grässlin from the Kwin project
  a patch from the upstream git master has been cherry-picked
  and added to kdebase4-workspace which makes this patch unneciessary.
  The patch to Kwin will become obsolete once Kwin is updated,
  this will be noticed easily in kdebase4-workspace.

- Fix the driver directory search path in the spec file.
  This makes dri_driver_dir.diff obsolete.

- Add packaging information for GLES2 devel files. 

- Add GLES2 support.

OBS-URL: https://build.opensuse.org/request/show/73243
OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/Mesa?expand=0&rev=154
2011-06-10 10:03:49 +00:00

48 lines
1.8 KiB
Diff

From c588b0b65658821e6dbc6887ee07637a64d9c037 Mon Sep 17 00:00:00 2001
From: Egbert Eich <eich@freedesktop.org>
Date: Fri, 10 Jun 2011 07:59:21 +0200
Subject: [PATCH] [SWrast, BindTexImage] Fix crash in swrast when setting a texture for a pixmap.
Patch-mainline: To be upstreamed
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>
---
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 719b406..02a668e 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -61,6 +61,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;
@@ -90,6 +91,13 @@ static void swrastSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
_mesa_init_teximage_fields(&dri_ctx->Base, target, 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 *)texImage->Data,
dPriv->loaderPrivate);
--
1.7.3.4