1 From 4b1b99ebbada744ef72af56b022492609feb9bba Mon Sep 17 00:00:00 2001
2 From: Eric Anholt <eric@anholt.net>
3 Date: Thu, 3 Nov 2016 18:53:10 -0700
4 Subject: [PATCH] drm/vc4: Add support for rendering with ETC1 textures.
6 The validation for it ends up being quite simple, but I hadn't got
7 around to it before merging the driver. For backwards compatibility,
8 we also need to add a flag so that the userspace GL driver can easily
9 tell if the kernel will allow ETC1 textures (on an old kernel, it will
10 continue to convert to RGBA8)
12 Signed-off-by: Eric Anholt <eric@anholt.net>
13 (cherry picked from commit 7154d76fedf549607afbc0d13db9aaf02da5cebf)
15 drivers/gpu/drm/vc4/vc4_drv.c | 1 +
16 drivers/gpu/drm/vc4/vc4_validate.c | 7 +++++++
17 include/uapi/drm/vc4_drm.h | 1 +
18 3 files changed, 9 insertions(+)
20 --- a/drivers/gpu/drm/vc4/vc4_drv.c
21 +++ b/drivers/gpu/drm/vc4/vc4_drv.c
22 @@ -78,6 +78,7 @@ static int vc4_get_param_ioctl(struct dr
23 pm_runtime_put(&vc4->v3d->pdev->dev);
25 case DRM_VC4_PARAM_SUPPORTS_BRANCHES:
26 + case DRM_VC4_PARAM_SUPPORTS_ETC1:
30 --- a/drivers/gpu/drm/vc4/vc4_validate.c
31 +++ b/drivers/gpu/drm/vc4/vc4_validate.c
32 @@ -644,6 +644,13 @@ reloc_tex(struct vc4_exec_info *exec,
35 case VC4_TEXTURE_TYPE_ETC1:
36 + /* ETC1 is arranged as 64-bit blocks, where each block is 4x4
40 + width = (width + 3) >> 2;
41 + height = (height + 3) >> 2;
43 case VC4_TEXTURE_TYPE_BW1:
44 case VC4_TEXTURE_TYPE_A4:
45 case VC4_TEXTURE_TYPE_A1:
46 --- a/include/uapi/drm/vc4_drm.h
47 +++ b/include/uapi/drm/vc4_drm.h
48 @@ -286,6 +286,7 @@ struct drm_vc4_get_hang_state {
49 #define DRM_VC4_PARAM_V3D_IDENT1 1
50 #define DRM_VC4_PARAM_V3D_IDENT2 2
51 #define DRM_VC4_PARAM_SUPPORTS_BRANCHES 3
52 +#define DRM_VC4_PARAM_SUPPORTS_ETC1 4
54 struct drm_vc4_get_param {