freedreno: add some more compute caps
authorRob Clark <robdclark@gmail.com>
Mon, 26 Feb 2018 16:29:05 +0000 (11:29 -0500)
committerRob Clark <robdclark@gmail.com>
Mon, 5 Mar 2018 13:05:33 +0000 (08:05 -0500)
Signed-off-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/freedreno_screen.c
src/gallium/drivers/freedreno/freedreno_screen.h

index 7fc3ab5e9ad4a2fa5625aa3ba1108c6d9599a267..f9cafbabeb308029e948ad6716d61d048f4cc8d0 100644 (file)
 
 #include "util/os_time.h"
 
-#include <stdio.h>
 #include <errno.h>
+#include <stdio.h>
 #include <stdlib.h>
+#include <sys/sysinfo.h>
 
 #include "freedreno_screen.h"
 #include "freedreno_resource.h"
@@ -666,21 +667,32 @@ fd_get_compute_param(struct pipe_screen *pscreen, enum pipe_shader_ir ir_type,
                RET((uint64_t []) { 1024 });
 
        case PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE:
+               RET((uint64_t []) { screen->ram_size });
+
        case PIPE_COMPUTE_CAP_MAX_LOCAL_SIZE:
                RET((uint64_t []) { 32768 });
 
        case PIPE_COMPUTE_CAP_MAX_PRIVATE_SIZE:
        case PIPE_COMPUTE_CAP_MAX_INPUT_SIZE:
-               break;
+               RET((uint64_t []) { 4096 });
+
        case PIPE_COMPUTE_CAP_MAX_MEM_ALLOC_SIZE:
-               RET((uint64_t []) { 32768 });
+               RET((uint64_t []) { screen->ram_size });
 
        case PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY:
+               RET((uint32_t []) { screen->max_freq / 1000000 });
+
        case PIPE_COMPUTE_CAP_MAX_COMPUTE_UNITS:
+               RET((uint32_t []) { 9999 });  // TODO
+
        case PIPE_COMPUTE_CAP_IMAGES_SUPPORTED:
+               RET((uint32_t []) { 1 });
+
        case PIPE_COMPUTE_CAP_SUBGROUP_SIZE:
+               RET((uint32_t []) { 32 });  // TODO
+
        case PIPE_COMPUTE_CAP_MAX_VARIABLE_THREADS_PER_BLOCK:
-               break;
+               RET((uint64_t []) { 1024 }); // TODO
        }
 
        return 0;
@@ -824,6 +836,10 @@ fd_screen_create(struct fd_device *dev)
                screen->priority_mask = (1 << val) - 1;
        }
 
+       struct sysinfo si;
+       sysinfo(&si);
+       screen->ram_size = si.totalram;
+
        DBG("Pipe Info:");
        DBG(" GPU-id:          %d", screen->gpu_id);
        DBG(" Chip-id:         0x%08x", screen->chip_id);
index 55537f2d1c47f049d76d85a527b50f2ee372f594..6be739ae2876bcffe76c510927e973ecbbcd193b 100644 (file)
@@ -64,6 +64,7 @@ struct fd_screen {
        uint32_t gpu_id;         /* 220, 305, etc */
        uint32_t chip_id;        /* coreid:8 majorrev:8 minorrev:8 patch:8 */
        uint32_t max_freq;
+       uint32_t ram_size;
        uint32_t max_rts;        /* max # of render targets */
        uint32_t gmem_alignw, gmem_alignh;
        uint32_t num_vsc_pipes;