mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
i965/screen: Refactor query_dma_buf_formats
This reworks it to work like query_dma_buf_modifiers and, in particular, makes it more flexible so that we can disallow a non-static set of formats. Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> (cherry picked from commit 8c4c5a09c076832328b6f926c043dbbf8708d0b8)
This commit is contained in:
parent
c2e44a3540
commit
47e22895eb
1 changed files with 12 additions and 10 deletions
|
|
@ -1259,20 +1259,22 @@ static GLboolean
|
|||
intel_query_dma_buf_formats(__DRIscreen *screen, int max,
|
||||
int *formats, int *count)
|
||||
{
|
||||
int i, j = 0;
|
||||
int num_formats = 0, i;
|
||||
|
||||
if (max == 0) {
|
||||
*count = ARRAY_SIZE(intel_image_formats) - 1; /* not SARGB */
|
||||
return true;
|
||||
}
|
||||
|
||||
for (i = 0; i < (ARRAY_SIZE(intel_image_formats)) && j < max; i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(intel_image_formats); i++) {
|
||||
if (intel_image_formats[i].fourcc == __DRI_IMAGE_FOURCC_SARGB8888)
|
||||
continue;
|
||||
formats[j++] = intel_image_formats[i].fourcc;
|
||||
continue;
|
||||
|
||||
num_formats++;
|
||||
if (max == 0)
|
||||
continue;
|
||||
|
||||
formats[num_formats - 1] = intel_image_formats[i].fourcc;
|
||||
if (num_formats >= max)
|
||||
break;
|
||||
}
|
||||
|
||||
*count = j;
|
||||
*count = num_formats;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue