summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2014-12-12 18:51:36 -0500
committerRob Clark <[email protected]>2014-12-13 15:09:37 -0500
commitf24e910da40c7c813b7da009269cd994cf6ff375 (patch)
tree2881d2d8038f1856cfd44687fed65dd9bbec1f8c /src
parent7474de2235beee9240be702ab99b93989fa7c7c1 (diff)
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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/freedreno/freedreno_gmem.c4
-rw-r--r--src/gallium/drivers/freedreno/freedreno_screen.c18
-rw-r--r--src/gallium/drivers/freedreno/freedreno_screen.h12
3 files changed, 27 insertions, 7 deletions
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_ */