mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-22 22:10:10 +01:00
broadcom/vc4: Don't advertise tiled dmabuf modifiers if we can't use them
If the DRM_VC4_GET_TILING ioctl isn't present then we can't tell if a dmabuf bo is tiled or linear, so will always assume it's linear. By not advertising tiled formats in this situation we ensure the assumption is correct. This fixes a bug where most attempts to render a gl wayland client under weston will result in a client side abort. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Reviewed-by: Eric Anholt <eric@anholt.net> Acked-by: Daniel Stone <daniels@collabora.com> (on irc)
This commit is contained in:
parent
b174a1ae72
commit
17d78ece36
1 changed files with 18 additions and 13 deletions
|
|
@ -549,25 +549,30 @@ vc4_screen_query_dmabuf_modifiers(struct pipe_screen *pscreen,
|
||||||
unsigned int *external_only,
|
unsigned int *external_only,
|
||||||
int *count)
|
int *count)
|
||||||
{
|
{
|
||||||
|
int m, i;
|
||||||
|
uint64_t available_modifiers[] = {
|
||||||
|
DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED,
|
||||||
|
DRM_FORMAT_MOD_LINEAR,
|
||||||
|
};
|
||||||
|
struct vc4_screen *screen = vc4_screen(pscreen);
|
||||||
|
int num_modifiers = screen->has_tiling_ioctl ? 2 : 1;
|
||||||
|
|
||||||
if (!modifiers) {
|
if (!modifiers) {
|
||||||
*count = 2;
|
*count = num_modifiers;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
*count = MIN2(max, 2);
|
*count = MIN2(max, num_modifiers);
|
||||||
|
m = screen->has_tiling_ioctl ? 0 : 1;
|
||||||
/* We support both modifiers (tiled and linear) for all sampler
|
/* We support both modifiers (tiled and linear) for all sampler
|
||||||
* formats.
|
* formats, but if we don't have the DRM_VC4_GET_TILING ioctl
|
||||||
|
* we shouldn't advertise the tiled formats.
|
||||||
*/
|
*/
|
||||||
modifiers[0] = DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED;
|
for (i = 0; i < *count; i++) {
|
||||||
if (external_only)
|
modifiers[i] = available_modifiers[m++];
|
||||||
external_only[0] = false;
|
if (external_only)
|
||||||
if (max < 2)
|
external_only[i] = false;
|
||||||
return;
|
}
|
||||||
|
|
||||||
modifiers[1] = DRM_FORMAT_MOD_LINEAR;
|
|
||||||
if (external_only)
|
|
||||||
external_only[1] = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PTR_TO_UINT(x) ((unsigned)((intptr_t)(x)))
|
#define PTR_TO_UINT(x) ((unsigned)((intptr_t)(x)))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue