Mesa (master): gallium: check all planes' pipe formats in case of multi-samplers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 21 23:39:09 UTC 2020


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

Author: Dongwon Kim <dongwon.kim at intel.com>
Date:   Tue Jan 14 20:01:41 2020 -0800

gallium: check all planes' pipe formats in case of multi-samplers

Current code only checks whether first plane's format is supported
in case YUV format sampling is done by sampling each plane separately.
It would be safer to check other planes' as well.

Signed-off-by: Dongwon Kim <dongwon.kim at intel.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Reviewed-by: Daniel Stone <daniels at collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2863>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2863>

---

 src/gallium/state_trackers/dri/dri2.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index e6f0e40465a..82c57b78d99 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -751,14 +751,19 @@ dri2_create_image_from_winsys(__DRIscreen *_screen,
       /* YUV format sampling can be emulated by the Mesa state tracker by
        * using multiple samplers of varying formats.
        * If no tex_usage is set and we detect a YUV format,
-       * test for support of the first plane's sampler format and
+       * test for support of all planes' sampler formats and
        * add sampler view usage.
        */
       use_lowered = true;
-      if (pscreen->is_format_supported(pscreen,
-                                       dri2_get_pipe_format_for_dri_format(map->planes[0].dri_format),
-                                       screen->target, 0, 0,
-                                       PIPE_BIND_SAMPLER_VIEW))
+      for (i = 0; i < map->nplanes; i++) {
+          if (!pscreen->is_format_supported(pscreen,
+                                            dri2_get_pipe_format_for_dri_format(map->planes[i].dri_format),
+                                            screen->target, 0, 0,
+                                            PIPE_BIND_SAMPLER_VIEW))
+             break;
+      }
+
+      if (i == map->nplanes)
          tex_usage |= PIPE_BIND_SAMPLER_VIEW;
    }
 



More information about the mesa-commit mailing list