Mesa (master): gallium: Add PIPE_COMPUTE_CAP_MAX_MEM_ALLOC_SIZE v2

Tom Stellard tstellar at kemper.freedesktop.org
Tue Sep 25 14:40:53 UTC 2012


Module: Mesa
Branch: master
Commit: 0e3c30cd6f90db72044bb2d3311aa13a245cbcaf
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0e3c30cd6f90db72044bb2d3311aa13a245cbcaf

Author: Tom Stellard <thomas.stellard at amd.com>
Date:   Fri Sep 21 20:19:14 2012 +0000

gallium: Add PIPE_COMPUTE_CAP_MAX_MEM_ALLOC_SIZE v2

v2:
  - Add comment in screen.rst
  - Report OpenCL required minimum for r600g

---

 src/gallium/docs/source/screen.rst   |    2 ++
 src/gallium/drivers/r600/r600_pipe.c |   16 ++++++++++++++++
 src/gallium/include/pipe/p_defines.h |    3 ++-
 3 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
index 540d308..7a55684 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -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:
 
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index 7791232..0a7b0ac 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -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;
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 59c6382..db86474 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -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
 };
 
 /**




More information about the mesa-commit mailing list