diff mbox

gallium: Use base.stamp for all drawable invalidation checks.

Message ID 1385094018-22536-1-git-send-email-keithp@keithp.com
State New, archived
Headers show

Commit Message

Keith Packard Nov. 22, 2013, 4:20 a.m. UTC
Upper levels of the stack use base.stamp to tell when a drawable needs to be
revalidated, but the dri state tracker was using dPriv->lastStamp. Those two,
along with dri2.stamp, all get simultaneously incremented when a dri2
invalidate event was delivered, and so end up containing precisely the same
value.

This patch doesn't change the fact that there are three variables, rather it
switches all of the tests to use only base.stamp, which is functionally
equivalent to the previous code.

Then, it passes base.stamp to the image loader getBuffers function so that the
one which is checked will get updated by the XCB special event queue used by DRI3.

Signed-off-by: Keith Packard <keithp@keithp.com>
---

This patch makes sure that drawables get invalidated when the window
changes size or when SwapBuffers is called; dri3 has only a single
location to smite when things change, so we need to make sure the
upper levels all share that location.

This should permit the elimination of the dri2.stamp and lastStamp
variables, which would be a nice further cleanup.

 src/gallium/state_trackers/dri/common/dri_drawable.c | 4 ++--
 src/gallium/state_trackers/dri/drm/dri2.c            | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Marek Olšák Nov. 22, 2013, 1:40 p.m. UTC | #1
Reviewed-by: Marek Olšák <marek.olsak@amd.com>

Marek

On Fri, Nov 22, 2013 at 5:20 AM, Keith Packard <keithp@keithp.com> wrote:
> Upper levels of the stack use base.stamp to tell when a drawable needs to be
> revalidated, but the dri state tracker was using dPriv->lastStamp. Those two,
> along with dri2.stamp, all get simultaneously incremented when a dri2
> invalidate event was delivered, and so end up containing precisely the same
> value.
>
> This patch doesn't change the fact that there are three variables, rather it
> switches all of the tests to use only base.stamp, which is functionally
> equivalent to the previous code.
>
> Then, it passes base.stamp to the image loader getBuffers function so that the
> one which is checked will get updated by the XCB special event queue used by DRI3.
>
> Signed-off-by: Keith Packard <keithp@keithp.com>
> ---
>
> This patch makes sure that drawables get invalidated when the window
> changes size or when SwapBuffers is called; dri3 has only a single
> location to smite when things change, so we need to make sure the
> upper levels all share that location.
>
> This should permit the elimination of the dri2.stamp and lastStamp
> variables, which would be a nice further cleanup.
>
>  src/gallium/state_trackers/dri/common/dri_drawable.c | 4 ++--
>  src/gallium/state_trackers/dri/drm/dri2.c            | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c b/src/gallium/state_trackers/dri/common/dri_drawable.c
> index f255108..734bca2 100644
> --- a/src/gallium/state_trackers/dri/common/dri_drawable.c
> +++ b/src/gallium/state_trackers/dri/common/dri_drawable.c
> @@ -73,7 +73,7 @@ dri_st_framebuffer_validate(struct st_context_iface *stctx,
>      * checked.
>      */
>     do {
> -      lastStamp = drawable->dPriv->lastStamp;
> +      lastStamp = drawable->base.stamp;
>        new_stamp = (drawable->texture_stamp != lastStamp);
>
>        if (new_stamp || new_mask || screen->broken_invalidate) {
> @@ -91,7 +91,7 @@ dri_st_framebuffer_validate(struct st_context_iface *stctx,
>           drawable->texture_stamp = lastStamp;
>           drawable->texture_mask = statt_mask;
>        }
> -   } while (lastStamp != drawable->dPriv->lastStamp);
> +   } while (lastStamp != drawable->base.stamp);
>
>     if (!out)
>        return TRUE;
> diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c
> index 6a56cd4..c7e4151 100644
> --- a/src/gallium/state_trackers/dri/drm/dri2.c
> +++ b/src/gallium/state_trackers/dri/drm/dri2.c
> @@ -545,7 +545,7 @@ dri_image_allocate_textures(struct dri_context *ctx,
>
>     (*sPriv->image.loader->getBuffers) (dPriv,
>                                         image_format,
> -                                       &dPriv->dri2.stamp,
> +                                       (uint32_t *) &drawable->base.stamp,
>                                         dPriv->loaderPrivate,
>                                         buffer_mask,
>                                         &images);
> --
> 1.8.4.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
diff mbox

Patch

diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c b/src/gallium/state_trackers/dri/common/dri_drawable.c
index f255108..734bca2 100644
--- a/src/gallium/state_trackers/dri/common/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/common/dri_drawable.c
@@ -73,7 +73,7 @@  dri_st_framebuffer_validate(struct st_context_iface *stctx,
     * checked.
     */
    do {
-      lastStamp = drawable->dPriv->lastStamp;
+      lastStamp = drawable->base.stamp;
       new_stamp = (drawable->texture_stamp != lastStamp);
 
       if (new_stamp || new_mask || screen->broken_invalidate) {
@@ -91,7 +91,7 @@  dri_st_framebuffer_validate(struct st_context_iface *stctx,
          drawable->texture_stamp = lastStamp;
          drawable->texture_mask = statt_mask;
       }
-   } while (lastStamp != drawable->dPriv->lastStamp);
+   } while (lastStamp != drawable->base.stamp);
 
    if (!out)
       return TRUE;
diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c
index 6a56cd4..c7e4151 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -545,7 +545,7 @@  dri_image_allocate_textures(struct dri_context *ctx,
 
    (*sPriv->image.loader->getBuffers) (dPriv,
                                        image_format,
-                                       &dPriv->dri2.stamp,
+                                       (uint32_t *) &drawable->base.stamp,
                                        dPriv->loaderPrivate,
                                        buffer_mask,
                                        &images);