From 894627ec890e150498f6e3ccd780873271545041 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 10 Aug 2021 13:41:28 -0400 Subject: [PATCH] panfrost: Raise maximum texture size The hardware can handle much larger textures than we allowed. The game "Cathedral" requires larger textures for some bizarre reason. Raise the limit so the game runs, syncing MAX_MIP_LEVELS, the comments, and the CAPs. Signed-off-by: Alyssa Rosenzweig Closes: #5203 Cc: mesa-stable Part-of: (cherry picked from commit d051b06a484f4fadd6a71cdd580c76ddb93c597f) --- .pick_status.json | 2 +- src/gallium/drivers/panfrost/pan_screen.c | 6 +++--- src/panfrost/include/panfrost-job.h | 7 +++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 8a89a589836..9a8cae96778 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1417,7 +1417,7 @@ "description": "panfrost: Raise maximum texture size", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index 432351ba72d..593f158087d 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -218,11 +218,11 @@ panfrost_get_param(struct pipe_screen *screen, enum pipe_cap param) return 1; case PIPE_CAP_MAX_TEXTURE_2D_SIZE: - return 4096; + return 1 << (MAX_MIP_LEVELS - 1); + case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: - return 13; case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: - return 13; + return MAX_MIP_LEVELS; case PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT: /* Hardware is natively upper left */ diff --git a/src/panfrost/include/panfrost-job.h b/src/panfrost/include/panfrost-job.h index f585d9ebd23..31550a15995 100644 --- a/src/panfrost/include/panfrost-job.h +++ b/src/panfrost/include/panfrost-job.h @@ -232,8 +232,11 @@ typedef uint64_t mali_ptr; #define MALI_POSITIVE(dim) (dim - 1) -/* 8192x8192 */ -#define MAX_MIP_LEVELS (13) +/* Mali hardware can texture up to 65536 x 65536 x 65536 and render up to 16384 + * x 16384, but 8192 x 8192 should be enough for anyone. The OpenGL game + * "Cathedral" requires a texture of width 8192 to start. + */ +#define MAX_MIP_LEVELS (14) /* Cubemap bloats everything up */ #define MAX_CUBE_FACES (6)