diff options
author | Eric Anholt <[email protected]> | 2019-04-29 15:38:24 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2019-05-13 12:03:08 -0700 |
commit | 0c31fe9ee743f699bcabcb638ccc83e515f0d1bd (patch) | |
tree | 7a8e3fba596796d27e75bc40ba110c24a13c0dec /src/gallium/drivers | |
parent | f33cb272f0890f115c36fb96173123bc699b7b2c (diff) |
gallium: Redefine the max texture 2d cap from _LEVELS to _SIZE.
The _LEVELS assumes that the max is always power of two. For V3D 4.2, we
can support up to 7680 non-power-of-two MSAA textures, which will let X11
support dual 4k displays on newer hardware.
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
22 files changed, 59 insertions, 47 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c index 62b6f1c80fa..ce3147a7011 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c @@ -318,7 +318,8 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return 255; /* Texturing. */ - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: + case PIPE_CAP_MAX_TEXTURE_2D_SIZE: + return screen->specs.max_texture_size; case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: { int log2_max_tex_size = util_last_bit(screen->specs.max_texture_size); diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index 889737ae30c..0ec0ad996dc 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -371,7 +371,8 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return 0; /* Texturing. */ - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: + case PIPE_CAP_MAX_TEXTURE_2D_SIZE: + return 1 << (MAX_MIP_LEVELS - 1); case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: return MAX_MIP_LEVELS; case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 78707c66e62..d95b0696845 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -365,12 +365,12 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap) return is->debug.lie ? 1 : 0; /* Texturing. */ - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: - return I915_MAX_TEXTURE_2D_LEVELS; + case PIPE_CAP_MAX_TEXTURE_2D_SIZE: + return 1 << (I915_MAX_TEXTURE_2D_LEVELS - 1); case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: return I915_MAX_TEXTURE_3D_LEVELS; case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: - return I915_MAX_TEXTURE_2D_LEVELS; + return 1 << (I915_MAX_TEXTURE_2D_LEVELS - 1); case PIPE_CAP_MIN_TEXEL_OFFSET: case PIPE_CAP_MAX_TEXEL_OFFSET: case PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET: diff --git a/src/gallium/drivers/iris/iris_screen.c b/src/gallium/drivers/iris/iris_screen.c index 4fd3e040a45..e01fd1b74aa 100644 --- a/src/gallium/drivers/iris/iris_screen.c +++ b/src/gallium/drivers/iris/iris_screen.c @@ -202,7 +202,8 @@ iris_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return 1; case PIPE_CAP_MAX_RENDER_TARGETS: return BRW_MAX_DRAW_BUFFERS; - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: + case PIPE_CAP_MAX_TEXTURE_2D_SIZE: + return 16384; case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: return IRIS_MAX_MIPLEVELS; /* 16384x16384 */ case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: diff --git a/src/gallium/drivers/lima/lima_screen.c b/src/gallium/drivers/lima/lima_screen.c index 31478c76f34..7cced495696 100644 --- a/src/gallium/drivers/lima/lima_screen.c +++ b/src/gallium/drivers/lima/lima_screen.c @@ -119,7 +119,8 @@ lima_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_TGSI_FS_POSITION_IS_SYSVAL: return 1; - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: + case PIPE_CAP_MAX_TEXTURE_2D_SIZE: + return 1 << (LIMA_MAX_MIP_LEVELS - 1); case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: return LIMA_MAX_MIP_LEVELS; diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 510346d2abf..551d71e00e0 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -140,8 +140,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK: case PIPE_CAP_MAX_TEXTURE_UPLOAD_MEMORY_BUDGET: return 0; - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: - return LP_MAX_TEXTURE_2D_LEVELS; + case PIPE_CAP_MAX_TEXTURE_2D_SIZE: + return 1 << (LP_MAX_TEXTURE_2D_LEVELS - 1); case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: return LP_MAX_TEXTURE_3D_LEVELS; case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c index b5dc033bd2d..a65e4d57903 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c @@ -58,8 +58,8 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) /* non-boolean capabilities */ case PIPE_CAP_MAX_RENDER_TARGETS: return (eng3d->oclass >= NV40_3D_CLASS) ? 4 : 1; - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: - return 13; + case PIPE_CAP_MAX_TEXTURE_2D_SIZE: + return 4096; case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: return 10; case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c index 6c865d75f6d..e1cf4485ff7 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c @@ -94,8 +94,8 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) switch (param) { /* non-boolean caps */ - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: - return 14; + case PIPE_CAP_MAX_TEXTURE_2D_SIZE: + return 8192; case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: return 12; case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c index fe80c7e9103..5c2d50ef559 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c @@ -112,7 +112,8 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) switch (param) { /* non-boolean caps */ - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: + case PIPE_CAP_MAX_TEXTURE_2D_SIZE: + return 16384; case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: return 15; case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index 10e9ee21576..b24bdffc2da 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -117,7 +117,8 @@ panfrost_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR: return 1; - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: + case PIPE_CAP_MAX_TEXTURE_2D_SIZE: + return 4096; case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: return 13; diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index be0b475e5ef..5c1d37eef6c 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -286,7 +286,8 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param) return 0; /* Texturing. */ - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: + case PIPE_CAP_MAX_TEXTURE_2D_SIZE: + return is_r500 ? 4096 : 2048; case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: /* 13 == 4096, 12 == 2048 */ diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c index 41a878ab9d2..5c915e0f91a 100644 --- a/src/gallium/drivers/r600/r600_pipe.c +++ b/src/gallium/drivers/r600/r600_pipe.c @@ -497,7 +497,11 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param) return 2048; /* Texturing. */ - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: + case PIPE_CAP_MAX_TEXTURE_2D_SIZE: + if (family >= CHIP_CEDAR) + return 16384; + else + return 8192; case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: if (family >= CHIP_CEDAR) return 15; diff --git a/src/gallium/drivers/r600/r600_test_dma.c b/src/gallium/drivers/r600/r600_test_dma.c index af86ad386f6..512e7742021 100644 --- a/src/gallium/drivers/r600/r600_test_dma.c +++ b/src/gallium/drivers/r600/r600_test_dma.c @@ -177,11 +177,10 @@ void r600_test_dma(struct r600_common_screen *rscreen) struct pipe_context *ctx = screen->context_create(screen, NULL, 0); struct r600_common_context *rctx = (struct r600_common_context*)ctx; uint64_t max_alloc_size; - unsigned i, iterations, num_partial_copies, max_levels, max_tex_side; + unsigned i, iterations, num_partial_copies, max_tex_side; unsigned num_pass = 0, num_fail = 0; - max_levels = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS); - max_tex_side = 1 << (max_levels - 1); + max_tex_side = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_SIZE); /* Max 128 MB allowed for both textures. */ max_alloc_size = 128 * 1024 * 1024; diff --git a/src/gallium/drivers/radeonsi/si_get.c b/src/gallium/drivers/radeonsi/si_get.c index eb23d4fe88a..d97aca1de23 100644 --- a/src/gallium/drivers/radeonsi/si_get.c +++ b/src/gallium/drivers/radeonsi/si_get.c @@ -276,7 +276,8 @@ static int si_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return 2048; /* Texturing. */ - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: + case PIPE_CAP_MAX_TEXTURE_2D_SIZE: + return 16384; case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: return 15; /* 16384 */ case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: diff --git a/src/gallium/drivers/radeonsi/si_test_dma.c b/src/gallium/drivers/radeonsi/si_test_dma.c index 7e396e671be..effdd9e82c1 100644 --- a/src/gallium/drivers/radeonsi/si_test_dma.c +++ b/src/gallium/drivers/radeonsi/si_test_dma.c @@ -192,11 +192,10 @@ void si_test_dma(struct si_screen *sscreen) struct pipe_context *ctx = screen->context_create(screen, NULL, 0); struct si_context *sctx = (struct si_context*)ctx; uint64_t max_alloc_size; - unsigned i, iterations, num_partial_copies, max_levels, max_tex_side; + unsigned i, iterations, num_partial_copies, max_tex_side; unsigned num_pass = 0, num_fail = 0; - max_levels = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS); - max_tex_side = 1 << (max_levels - 1); + max_tex_side = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_SIZE); /* Max 128 MB allowed for both textures. */ max_alloc_size = 128 * 1024 * 1024; diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 5d44824e202..b1b777b4755 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -95,8 +95,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK: case PIPE_CAP_MAX_TEXTURE_UPLOAD_MEMORY_BUDGET: return 0; - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: - return SP_MAX_TEXTURE_2D_LEVELS; + case PIPE_CAP_MAX_TEXTURE_2D_SIZE: + return 1 << (SP_MAX_TEXTURE_2D_LEVELS - 1); case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: return SP_MAX_TEXTURE_3D_LEVELS; case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index 998939bdf30..075d322f802 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -92,13 +92,10 @@ sp_create_tile_cache( struct pipe_context *pipe ) { struct softpipe_tile_cache *tc; uint pos; - MAYBE_UNUSED int maxTexSize; - int maxLevels; /* sanity checking: max sure MAX_WIDTH/HEIGHT >= largest texture image */ - maxLevels = pipe->screen->get_param(pipe->screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS); - maxTexSize = 1 << (maxLevels - 1); - assert(MAX_WIDTH >= maxTexSize); + assert(MAX_WIDTH >= pipe->screen->get_param(pipe->screen, + PIPE_CAP_MAX_TEXTURE_2D_SIZE)); STATIC_ASSERT(sizeof(union tile_address) == 4); diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index f747ff78bcf..02c1a99b2db 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -221,18 +221,18 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT: return 256; - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: + case PIPE_CAP_MAX_TEXTURE_2D_SIZE: { - unsigned levels = SVGA_MAX_TEXTURE_LEVELS; + unsigned size = 1 << (SVGA_MAX_TEXTURE_LEVELS - 1); if (sws->get_cap(sws, SVGA3D_DEVCAP_MAX_TEXTURE_WIDTH, &result)) - levels = MIN2(util_logbase2(result.u) + 1, levels); + size = MIN2(result.u, size); else - levels = 12 /* 2048x2048 */; + size = 2048; if (sws->get_cap(sws, SVGA3D_DEVCAP_MAX_TEXTURE_HEIGHT, &result)) - levels = MIN2(util_logbase2(result.u) + 1, levels); + size = MIN2(result.u, size); else - levels = 12 /* 2048x2048 */; - return levels; + size = 2048; + return size; } case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: @@ -245,7 +245,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param) * No mechanism to query the host, and at least limited to 2048x2048 on * certain hardware. */ - return MIN2(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS), + return MIN2(util_last_bit(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_SIZE)), 12 /* 2048x2048 */); case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS: diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp index 3a2a6133127..0b1347793f5 100644 --- a/src/gallium/drivers/swr/swr_screen.cpp +++ b/src/gallium/drivers/swr/swr_screen.cpp @@ -52,7 +52,7 @@ * XXX Check max texture size values against core and sampler. */ #define SWR_MAX_TEXTURE_SIZE (2 * 1024 * 1024 * 1024ULL) /* 2GB */ -#define SWR_MAX_TEXTURE_2D_LEVELS 14 /* 8K x 8K for now */ +#define SWR_MAX_TEXTURE_2D_SIZE 8192 #define SWR_MAX_TEXTURE_3D_LEVELS 12 /* 2K x 2K x 2K for now */ #define SWR_MAX_TEXTURE_CUBE_LEVELS 14 /* 8K x 8K for now */ #define SWR_MAX_TEXTURE_ARRAY_LAYERS 512 /* 8K x 512 / 8K x 8K x 512 */ @@ -162,8 +162,8 @@ swr_get_param(struct pipe_screen *screen, enum pipe_cap param) /* limits */ case PIPE_CAP_MAX_RENDER_TARGETS: return PIPE_MAX_COLOR_BUFS; - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: - return SWR_MAX_TEXTURE_2D_LEVELS; + case PIPE_CAP_MAX_TEXTURE_2D_SIZE: + return SWR_MAX_TEXTURE_2D_SIZE; case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: return SWR_MAX_TEXTURE_3D_LEVELS; case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: diff --git a/src/gallium/drivers/v3d/v3d_screen.c b/src/gallium/drivers/v3d/v3d_screen.c index 6a2dc15179d..e902be05474 100644 --- a/src/gallium/drivers/v3d/v3d_screen.c +++ b/src/gallium/drivers/v3d/v3d_screen.c @@ -205,7 +205,11 @@ v3d_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return V3D_MAX_FS_INPUTS / 4; /* Texturing. */ - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: + case PIPE_CAP_MAX_TEXTURE_2D_SIZE: + if (screen->devinfo.ver < 40) + return 2048; + else + return 4096; case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: if (screen->devinfo.ver < 40) diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c index 5fc8c35f8a9..a9441d7ceb0 100644 --- a/src/gallium/drivers/vc4/vc4_screen.c +++ b/src/gallium/drivers/vc4/vc4_screen.c @@ -171,7 +171,8 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return 1; /* Texturing. */ - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: + case PIPE_CAP_MAX_TEXTURE_2D_SIZE: + return 2048; case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: return VC4_MAX_MIP_LEVELS; case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c index 65106dbb616..66cb6b7a219 100644 --- a/src/gallium/drivers/virgl/virgl_screen.c +++ b/src/gallium/drivers/virgl/virgl_screen.c @@ -82,10 +82,10 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param) return vscreen->caps.caps.v1.bset.mirror_clamp; case PIPE_CAP_TEXTURE_SWIZZLE: return 1; - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: + case PIPE_CAP_MAX_TEXTURE_2D_SIZE: if (vscreen->caps.caps.v2.max_texture_2d_size) - return 1 + util_logbase2(vscreen->caps.caps.v2.max_texture_2d_size); - return 15; /* 16K x 16K */ + return vscreen->caps.caps.v2.max_texture_2d_size; + return 16384; case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: if (vscreen->caps.caps.v2.max_texture_3d_size) return 1 + util_logbase2(vscreen->caps.caps.v2.max_texture_3d_size); |