aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2019-04-29 15:38:24 -0700
committerEric Anholt <[email protected]>2019-05-13 12:03:08 -0700
commit0c31fe9ee743f699bcabcb638ccc83e515f0d1bd (patch)
tree7a8e3fba596796d27e75bc40ba110c24a13c0dec /src/gallium/state_trackers
parentf33cb272f0890f115c36fb96173123bc699b7b2c (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/state_trackers')
-rw-r--r--src/gallium/state_trackers/clover/core/device.cpp3
-rw-r--r--src/gallium/state_trackers/nine/adapter9.c6
-rw-r--r--src/gallium/state_trackers/osmesa/osmesa.c4
-rw-r--r--src/gallium/state_trackers/vdpau/mixer.c4
-rw-r--r--src/gallium/state_trackers/vdpau/query.c25
-rw-r--r--src/gallium/state_trackers/wgl/stw_device.c4
6 files changed, 21 insertions, 25 deletions
diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
index de635454857..c7aea827938 100644
--- a/src/gallium/state_trackers/clover/core/device.cpp
+++ b/src/gallium/state_trackers/clover/core/device.cpp
@@ -25,6 +25,7 @@
#include "core/platform.hpp"
#include "pipe/p_screen.h"
#include "pipe/p_state.h"
+#include "util/bitscan.h"
#include "util/u_debug.h"
using namespace clover;
@@ -108,7 +109,7 @@ device::max_image_buffer_size() const {
cl_uint
device::max_image_levels_2d() const {
- return pipe->get_param(pipe, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
+ return util_last_bit(pipe->get_param(pipe, PIPE_CAP_MAX_TEXTURE_2D_SIZE));
}
cl_uint
diff --git a/src/gallium/state_trackers/nine/adapter9.c b/src/gallium/state_trackers/nine/adapter9.c
index 3aa95b93b2f..7ed27de3070 100644
--- a/src/gallium/state_trackers/nine/adapter9.c
+++ b/src/gallium/state_trackers/nine/adapter9.c
@@ -685,7 +685,7 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
D3DNPIPECAP(NPOT_TEXTURES, D3DPTEXTURECAPS_NONPOW2CONDITIONAL) |
D3DNPIPECAP(NPOT_TEXTURES, D3DPTEXTURECAPS_CUBEMAP_POW2) |
D3DNPIPECAP(NPOT_TEXTURES, D3DPTEXTURECAPS_VOLUMEMAP_POW2) |
- D3DPIPECAP(MAX_TEXTURE_2D_LEVELS, D3DPTEXTURECAPS_MIPMAP) |
+ D3DPIPECAP(MAX_TEXTURE_2D_SIZE, D3DPTEXTURECAPS_MIPMAP) |
D3DPIPECAP(MAX_TEXTURE_3D_LEVELS, D3DPTEXTURECAPS_MIPVOLUMEMAP) |
D3DPIPECAP(MAX_TEXTURE_CUBE_LEVELS, D3DPTEXTURECAPS_MIPCUBEMAP);
@@ -726,8 +726,8 @@ NineAdapter9_GetDeviceCaps( struct NineAdapter9 *This,
pCaps->LineCaps |= D3DLINECAPS_ANTIALIAS;
}
- pCaps->MaxTextureWidth =
- 1 << (screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS) - 1);
+ pCaps->MaxTextureWidth =screen->get_param(screen,
+ PIPE_CAP_MAX_TEXTURE_2D_SIZE);
pCaps->MaxTextureHeight = pCaps->MaxTextureWidth;
pCaps->MaxVolumeExtent =
1 << (screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_3D_LEVELS) - 1);
diff --git a/src/gallium/state_trackers/osmesa/osmesa.c b/src/gallium/state_trackers/osmesa/osmesa.c
index e7e0ab13acb..e70c391a905 100644
--- a/src/gallium/state_trackers/osmesa/osmesa.c
+++ b/src/gallium/state_trackers/osmesa/osmesa.c
@@ -885,9 +885,7 @@ OSMesaGetIntegerv(GLint pname, GLint *value)
case OSMESA_MAX_HEIGHT:
{
struct pipe_screen *screen = get_st_manager()->screen;
- int maxLevels = screen->get_param(screen,
- PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
- *value = 1 << (maxLevels - 1);
+ *value = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_SIZE);
}
return;
default:
diff --git a/src/gallium/state_trackers/vdpau/mixer.c b/src/gallium/state_trackers/vdpau/mixer.c
index 76b52255ef2..a50232bfac3 100644
--- a/src/gallium/state_trackers/vdpau/mixer.c
+++ b/src/gallium/state_trackers/vdpau/mixer.c
@@ -49,7 +49,6 @@ vlVdpVideoMixerCreate(VdpDevice device,
vlVdpVideoMixer *vmixer = NULL;
VdpStatus ret;
struct pipe_screen *screen;
- uint32_t max_2d_texture_level;
unsigned max_size, i;
vlVdpDevice *dev = vlGetDataHTAB(device);
@@ -148,8 +147,7 @@ vlVdpVideoMixerCreate(VdpDevice device,
goto no_params;
}
- max_2d_texture_level = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
- max_size = pow(2, max_2d_texture_level-1);
+ max_size = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_SIZE);
if (vmixer->video_width < 48 || vmixer->video_width > max_size) {
VDPAU_MSG(VDPAU_WARN, "[VDPAU] 48 < %u < %u not valid for width\n",
vmixer->video_width, max_size);
diff --git a/src/gallium/state_trackers/vdpau/query.c b/src/gallium/state_trackers/vdpau/query.c
index 2c4ebe62e19..5f644bbeea0 100644
--- a/src/gallium/state_trackers/vdpau/query.c
+++ b/src/gallium/state_trackers/vdpau/query.c
@@ -69,7 +69,7 @@ vlVdpVideoSurfaceQueryCapabilities(VdpDevice device, VdpChromaType surface_chrom
{
vlVdpDevice *dev;
struct pipe_screen *pscreen;
- uint32_t max_2d_texture_level;
+ uint32_t max_2d_texture_size;
if (!(is_supported && max_width && max_height))
return VDP_STATUS_INVALID_POINTER;
@@ -86,13 +86,12 @@ vlVdpVideoSurfaceQueryCapabilities(VdpDevice device, VdpChromaType surface_chrom
/* XXX: Current limits */
*is_supported = true;
- max_2d_texture_level = pscreen->get_param(pscreen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
+ max_2d_texture_size = pscreen->get_param(pscreen, PIPE_CAP_MAX_TEXTURE_2D_SIZE);
mtx_unlock(&dev->mutex);
- if (!max_2d_texture_level)
+ if (!max_2d_texture_size)
return VDP_STATUS_RESOURCES;
- /* I am not quite sure if it is max_2d_texture_level-1 or just max_2d_texture_level */
- *max_width = *max_height = pow(2,max_2d_texture_level-1);
+ *max_width = *max_height = max_2d_texture_size;
return VDP_STATUS_OK;
}
@@ -251,15 +250,15 @@ vlVdpOutputSurfaceQueryCapabilities(VdpDevice device, VdpRGBAFormat surface_rgba
PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET
);
if (*is_supported) {
- uint32_t max_2d_texture_level = pscreen->get_param(
- pscreen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
+ uint32_t max_2d_texture_size = pscreen->get_param(
+ pscreen, PIPE_CAP_MAX_TEXTURE_2D_SIZE);
- if (!max_2d_texture_level) {
+ if (!max_2d_texture_size) {
mtx_unlock(&dev->mutex);
return VDP_STATUS_ERROR;
}
- *max_width = *max_height = pow(2, max_2d_texture_level - 1);
+ *max_width = *max_height = max_2d_texture_size;
} else {
*max_width = 0;
*max_height = 0;
@@ -451,15 +450,15 @@ vlVdpBitmapSurfaceQueryCapabilities(VdpDevice device, VdpRGBAFormat surface_rgba
PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET
);
if (*is_supported) {
- uint32_t max_2d_texture_level = pscreen->get_param(
- pscreen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
+ uint32_t max_2d_texture_size = pscreen->get_param(
+ pscreen, PIPE_CAP_MAX_TEXTURE_2D_SIZE);
- if (!max_2d_texture_level) {
+ if (!max_2d_texture_size) {
mtx_unlock(&dev->mutex);
return VDP_STATUS_ERROR;
}
- *max_width = *max_height = pow(2, max_2d_texture_level - 1);
+ *max_width = *max_height = max_2d_texture_size;
} else {
*max_width = 0;
*max_height = 0;
diff --git a/src/gallium/state_trackers/wgl/stw_device.c b/src/gallium/state_trackers/wgl/stw_device.c
index f04689a974d..f1b1dfd9a14 100644
--- a/src/gallium/state_trackers/wgl/stw_device.c
+++ b/src/gallium/state_trackers/wgl/stw_device.c
@@ -121,8 +121,8 @@ stw_init(const struct stw_winsys *stw_winsys)
stw_dev->smapi->get_param = stw_get_param;
stw_dev->screen = screen;
- stw_dev->max_2d_levels =
- screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
+ stw_dev->max_2d_levels = util_last_bit(screen->get_param(screen,
+ PIPE_CAP_MAX_TEXTURE_2D_SIZE));
stw_dev->max_2d_length = 1 << (stw_dev->max_2d_levels - 1);
InitializeCriticalSection(&stw_dev->ctx_mutex);