Mesa (master): st/dri: Add support for surfaceless current contexts.

Chia-I Wu olv at kemper.freedesktop.org
Tue Nov 9 18:02:03 UTC 2010


Module: Mesa
Branch: master
Commit: 5b6ec5a553876266bfa2ef65081aa1075419b97e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5b6ec5a553876266bfa2ef65081aa1075419b97e

Author: Chia-I Wu <olv at lunarg.com>
Date:   Wed Nov 10 01:38:41 2010 +0800

st/dri: Add support for surfaceless current contexts.

Tested with Wayland.

---

 .../state_trackers/dri/common/dri_context.c        |    3 ++-
 .../state_trackers/dri/common/dri_drawable.h       |    3 ++-
 src/gallium/state_trackers/dri/common/dri_screen.c |    3 +++
 3 files changed, 7 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 770b370..3d5d24e 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.c
+++ b/src/gallium/state_trackers/dri/common/dri_context.c
@@ -178,7 +178,8 @@ dri_make_current(__DRIcontext * cPriv,
       read->texture_stamp = driReadPriv->lastStamp - 1;
    }
 
-   ctx->stapi->make_current(ctx->stapi, ctx->st, &draw->base, &read->base);
+   ctx->stapi->make_current(ctx->stapi, ctx->st,
+         (draw) ? &draw->base : NULL, (read) ? &read->base : NULL);
 
    return GL_TRUE;
 }
diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.h b/src/gallium/state_trackers/dri/common/dri_drawable.h
index 837d398..2ff6b71 100644
--- a/src/gallium/state_trackers/dri/common/dri_drawable.h
+++ b/src/gallium/state_trackers/dri/common/dri_drawable.h
@@ -70,7 +70,8 @@ struct dri_drawable
 static INLINE struct dri_drawable *
 dri_drawable(__DRIdrawable * driDrawPriv)
 {
-   return (struct dri_drawable *)driDrawPriv->driverPrivate;
+   return (struct dri_drawable *) (driDrawPriv)
+      ? driDrawPriv->driverPrivate : NULL;
 }
 
 /***********************************************************************
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c b/src/gallium/state_trackers/dri/common/dri_screen.c
index 252ad17..1302e9b 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -231,6 +231,9 @@ dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen,
 {
    memset(stvis, 0, sizeof(*stvis));
 
+   if (!mode)
+      return;
+
    stvis->samples = mode->samples;
    stvis->render_buffer = ST_ATTACHMENT_INVALID;
 




More information about the mesa-commit mailing list