Mesa (master): ilo: set ILO_TEXTURE_CPU_WRITE for imported textures

Chia-I Wu olv at kemper.freedesktop.org
Sat Feb 22 14:48:33 UTC 2014


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

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Tue Jan 14 23:35:43 2014 +0800

ilo: set ILO_TEXTURE_CPU_WRITE for imported textures

Assume the bo has been written by another process, which will trigger a HiZ
resolve.

---

 src/gallium/drivers/ilo/ilo_resource.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/ilo/ilo_resource.c b/src/gallium/drivers/ilo/ilo_resource.c
index f9a5331..f6d3f74 100644
--- a/src/gallium/drivers/ilo/ilo_resource.c
+++ b/src/gallium/drivers/ilo/ilo_resource.c
@@ -1133,6 +1133,7 @@ tex_create_hiz(struct ilo_texture *tex, const struct tex_layout *layout)
     */
    for (lv = 0; lv <= templ->last_level; lv++) {
       unsigned align_w = 8, align_h = 4;
+      unsigned flags = 0;
 
       switch (templ->nr_samples) {
       case 0:
@@ -1154,11 +1155,17 @@ tex_create_hiz(struct ilo_texture *tex, const struct tex_layout *layout)
 
       if (u_minify(templ->width0, lv) % align_w == 0 &&
           u_minify(templ->height0, lv) % align_h == 0) {
+         flags |= ILO_TEXTURE_HIZ;
+
+         /* this will trigger a HiZ resolve */
+         if (tex->imported)
+            flags |= ILO_TEXTURE_CPU_WRITE;
+      }
+
+      if (flags) {
          const unsigned num_slices = (templ->target == PIPE_TEXTURE_3D) ?
             u_minify(templ->depth0, lv) : templ->array_size;
-
-         ilo_texture_set_slice_flags(tex, lv, 0, num_slices,
-               ILO_TEXTURE_HIZ, ILO_TEXTURE_HIZ);
+         ilo_texture_set_slice_flags(tex, lv, 0, num_slices, flags, flags);
       }
    }
 




More information about the mesa-commit mailing list