freedreno: cap cleanups
authorRob Clark <robclark@freedesktop.org>
Tue, 11 Aug 2015 00:41:45 +0000 (20:41 -0400)
committerRob Clark <robclark@freedesktop.org>
Wed, 12 Aug 2015 22:37:43 +0000 (18:37 -0400)
Move a few things around to group stuff that is common to a3xx/a4xx
together.  Also, introduce is_ir3() for things that are more specific to
the compiler / shader-ISA than to the gpu generation.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/freedreno_screen.c
src/gallium/drivers/freedreno/freedreno_screen.h

index 417d7c65ad4fd6e06dbe50e721b2b62c0fa11731..26802b0188ae57d0d42442eccb54d8eb00f02d1b 100644 (file)
@@ -176,22 +176,20 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
        case PIPE_CAP_PRIMITIVE_RESTART:
        case PIPE_CAP_TGSI_INSTANCEID:
        case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR:
+       case PIPE_CAP_INDEP_BLEND_ENABLE:
+       case PIPE_CAP_INDEP_BLEND_FUNC:
                return is_a3xx(screen) || is_a4xx(screen);
 
        case PIPE_CAP_DEPTH_CLIP_DISABLE:
                return is_a3xx(screen);
 
-       case PIPE_CAP_INDEP_BLEND_ENABLE:
-       case PIPE_CAP_INDEP_BLEND_FUNC:
-               return is_a3xx(screen) || is_a4xx(screen);
-
        case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT:
                return 256;
 
        case PIPE_CAP_GLSL_FEATURE_LEVEL:
                if (glsl120)
                        return 120;
-               return (is_a3xx(screen) || is_a4xx(screen)) ? 130 : 120;
+               return is_ir3(screen) ? 130 : 120;
 
        /* Unsupported features. */
        case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
@@ -229,19 +227,16 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
 
        /* Stream output. */
        case PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS:
-               if (is_a3xx(screen) || is_a4xx(screen))
+               if (is_ir3(screen))
                        return PIPE_MAX_SO_BUFFERS;
                return 0;
        case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME:
-               if (is_a3xx(screen) || is_a4xx(screen))
+               if (is_ir3(screen))
                        return 1;
                return 0;
        case PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS:
-               if (is_a3xx(screen) || is_a4xx(screen))
-                       return 16 * 4;   /* should only be shader out limit? */
-               return 0;
        case PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS:
-               if (is_a3xx(screen) || is_a4xx(screen))
+               if (is_ir3(screen))
                        return 16 * 4;   /* should only be shader out limit? */
                return 0;
 
@@ -273,9 +268,6 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
        case PIPE_CAP_QUERY_TIMESTAMP:
                return 0;
        case PIPE_CAP_OCCLUSION_QUERY:
-               /* 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:
@@ -372,7 +364,7 @@ fd_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
                 */
                return ((is_a3xx(screen) || is_a4xx(screen)) ? 4096 : 64) * sizeof(float[4]);
        case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
-               return (is_a3xx(screen) || is_a4xx(screen)) ? 16 : 1;
+               return is_ir3(screen) ? 16 : 1;
        case PIPE_SHADER_CAP_MAX_PREDS:
                return 0; /* nothing uses this */
        case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
@@ -394,7 +386,7 @@ fd_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
        case PIPE_SHADER_CAP_INTEGERS:
                if (glsl120)
                        return 0;
-               return (is_a3xx(screen) || is_a4xx(screen)) ? 1 : 0;
+               return is_ir3(screen) ? 1 : 0;
        case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
        case PIPE_SHADER_CAP_MAX_SAMPLER_VIEWS:
                return 16;
index 4b32d2d7d97eaee64b09e9698002be8632c915e2..4e5c3a619580bb2143648d7421f9505fef14bd20 100644 (file)
@@ -73,6 +73,7 @@ struct fd_bo * fd_screen_bo_from_handle(struct pipe_screen *pscreen,
 struct pipe_screen * fd_screen_create(struct fd_device *dev);
 
 /* is a3xx patch revision 0? */
+/* TODO a306.0 probably doesn't need this.. be more clever?? */
 static inline boolean
 is_a3xx_p0(struct fd_screen *screen)
 {
@@ -91,4 +92,11 @@ is_a4xx(struct fd_screen *screen)
        return (screen->gpu_id >= 400) && (screen->gpu_id < 500);
 }
 
+/* is it using the ir3 compiler (shader isa introduced with a3xx)? */
+static inline boolean
+is_ir3(struct fd_screen *screen)
+{
+       return is_a3xx(screen) || is_a4xx(screen);
+}
+
 #endif /* FREEDRENO_SCREEN_H_ */