mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 21:50:12 +01:00
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: d5c857837a ("gallium/dri2: Fix creation of multi-planar modifier images")
Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6449>
This commit is contained in:
parent
7323062a87
commit
36bd3e9868
1 changed files with 4 additions and 14 deletions
|
|
@ -877,7 +877,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;
|
||||
}
|
||||
|
|
@ -894,24 +894,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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue