From: Rob Clark Date: Fri, 12 Dec 2014 23:51:36 +0000 (-0500) Subject: freedreno: add is_a3xx()/is_a4xx() helpers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f24e910da40c7c813b7da009269cd994cf6ff375;p=mesa.git freedreno: add is_a3xx()/is_a4xx() helpers A bunch of open-coded 'gpu_id > 300's seems like it will eventually cause problems with future generations. There were already a few minor problems with caps for features that still need additional work on a4xx. Signed-off-by: Rob Clark --- diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.c b/src/gallium/drivers/freedreno/freedreno_gmem.c index 392c547c137..4040d1f7615 100644 --- a/src/gallium/drivers/freedreno/freedreno_gmem.c +++ b/src/gallium/drivers/freedreno/freedreno_gmem.c @@ -69,7 +69,9 @@ static uint32_t bin_width(struct fd_context *ctx) { - if (ctx->screen->gpu_id >= 300) + if (is_a4xx(ctx->screen)) + return 1024; + if (is_a3xx(ctx->screen)) return 992; return 512; } diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index ce105b8786b..19379a8b024 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -193,13 +193,13 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_SM3: case PIPE_CAP_PRIMITIVE_RESTART: - return (screen->gpu_id >= 300) ? 1 : 0; + return is_a3xx(screen) || is_a4xx(screen); case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT: return 256; case PIPE_CAP_GLSL_FEATURE_LEVEL: - return ((screen->gpu_id >= 300) && glsl130) ? 130 : 120; + return ((is_a3xx(screen) || is_a4xx(screen)) && glsl130) ? 130 : 120; /* Unsupported features. */ case PIPE_CAP_INDEP_BLEND_ENABLE: @@ -257,7 +257,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return 11; case PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS: - return (screen->gpu_id >= 300) ? 256 : 0; + return (is_a3xx(screen) || is_a4xx(screen)) ? 256 : 0; /* Render targets. */ case PIPE_CAP_MAX_RENDER_TARGETS: @@ -268,7 +268,10 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_QUERY_TIMESTAMP: return 0; case PIPE_CAP_OCCLUSION_QUERY: - return (screen->gpu_id >= 300) ? 1 : 0; + /* TODO still missing on a4xx, but we lie to get gl2.. + * it's not a feature, it's a bug! + */ + return is_a3xx(screen) || is_a4xx(screen); case PIPE_CAP_MIN_TEXTURE_GATHER_OFFSET: case PIPE_CAP_MIN_TEXEL_OFFSET: @@ -362,7 +365,7 @@ fd_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader, * split between VS and FS. Use lower limit of 256 to * avoid getting into impossible situations: */ - return ((screen->gpu_id >= 300) ? 256 : 64) * sizeof(float[4]); + return ((is_a3xx(screen) || is_a4xx(screen)) ? 256 : 64) * sizeof(float[4]); case PIPE_SHADER_CAP_MAX_CONST_BUFFERS: return 1; case PIPE_SHADER_CAP_MAX_PREDS: @@ -382,8 +385,11 @@ fd_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader, case PIPE_SHADER_CAP_INTEGERS: /* we should be able to support this on a3xx, but not * implemented yet: + * + * TODO looks like a4xx will require some additional + * work for integer varying fetch.. */ - return ((screen->gpu_id >= 300) && glsl130) ? 1 : 0; + return (is_a3xx(screen) && glsl130) ? 1 : 0; case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS: case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS: return 16; diff --git a/src/gallium/drivers/freedreno/freedreno_screen.h b/src/gallium/drivers/freedreno/freedreno_screen.h index 4bfa74466c9..e1c554c0538 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.h +++ b/src/gallium/drivers/freedreno/freedreno_screen.h @@ -76,4 +76,16 @@ is_a3xx_p0(struct fd_screen *screen) return (screen->chip_id & 0xff0000ff) == 0x03000000; } +static inline boolean +is_a3xx(struct fd_screen *screen) +{ + return (screen->gpu_id >= 300) && (screen->gpu_id < 400); +} + +static inline boolean +is_a4xx(struct fd_screen *screen) +{ + return (screen->gpu_id >= 400) && (screen->gpu_id < 500); +} + #endif /* FREEDRENO_SCREEN_H_ */