[Mesa-dev] [PATCH 19/27] dri: Remove unnecessary timestamp pointer indirection
Kristian Høgsberg
krh at bitplanet.net
Fri Oct 28 15:11:49 PDT 2011
---
.../state_trackers/dri/common/dri_drawable.c | 6 +++---
src/gallium/state_trackers/dri/drm/dri2.c | 2 +-
src/gallium/state_trackers/dri/sw/dri_drawable.c | 6 +++---
src/mesa/drivers/dri/common/dri_util.c | 4 +---
src/mesa/drivers/dri/common/dri_util.h | 11 ++++-------
src/mesa/drivers/dri/nouveau/nouveau_context.c | 8 ++++----
6 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c b/src/gallium/state_trackers/dri/common/dri_drawable.c
index 340404e..7bfce1b 100644
--- a/src/gallium/state_trackers/dri/common/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/common/dri_drawable.c
@@ -62,9 +62,9 @@ dri_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
new_mask = (statt_mask & ~drawable->texture_mask);
/*
- * dPriv->pStamp is the server stamp. It should be accessed with a lock, at
- * least for DRI1. dPriv->lastStamp is the client stamp. It has the value
- * of the server stamp when last checked.
+ * dPriv->dri2.stamp is the server stamp. dPriv->lastStamp is the
+ * client stamp. It has the value of the server stamp when last
+ * checked.
*/
new_stamp = (drawable->texture_stamp != drawable->dPriv->lastStamp);
diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c
index 710a61a..6113f43 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -65,7 +65,7 @@ dri2_invalidate_drawable(__DRIdrawable *dPriv)
struct dri_drawable *drawable = dri_drawable(dPriv);
dri2InvalidateDrawable(dPriv);
- drawable->dPriv->lastStamp = *drawable->dPriv->pStamp;
+ drawable->dPriv->lastStamp = drawable->dPriv->dri2.stamp;
p_atomic_inc(&drawable->base.stamp);
}
diff --git a/src/gallium/state_trackers/dri/sw/dri_drawable.c b/src/gallium/state_trackers/dri/sw/dri_drawable.c
index 05c64b6..c53706e 100644
--- a/src/gallium/state_trackers/dri/sw/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/sw/dri_drawable.c
@@ -61,9 +61,9 @@ dri_st_framebuffer_validate(struct st_framebuffer_iface *stfbi,
new_mask = (statt_mask & ~drawable->texture_mask);
/*
- * dPriv->pStamp is the server stamp. It should be accessed with a lock, at
- * least for DRI1. dPriv->lastStamp is the client stamp. It has the value
- * of the server stamp when last checked.
+ * dPriv->dri2.stamp is the server stamp. dPriv->lastStamp is the
+ * client stamp. It has the value of the server stamp when last
+ * checked.
*/
new_stamp = (drawable->texture_stamp != drawable->dPriv->lastStamp);
diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c
index aa095d8..9deb997 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -171,7 +171,6 @@ dri2CreateNewDrawable(__DRIscreen *screen,
pdraw->driContextPriv = NULL;
pdraw->loaderPrivate = loaderPrivate;
pdraw->refcount = 1;
- pdraw->pStamp = NULL;
pdraw->lastStamp = 0;
pdraw->w = 0;
pdraw->h = 0;
@@ -182,8 +181,7 @@ dri2CreateNewDrawable(__DRIscreen *screen,
return NULL;
}
- pdraw->pStamp = &pdraw->dri2.stamp;
- *pdraw->pStamp = pdraw->lastStamp + 1;
+ pdraw->dri2.stamp = pdraw->lastStamp + 1;
return pdraw;
}
diff --git a/src/mesa/drivers/dri/common/dri_util.h b/src/mesa/drivers/dri/common/dri_util.h
index ab11d45..38394a7 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -160,15 +160,9 @@ struct __DRIdrawableRec {
int refcount;
/**
- * Pointer to the "drawable has changed ID" stamp in the SAREA (or
- * to dri2.stamp if DRI2 is being used).
- */
- unsigned int *pStamp;
-
- /**
* Last value of the stamp.
*
- * If this differs from the value stored at __DRIdrawable::pStamp,
+ * If this differs from the value stored at __DRIdrawable::dri2.stamp,
* then the drawable information has been modified by the X server, and the
* drawable information (below) should be retrieved from the X server.
*/
@@ -186,6 +180,9 @@ struct __DRIdrawableRec {
*/
__DRIscreen *driScreenPriv;
+ /**
+ * Drawable timestamp. Increased when the loader calls invalidate.
+ */
struct {
unsigned int stamp;
} dri2;
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_context.c b/src/mesa/drivers/dri/nouveau/nouveau_context.c
index 65cbc41..2b9507c 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_context.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_context.c
@@ -177,9 +177,9 @@ nouveau_update_renderbuffers(__DRIcontext *dri_ctx, __DRIdrawable *draw)
__DRIbuffer *buffers = NULL;
int i = 0, count, ret;
- if (draw->lastStamp == *draw->pStamp)
+ if (draw->lastStamp == draw->dri2.stamp)
return;
- draw->lastStamp = *draw->pStamp;
+ draw->lastStamp = draw->dri2.stamp;
if (nfb->need_front)
attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
@@ -257,7 +257,7 @@ update_framebuffer(__DRIcontext *dri_ctx, __DRIdrawable *draw,
struct gl_context *ctx = dri_ctx->driverPrivate;
struct gl_framebuffer *fb = draw->driverPrivate;
- *stamp = *draw->pStamp;
+ *stamp = draw->dri2.stamp;
nouveau_update_renderbuffers(dri_ctx, draw);
_mesa_resize_framebuffer(ctx, fb, draw->w, draw->h);
@@ -337,7 +337,7 @@ validate_framebuffer(__DRIcontext *dri_ctx, __DRIdrawable *draw,
dri2InvalidateDrawable(draw);
}
- if (*draw->pStamp != *stamp)
+ if (draw->dri2.stamp != *stamp)
update_framebuffer(dri_ctx, draw, stamp);
}
--
1.7.7
More information about the mesa-dev
mailing list