On Wed, Mar 16, 2011 at 1:54 PM, Matthew Bullock
<[email protected]> wrote:
> Hi,
>
> I've just updated to the mesa 7.10.1 and eglMakeCurrent with NULL surfaces
> (the egl surfaceless extension used by wayland) now segfaults.
>
> This is caused by integrating commit
> 94ccc31ba4f64ac480137fd90f1ded44d2072f6e  st/dri: Track drawable context
> bindings
>
> without commit:
> 0acb31be171f01aec8b38ceaddf47b7da6dae2a0 st/dri: Fix surfaceless gl using
> contexts with previous bound surfaces
>
> The second commit moves the NULL check of the surfaces to before the point
> where the first commit dereferences them.

Thanks for the report, are you up for testing a patch?

Cheers Jakob.
From 71a36780dd7c5561a447ff62a6a34172a1c15323 Mon Sep 17 00:00:00 2001
From: Benjamin Franzke <[email protected]>
Date: Wed, 9 Feb 2011 20:42:50 +0100
Subject: [PATCH] st/dri: Fix surfaceless gl using contexts with previous bound surfaces

ctx->dPriv might be != NULL then draw which is NULL is accessed:

struct dri_drawable *draw = dri_drawable(driDrawPriv);
[..]
if (ctx->dPriv != driDrawPriv) {
      ctx->dPriv = driDrawPriv;
      draw->texture_stamp = driDrawPriv->lastStamp - 1;
}
---
 .../state_trackers/dri/common/dri_context.c        |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/dri/common/dri_context.c b/src/gallium/state_trackers/dri/common/dri_context.c
index aef1892..3f98d9f 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.c
+++ b/src/gallium/state_trackers/dri/common/dri_context.c
@@ -173,8 +173,15 @@ dri_make_current(__DRIcontext * cPriv,
    if (old_st && old_st != ctx->st)
       old_st->flush(old_st, PIPE_FLUSH_RENDER_CACHE, NULL);
 
+   /* Both or none must be set */
+   if (!driDrawPriv ^ !driReadPriv)
+      return GL_FALSE;
+
    ++ctx->bind_count;
 
+   if (!driDrawPriv && !driReadPriv)
+      return ctx->stapi->make_current(ctx->stapi, ctx->st, NULL, NULL);
+
    draw->context = ctx;
    if (ctx->dPriv != driDrawPriv) {
       ctx->dPriv = driDrawPriv;
@@ -186,8 +193,7 @@ dri_make_current(__DRIcontext * cPriv,
       read->texture_stamp = driReadPriv->lastStamp - 1;
    }
 
-   ctx->stapi->make_current(ctx->stapi, ctx->st,
-         (draw) ? &draw->base : NULL, (read) ? &read->base : NULL);
+   ctx->stapi->make_current(ctx->stapi, ctx->st, &draw->base, &read->base);
 
    return GL_TRUE;
 }
-- 
1.7.1

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to