summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Shvetsov <alexxy@gentoo.org>2013-04-06 17:32:04 +0400
committerAlexey Shvetsov <alexxy@gentoo.org>2013-04-06 17:32:04 +0400
commit80e8f10f730178ef1bc1e873fd8e8539136250a1 (patch)
tree2a99481e4589a1fb7b7d2c5855696ffe5e2932db
parentDrop unneded patches (diff)
downloadx11-80e8f10f730178ef1bc1e873fd8e8539136250a1.tar.gz
x11-80e8f10f730178ef1bc1e873fd8e8539136250a1.tar.bz2
x11-80e8f10f730178ef1bc1e873fd8e8539136250a1.zip
Add patch to use non-null platform-id
Package-Manager: portage-2.2.0_alpha171
-rw-r--r--media-libs/mesa/files/mesa-9999-clover-use-non-null-platform-id.patch87
-rw-r--r--media-libs/mesa/mesa-9999.ebuild3
2 files changed, 90 insertions, 0 deletions
diff --git a/media-libs/mesa/files/mesa-9999-clover-use-non-null-platform-id.patch b/media-libs/mesa/files/mesa-9999-clover-use-non-null-platform-id.patch
new file mode 100644
index 00000000..5be513d6
--- /dev/null
+++ b/media-libs/mesa/files/mesa-9999-clover-use-non-null-platform-id.patch
@@ -0,0 +1,87 @@
+From: Tom Stellard <thomas.stellard at amd.com>
+
+Using a NULL value for the platform_id is legal according to the spec,
+however, passing a NULL value as the platform parameter to
+clGetPlatformInfo() results in implementation defined behavior.
+
+In order to avoid implementation defined behavior some apps require that
+the platfrom_id is non-NULL. To statisfy this requirement, we just need
+to hard-code clover's platform_id to something other than NULL.
+
+v2:
+ - Handle platform check in clGetDeviceIDs()
+ - Use a macro for MESA_PLATFORM_ID
+
+v3:
+ - Use MESA_PLATFORM_ID when calling clGetDeviceIDs() from
+ clCreateContextFromType()
+---
+ src/gallium/state_trackers/clover/api/context.cpp | 2 +-
+ src/gallium/state_trackers/clover/api/device.cpp | 2 +-
+ src/gallium/state_trackers/clover/api/platform.cpp | 4 ++--
+ src/gallium/state_trackers/clover/api/util.hpp | 2 ++
+ 4 files changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/src/gallium/state_trackers/clover/api/context.cpp b/src/gallium/state_trackers/clover/api/context.cpp
+index 80afb6b..d509619 100644
+--- a/src/gallium/state_trackers/clover/api/context.cpp
++++ b/src/gallium/state_trackers/clover/api/context.cpp
+@@ -65,7 +65,7 @@ clCreateContextFromType(const cl_context_properties *props,
+ cl_device_id dev;
+ cl_int ret;
+
+- ret = clGetDeviceIDs(0, type, 1, &dev, 0);
++ ret = clGetDeviceIDs(MESA_PLATFORM_ID, type, 1, &dev, 0);
+ if (ret) {
+ ret_error(errcode_ret, ret);
+ return NULL;
+diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp
+index cf68d0f..d9b0223 100644
+--- a/src/gallium/state_trackers/clover/api/device.cpp
++++ b/src/gallium/state_trackers/clover/api/device.cpp
+@@ -33,7 +33,7 @@ clGetDeviceIDs(cl_platform_id platform, cl_device_type device_type,
+ cl_uint *num_devices) {
+ std::vector<cl_device_id> devs;
+
+- if (platform != NULL)
++ if (platform != MESA_PLATFORM_ID)
+ return CL_INVALID_PLATFORM;
+
+ if ((!num_entries && devices) ||
+diff --git a/src/gallium/state_trackers/clover/api/platform.cpp b/src/gallium/state_trackers/clover/api/platform.cpp
+index f99b694..3a988a6 100644
+--- a/src/gallium/state_trackers/clover/api/platform.cpp
++++ b/src/gallium/state_trackers/clover/api/platform.cpp
+@@ -34,7 +34,7 @@ clGetPlatformIDs(cl_uint num_entries, cl_platform_id *platforms,
+ if (num_platforms)
+ *num_platforms = 1;
+ if (platforms)
+- *platforms = NULL;
++ *platforms = MESA_PLATFORM_ID;
+
+ return CL_SUCCESS;
+ }
+@@ -42,7 +42,7 @@ clGetPlatformIDs(cl_uint num_entries, cl_platform_id *platforms,
+ PUBLIC cl_int
+ clGetPlatformInfo(cl_platform_id platform, cl_platform_info param_name,
+ size_t size, void *buf, size_t *size_ret) {
+- if (platform != NULL)
++ if (platform != MESA_PLATFORM_ID)
+ return CL_INVALID_PLATFORM;
+
+ switch (param_name) {
+diff --git a/src/gallium/state_trackers/clover/api/util.hpp b/src/gallium/state_trackers/clover/api/util.hpp
+index 2f9ec1f..0e80cda 100644
+--- a/src/gallium/state_trackers/clover/api/util.hpp
++++ b/src/gallium/state_trackers/clover/api/util.hpp
+@@ -31,6 +31,8 @@
+ #include "core/base.hpp"
+ #include "pipe/p_compiler.h"
+
++#define MESA_PLATFORM_ID ((cl_platform_id)0xc1c1c1c1)
++
+ namespace clover {
+ ///
+ /// Return a matrix (a container of containers) in \a buf with
+--
+1.7.11.4
diff --git a/media-libs/mesa/mesa-9999.ebuild b/media-libs/mesa/mesa-9999.ebuild
index 6243eedd..f679276e 100644
--- a/media-libs/mesa/mesa-9999.ebuild
+++ b/media-libs/mesa/mesa-9999.ebuild
@@ -172,6 +172,9 @@ src_prepare() {
# relax the requirement that r300 must have llvm, bug 380303
epatch "${FILESDIR}"/${P}-dont-require-llvm-for-r300.patch
+ # use non-NULL platform id
+ epatch "${FILESDIR}/${P}-clover-use-non-null-platform-id.patch"
+
# fix for hardened pax_kernel, bug 240956
[[ ${PV} != 9999* ]] && epatch "${FILESDIR}"/glx_ro_text_segm.patch