gallium: add cap to export device pointer size
authorJan Vesely <jan.vesely@rutgers.edu>
Sun, 28 Aug 2016 08:06:28 +0000 (04:06 -0400)
committerJan Vesely <jan.vesely@rutgers.edu>
Mon, 29 Aug 2016 18:40:15 +0000 (14:40 -0400)
v2: document the new cap
v3: fix 80 char limit in screen.rst

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
src/gallium/docs/source/screen.rst
src/gallium/drivers/ilo/ilo_screen.c
src/gallium/drivers/nouveau/nv50/nv50_screen.c
src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
src/gallium/drivers/radeon/r600_pipe_common.c
src/gallium/drivers/softpipe/sp_screen.c
src/gallium/include/pipe/p_defines.h

index c00d0127ce5eca931e21f29b25515d5449b54351..5a11e7298413b2c536525267b32e05dbd94d6bbe 100644 (file)
@@ -496,6 +496,8 @@ pipe_screen::get_compute_param.
   non-zero means yes, zero means no. Value type: ``uint32_t``
 * ``PIPE_COMPUTE_CAP_SUBGROUP_SIZE``: The size of a basic execution unit in
   threads. Also known as wavefront size, warp size or SIMD width.
+* ``PIPE_COMPUTE_CAP_ADDRESS_BITS``: The default compute device address space
+  size specified as an unsigned integer value in bits.
 
 .. _pipe_bind:
 
index 050c03b66cc437a02c588167e500b2fd7bdbfbcf..b9e5ad6184fa06841fbf8aff6c6d653c08aef66d 100644 (file)
@@ -199,6 +199,7 @@ ilo_get_compute_param(struct pipe_screen *screen,
       uint32_t max_compute_units;
       uint32_t images_supported;
       uint32_t subgroup_size;
+      uint32_t address_bits;
    } val;
    const void *ptr;
    int size;
@@ -266,6 +267,11 @@ ilo_get_compute_param(struct pipe_screen *screen,
       ptr = &val.max_input_size;
       size = sizeof(val.max_input_size);
       break;
+   case PIPE_COMPUTE_CAP_ADDRESS_BITS:
+      val.address_bits = 32;
+      ptr = &val.address_bits;
+      size = sizeof(val.address_bits);
+      break;
    case PIPE_COMPUTE_CAP_MAX_MEM_ALLOC_SIZE:
       val.max_mem_alloc_size = 1u << 31;
 
index d878547c9a5892d783d0bfcac34859a5d104f0d4..57c0c2bca8b688547da760917de5dc54b38e4f6d 100644 (file)
@@ -418,6 +418,8 @@ nv50_screen_get_compute_param(struct pipe_screen *pscreen,
       RET((uint32_t []) { screen->mp_count });
    case PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY:
       RET((uint32_t []) { 512 }); /* FIXME: arbitrary limit */
+   case PIPE_COMPUTE_CAP_ADDRESS_BITS:
+      RET((uint32_t []) { 32 });
    default:
       return 0;
    }
index f139f66f36544c0914f53459413188ab835caf14..e7bfbbedbb15f4b6cdca5b26c5ca732de750a567 100644 (file)
@@ -479,6 +479,8 @@ nvc0_screen_get_compute_param(struct pipe_screen *pscreen,
       RET((uint32_t []) { screen->mp_count_compute });
    case PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY:
       RET((uint32_t []) { 512 }); /* FIXME: arbitrary limit */
+   case PIPE_COMPUTE_CAP_ADDRESS_BITS:
+      RET((uint32_t []) { 64 });
    default:
       return 0;
    }
index b1da22f0fd5191e7691f0f5cebec404d19365adb..1b15594bbd20e5c6d4adc3ac7e9912d0f6a4dace 100644 (file)
@@ -881,6 +881,14 @@ static int r600_get_compute_param(struct pipe_screen *screen,
                                *max_threads_per_block = 256;
                }
                return sizeof(uint64_t);
+       case PIPE_COMPUTE_CAP_ADDRESS_BITS:
+               if (ret) {
+                       uint32_t *address_bits = ret;
+                       address_bits[0] = 32;
+                       if (rscreen->chip_class >= SI)
+                               address_bits[0] = 64;
+               }
+               return 1 * sizeof(uint32_t);
 
        case PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE:
                if (ret) {
index b742bdecbc919d22b71811be6c2fc09e1f203b8d..cd4269f99290e5ffdbed01494bb242b738554b7e 100644 (file)
@@ -521,6 +521,7 @@ softpipe_get_compute_param(struct pipe_screen *_screen,
    case PIPE_COMPUTE_CAP_MAX_COMPUTE_UNITS:
    case PIPE_COMPUTE_CAP_IMAGES_SUPPORTED:
    case PIPE_COMPUTE_CAP_SUBGROUP_SIZE:
+   case PIPE_COMPUTE_CAP_ADDRESS_BITS:
       break;
    }
    return 0;
index 1e4d80227b4d4b7b4b3c698d4035ca1907f39875..5361ed6271481d1936f8c4f2c77c9c7e7e753fcf 100644 (file)
@@ -834,6 +834,7 @@ enum pipe_shader_ir
  */
 enum pipe_compute_cap
 {
+   PIPE_COMPUTE_CAP_ADDRESS_BITS,
    PIPE_COMPUTE_CAP_IR_TARGET,
    PIPE_COMPUTE_CAP_GRID_DIMENSION,
    PIPE_COMPUTE_CAP_MAX_GRID_SIZE,