Fix for vc4/Raspberry Pi

This commit is contained in:
Peter Robinson 2017-10-11 16:48:21 +01:00
parent 650dc1f8a8
commit 8c5aa4596e
2 changed files with 53 additions and 1 deletions

View file

@ -59,7 +59,7 @@
Name: mesa
Summary: Mesa graphics libraries
Version: 17.2.2
Release: 3%{?rctag:.%{rctag}}%{?dist}
Release: 4%{?rctag:.%{rctag}}%{?dist}
License: MIT
URL: http://www.mesa3d.org
@ -78,6 +78,7 @@ Patch1: 0001-llvm-SONAME-without-version.patch
Patch2: 0002-hardware-gloat.patch
Patch3: 0003-evergreen-big-endian.patch
Patch4: 0004-bigendian-assert.patch
Patch5: vc4-Don-t-advertise-tiled-dmabuf-modifiers-if-we-can-t-use-them.patch
# glvnd support patches
# non-upstreamed ones
@ -693,6 +694,9 @@ popd
%endif
%changelog
* Wed Oct 11 2017 Peter Robinson <pbrobinson@fedoraproject.org> 17.2.2-4
- Fix for vc4/Raspberry Pi
* Mon Oct 09 2017 Dave Airlie <airlied@redhat.com> - 17.2.2-3
- enable vulkan on 32-bit x86

View file

@ -0,0 +1,48 @@
diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
index 5743e13045..b39cc744e6 100644
--- a/src/gallium/drivers/vc4/vc4_screen.c
+++ b/src/gallium/drivers/vc4/vc4_screen.c
@@ -549,25 +549,30 @@ vc4_screen_query_dmabuf_modifiers(struct pipe_screen *pscreen,
unsigned int *external_only,
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) {
- *count = 2;
+ *count = num_modifiers;
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
- * 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;
- if (external_only)
- external_only[0] = false;
- if (max < 2)
- return;
-
- modifiers[1] = DRM_FORMAT_MOD_LINEAR;
- if (external_only)
- external_only[1] = false;
+ for (i = 0; i < *count; i++) {
+ modifiers[i] = available_modifiers[m++];
+ if (external_only)
+ external_only[i] = false;
+ }
}
#define PTR_TO_UINT(x) ((unsigned)((intptr_t)(x)))