Mesa (master): ilo: mark some states dirty when they are really changed

Chia-I Wu olv at kemper.freedesktop.org
Fri Jul 12 23:00:14 UTC 2013


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

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Sat Jul 13 05:54:20 2013 +0800

ilo: mark some states dirty when they are really changed

The checks may seem redundant because cso_context handles them, but
util_blitter does not have access to cso_context.

---

 src/gallium/drivers/ilo/ilo_state.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/ilo/ilo_state.c b/src/gallium/drivers/ilo/ilo_state.c
index c679004..070bc28 100644
--- a/src/gallium/drivers/ilo/ilo_state.c
+++ b/src/gallium/drivers/ilo/ilo_state.c
@@ -489,6 +489,10 @@ ilo_bind_gs_state(struct pipe_context *pipe, void *state)
 {
    struct ilo_context *ilo = ilo_context(pipe);
 
+   /* util_blitter may set this unnecessarily */
+   if (ilo->gs == state)
+      return;
+
    ilo->gs = state;
 
    ilo->dirty |= ILO_DIRTY_GS;
@@ -555,6 +559,10 @@ ilo_set_stencil_ref(struct pipe_context *pipe,
 {
    struct ilo_context *ilo = ilo_context(pipe);
 
+   /* util_blitter may set this unnecessarily */
+   if (!memcpy(&ilo->stencil_ref, state, sizeof(*state)))
+      return;
+
    ilo->stencil_ref = *state;
 
    ilo->dirty |= ILO_DIRTY_STENCIL_REF;
@@ -566,6 +574,10 @@ ilo_set_sample_mask(struct pipe_context *pipe,
 {
    struct ilo_context *ilo = ilo_context(pipe);
 
+   /* util_blitter may set this unnecessarily */
+   if (ilo->sample_mask == sample_mask)
+      return;
+
    ilo->sample_mask = sample_mask;
 
    ilo->dirty |= ILO_DIRTY_SAMPLE_MASK;
@@ -954,6 +966,10 @@ ilo_set_stream_output_targets(struct pipe_context *pipe,
    if (!targets)
       num_targets = 0;
 
+   /* util_blitter may set this unnecessarily */
+   if (!ilo->so.count && !num_targets)
+      return;
+
    for (i = 0; i < num_targets; i++)
       pipe_so_target_reference(&ilo->so.states[i], targets[i]);
 




More information about the mesa-commit mailing list