iris: Fix assertion in iris_resource_from_handle() tiling usage
authorRhys Kidd <rhyskidd@gmail.com>
Mon, 17 Dec 2018 06:25:11 +0000 (01:25 -0500)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:11 +0000 (10:26 -0800)
Assertion error:

  iris_resource_from_handle: Assertion `res->bo->tiling_mode ==
      isl_tiling_to_i915_tiling(res->surf.tiling)' failed.

This patch fixes 16 piglit tests on KBL:
glx/glx-multithread-texture
glx/glx-query-drawable-glx_fbconfig_id-glxpbuffer
glx/glx-query-drawable-glx_fbconfig_id-glxpixmap
glx/glx-query-drawable-glx_preserved_contents
glx/glx-query-drawable-glxpbuffer-glx_height
glx/glx-query-drawable-glxpbuffer-glx_width
glx/glx-query-drawable-glxpixmap-glx_height
glx/glx-query-drawable-glxpixmap-glx_width
glx/glx-swap-pixmap
glx/glx-swap-pixmap-bad
glx/glx-tfp
glx/glx-visuals-depth -pixmap
glx/glx-visuals-stencil -pixmap
spec/egl 1.4/eglcreatepbuffersurface and then glclear
spec/egl 1.4/largest possible eglcreatepbuffersurface and then glclear
spec/egl_nok_texture_from_pixmap/basic

Cc: Kenneth Graunke <kenneth@whitecape.org>
Cc: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
src/gallium/drivers/iris/iris_resource.c

index 3b8b0f51101478207363b992d6a18cc2960febfd..1117ebec15d2579c26dd2be515259e109ad6d55e 100644 (file)
@@ -465,8 +465,7 @@ iris_resource_from_handle(struct pipe_screen *pscreen,
       isl_drm_modifier_get_info(modifier);
    assert(mod_info);
 
-   // XXX: usage...
-   isl_surf_usage_flags_t isl_usage = ISL_SURF_USAGE_DISPLAY_BIT;
+   isl_surf_usage_flags_t isl_usage = pipe_bind_to_isl_usage(templ->bind);
 
    const struct iris_format_info fmt =
       iris_format_for_usage(devinfo, templ->format, isl_usage);