iris: finish aux import on get_param
authorJames Xiong <james.xiong@intel.com>
Mon, 14 Oct 2019 22:55:18 +0000 (15:55 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 15 Oct 2019 23:19:04 +0000 (23:19 +0000)
A buffer and its aux are imported separately, if the aux import is
not completed yet when resource_get_param is called, merge the
separate aux a.k.a the 2nd image into the main image.

Fixes: 246eebba4a8 ("iris: Export and import surfaces with modifiers that have aux data")
Signed-off-by: James Xiong <james.xiong@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
src/gallium/drivers/iris/iris_resource.c

index cfdd43c6e2179fce2abfd1a1a4674324d399c5e0..cd411c3e6b8d2e384521f7c498c14e703cf769ca 100644 (file)
@@ -1078,10 +1078,14 @@ iris_resource_get_param(struct pipe_screen *screen,
    bool mod_with_aux =
       res->mod_info && res->mod_info->aux_usage != ISL_AUX_USAGE_NONE;
    bool wants_aux = mod_with_aux && plane > 0;
-   struct iris_bo *bo = wants_aux ? res->aux.bo : res->bo;
    bool result;
    unsigned handle;
 
+   if (iris_resource_unfinished_aux_import(res))
+      iris_resource_finish_aux_import(screen, res);
+
+   struct iris_bo *bo = wants_aux ? res->aux.bo : res->bo;
+
    iris_resource_disable_aux_on_first_query(resource, handle_usage);
 
    switch (param) {