Skip to content

Commit 7154d76

Browse files
committed
drm/vc4: Add support for rendering with ETC1 textures.
The validation for it ends up being quite simple, but I hadn't got around to it before merging the driver. For backwards compatibility, we also need to add a flag so that the userspace GL driver can easily tell if the kernel will allow ETC1 textures (on an old kernel, it will continue to convert to RGBA8) Signed-off-by: Eric Anholt <eric@anholt.net>
1 parent 457e67a commit 7154d76

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

‎drivers/gpu/drm/vc4/vc4_drv.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ static int vc4_get_param_ioctl(struct drm_device *dev, void *data,
7878
pm_runtime_put(&vc4->v3d->pdev->dev);
7979
break;
8080
case DRM_VC4_PARAM_SUPPORTS_BRANCHES:
81+
case DRM_VC4_PARAM_SUPPORTS_ETC1:
8182
args->value = true;
8283
break;
8384
default:

‎drivers/gpu/drm/vc4/vc4_validate.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,13 @@ reloc_tex(struct vc4_exec_info *exec,
644644
cpp = 1;
645645
break;
646646
case VC4_TEXTURE_TYPE_ETC1:
647+
/* ETC1 is arranged as 64-bit blocks, where each block is 4x4
648+
* pixels.
649+
*/
650+
cpp = 8;
651+
width = (width + 3) >> 2;
652+
height = (height + 3) >> 2;
653+
break;
647654
case VC4_TEXTURE_TYPE_BW1:
648655
case VC4_TEXTURE_TYPE_A4:
649656
case VC4_TEXTURE_TYPE_A1:

‎include/uapi/drm/vc4_drm.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ struct drm_vc4_get_hang_state {
286286
#define DRM_VC4_PARAM_V3D_IDENT1 1
287287
#define DRM_VC4_PARAM_V3D_IDENT2 2
288288
#define DRM_VC4_PARAM_SUPPORTS_BRANCHES 3
289+
#define DRM_VC4_PARAM_SUPPORTS_ETC1 4
289290

290291
struct drm_vc4_get_param {
291292
__u32 param;

0 commit comments

Comments
 (0)