Mesa (staging/20.1): gallium/dri2: Report correct YUYV and UYVY plane count

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Aug 27 22:05:35 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: 99baa878f603cc372b55a56edf17c3717482a3ed
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=99baa878f603cc372b55a56edf17c3717482a3ed

Author: Nanley Chery <nanley.g.chery at intel.com>
Date:   Fri Jul 24 18:20:52 2020 -0700

gallium/dri2: Report correct YUYV and UYVY plane count

Return the actual number of planes in these formats (one) instead of the
number of planes used for lowering (two).

Fixes: d5c857837aa ("gallium/dri2: Fix creation of multi-planar modifier images")
Acked-by: Anuj Phogat <anuj.phogat at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6449>
(cherry picked from commit 36bd3e986830bbf7435389cdd68e593b8b43f234)

---

 .pick_status.json                     |  2 +-
 src/gallium/state_trackers/dri/dri2.c | 18 ++++--------------
 2 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 446feda2e04..63f2211e8df 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -400,7 +400,7 @@
         "description": "gallium/dri2: Report correct YUYV and UYVY plane count",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "d5c857837aae205c0e1fddee30300b4419e2bb3f"
     },
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index ec78d0985ed..d2032dc1e12 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -868,7 +868,7 @@ dri2_get_modifier_num_planes(uint64_t modifier, int fourcc)
    case I915_FORMAT_MOD_X_TILED:
    case I915_FORMAT_MOD_Y_TILED:
    case DRM_FORMAT_MOD_INVALID:
-      return map->nplanes;
+      return util_format_get_num_planes(map->pipe_format);
    default:
       return 0;
    }
@@ -885,24 +885,14 @@ dri2_create_image_from_fd(__DRIscreen *_screen,
    const struct dri2_format_mapping *map = dri2_get_mapping_by_fourcc(fourcc);
    __DRIimage *img = NULL;
    unsigned err = __DRI_IMAGE_ERROR_SUCCESS;
-   int i, expected_num_fds;
-   int num_handles = dri2_get_modifier_num_planes(modifier, fourcc);
+   int i;
+   const int expected_num_fds = dri2_get_modifier_num_planes(modifier, fourcc);
 
-   if (!map || num_handles == 0) {
+   if (!map || expected_num_fds == 0) {
       err = __DRI_IMAGE_ERROR_BAD_MATCH;
       goto exit;
    }
 
-   switch (fourcc) {
-   case DRM_FORMAT_YUYV:
-   case DRM_FORMAT_UYVY:
-      expected_num_fds = 1;
-      break;
-   default:
-      expected_num_fds = num_handles;
-      break;
-   }
-
    if (num_fds != expected_num_fds) {
       err = __DRI_IMAGE_ERROR_BAD_MATCH;
       goto exit;



More information about the mesa-commit mailing list