[Mesa-dev] [PATCH 4/4] gallium/swrast: avoid syncing with drawable on unmap (optimisation)

Karl Lessard karl at kubx.ca
Sat Jan 21 04:33:18 UTC 2017


I think that we do not have to force a display/drawable refresh right
after unmapping the front buffer, this could be handled later on when
the pipe is being flushed or buffers are swapped.

Signed-off-by: Karl Lessard <karl at kubx.ca>
---
 src/gallium/winsys/sw/dri/dri_sw_winsys.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/gallium/winsys/sw/dri/dri_sw_winsys.c b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
index f3756f4..7bf77ee 100644
--- a/src/gallium/winsys/sw/dri/dri_sw_winsys.c
+++ b/src/gallium/winsys/sw/dri/dri_sw_winsys.c
@@ -146,16 +146,20 @@ dri_sw_displaytarget_map(struct sw_winsys *ws,
                          unsigned flags)
 {
    struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
+
    dri_sw_dt->mapped = dri_sw_dt->data;
+   dri_sw_dt->map_flags = flags;
 
    if ((dri_sw_dt->usage & PIPE_BIND_DISPLAY_SYNC) && dri_sw_dt->drawable
          && (dri_sw_dt->snapshot_nb != dri_sw_dt->drawable->current_snapshot_nb)) {
       struct dri_sw_winsys *dri_sw_ws = dri_sw_winsys(ws);
-      dri_sw_ws->lf->get_image((void *)dri_sw_dt->drawable->handle, 0, 0, dri_sw_dt->width, dri_sw_dt->height, dri_sw_dt->stride, dri_sw_dt->data);
+
+      dri_sw_ws->lf->get_image((void *)dri_sw_dt->drawable->handle,
+                               0, 0, dri_sw_dt->width, dri_sw_dt->height,
+                               dri_sw_dt->stride, dri_sw_dt->data);
 
       dri_sw_dt->snapshot_nb = dri_sw_dt->drawable->current_snapshot_nb;
    }
-   dri_sw_dt->map_flags = flags;
    return dri_sw_dt->mapped;
 }
 
@@ -165,11 +169,6 @@ dri_sw_displaytarget_unmap(struct sw_winsys *ws,
 {
    struct dri_sw_displaytarget *dri_sw_dt = dri_sw_displaytarget(dt);
    
-   if ((dri_sw_dt->usage & PIPE_BIND_DISPLAY_SYNC) && dri_sw_dt->drawable 
-   		&& (dri_sw_dt->map_flags & PIPE_TRANSFER_WRITE)) {
-      struct dri_sw_winsys *dri_sw_ws = dri_sw_winsys(ws);
-      dri_sw_ws->lf->put_image2((void *)dri_sw_dt->drawable->handle, dri_sw_dt->data, 0, 0, dri_sw_dt->width, dri_sw_dt->height, dri_sw_dt->stride);
-   }
    dri_sw_dt->map_flags = 0;
    dri_sw_dt->mapped = NULL;
 }
-- 
2.7.4



More information about the mesa-dev mailing list