gallium: Add PIPE_COMPUTE_CAP_MAX_MEM_ALLOC_SIZE v2
authorTom Stellard <thomas.stellard@amd.com>
Fri, 21 Sep 2012 20:19:14 +0000 (20:19 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Tue, 25 Sep 2012 14:36:50 +0000 (14:36 +0000)
v2:
  - Add comment in screen.rst
  - Report OpenCL required minimum for r600g

src/gallium/docs/source/screen.rst
src/gallium/drivers/r600/r600_pipe.c
src/gallium/include/pipe/p_defines.h

index 540d30861b268e0cac5c904b18b54aed10ea055f..7a5568477f042299221b2b7803515fb298495533 100644 (file)
@@ -239,6 +239,8 @@ pipe_screen::get_compute_param.
   resource.  Value type: ``uint64_t``.
 * ``PIPE_COMPUTE_CAP_MAX_INPUT_SIZE``: Maximum size of the INPUT
   resource.  Value type: ``uint64_t``.
+* ``PIPE_COMPUTE_CAP_MAX_MEM_ALLOC_SIZE``: Maximum size of a memory object
+  allocation in bytes.  Value type: ``uint64_t``.
 
 .. _pipe_bind:
 
index 77912326d0a0910f3bb7c3f08be39e334daa5108..0a7b0ac2012e57107544e071dc2ec87bf03afeb2 100644 (file)
@@ -667,6 +667,22 @@ static int r600_get_compute_param(struct pipe_screen *screen,
                }
                return sizeof(uint64_t);
 
+       case PIPE_COMPUTE_CAP_MAX_MEM_ALLOC_SIZE:
+               if (ret) {
+                       uint64_t max_global_size;
+                       uint64_t * max_mem_alloc_size = ret;
+                       r600_get_compute_param(screen,
+                                       PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE,
+                                       &max_global_size);
+                       /* OpenCL requres this value be at least
+                        * max(MAX_GLOBAL_SIZE / 4, 128 * 1024 *1024)
+                        * I'm really not sure what value to report here, but
+                        * MAX_GLOBAL_SIZE / 4 seems resonable.
+                        */
+                       *max_mem_alloc_size = max_global_size / 4;
+               }
+               return sizeof(uint64_t);
+
        default:
                fprintf(stderr, "unknown PIPE_COMPUTE_CAP %d\n", param);
                return 0;
index 59c6382b25dd4a26e18c3e9bcb6992507186cac0..db864742d22534938206cc2e17a1bdf93105033e 100644 (file)
@@ -557,7 +557,8 @@ enum pipe_compute_cap
    PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE,
    PIPE_COMPUTE_CAP_MAX_LOCAL_SIZE,
    PIPE_COMPUTE_CAP_MAX_PRIVATE_SIZE,
-   PIPE_COMPUTE_CAP_MAX_INPUT_SIZE
+   PIPE_COMPUTE_CAP_MAX_INPUT_SIZE,
+   PIPE_COMPUTE_CAP_MAX_MEM_ALLOC_SIZE
 };
 
 /**