summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Shvetsov <alexxy@gentoo.org>2013-04-11 09:30:02 +0400
committerAlexey Shvetsov <alexxy@gentoo.org>2013-04-11 09:30:02 +0400
commitcb2c78f3358ef8d77ae830a29c673378f036392f (patch)
treebf579493fa825e73774fbde31ec0e5e6ce2c8d61
parentAdd patch to make bfgminer work (diff)
downloadx11-cb2c78f3358ef8d77ae830a29c673378f036392f.tar.gz
x11-cb2c78f3358ef8d77ae830a29c673378f036392f.tar.bz2
x11-cb2c78f3358ef8d77ae830a29c673378f036392f.zip
Update patches
Package-Manager: portage-2.2.0_alpha171
-rw-r--r--media-libs/mesa/files/mesa-9999-clover-use-non-null-platform-id.patch103
-rw-r--r--media-libs/mesa/files/mesa-9999-use-a-struct-for-cl_platform_id.patch400
-rw-r--r--media-libs/mesa/mesa-9999.ebuild2
3 files changed, 401 insertions, 104 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
deleted file mode 100644
index 1c2d0659..00000000
--- a/media-libs/mesa/files/mesa-9999-clover-use-non-null-platform-id.patch
+++ /dev/null
@@ -1,103 +0,0 @@
-From cc0fb86ba8ca9c96806f05e71b70db3da5edf4fd Mon Sep 17 00:00:00 2001
-From: Tom Stellard <thomas.stellard@amd.com>
-Date: Fri, 5 Apr 2013 13:23:01 -0700
-Subject: [PATCH] clover: Use a non-NULL value to represent the platform_id v3
-
-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()
-
-v4:
- - Use MESA_PLATFORM_ID when checking the CL_CONTEXT_PLATFORM property
----
- src/gallium/state_trackers/clover/api/context.cpp | 4 ++--
- 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, 7 insertions(+), 5 deletions(-)
-
-diff --git a/src/gallium/state_trackers/clover/api/context.cpp b/src/gallium/state_trackers/clover/api/context.cpp
-index 80afb6b..f25856f 100644
---- a/src/gallium/state_trackers/clover/api/context.cpp
-+++ b/src/gallium/state_trackers/clover/api/context.cpp
-@@ -42,7 +42,7 @@ clCreateContext(const cl_context_properties *props, cl_uint num_devs,
-
- for (auto p : mprops) {
- if (!(p.first == CL_CONTEXT_PLATFORM &&
-- (cl_platform_id)p.second == NULL))
-+ (cl_platform_id)p.second == MESA_PLATFORM_ID))
- throw error(CL_INVALID_PROPERTY);
- }
-
-@@ -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.8.1.5
-
diff --git a/media-libs/mesa/files/mesa-9999-use-a-struct-for-cl_platform_id.patch b/media-libs/mesa/files/mesa-9999-use-a-struct-for-cl_platform_id.patch
new file mode 100644
index 00000000..e5c7786f
--- /dev/null
+++ b/media-libs/mesa/files/mesa-9999-use-a-struct-for-cl_platform_id.patch
@@ -0,0 +1,400 @@
+From 39d5479f931bfce9641fb43d99a50cea63952de6 Mon Sep 17 00:00:00 2001
+From: Francisco Jerez <currojerez@riseup.net>
+Date: Wed, 10 Apr 2013 19:16:43 +0000
+Subject: clover: Use a struct to represent cl_platform_id
+
+---
+diff --git a/src/gallium/state_trackers/clover/Makefile.am b/src/gallium/state_trackers/clover/Makefile.am
+index 33ff03d..b4c197a 100644
+--- a/src/gallium/state_trackers/clover/Makefile.am
++++ b/src/gallium/state_trackers/clover/Makefile.am
+@@ -50,6 +50,8 @@ libclover_la_SOURCES = \
+ core/format.cpp \
+ core/memory.hpp \
+ core/memory.cpp \
++ core/platform.hpp \
++ core/platform.cpp \
+ core/resource.hpp \
+ core/resource.cpp \
+ core/sampler.hpp \
+diff --git a/src/gallium/state_trackers/clover/api/context.cpp b/src/gallium/state_trackers/clover/api/context.cpp
+index 80afb6b..99b9566 100644
+--- a/src/gallium/state_trackers/clover/api/context.cpp
++++ b/src/gallium/state_trackers/clover/api/context.cpp
+@@ -41,8 +41,7 @@ clCreateContext(const cl_context_properties *props, cl_uint num_devs,
+ throw error(CL_INVALID_DEVICE);
+
+ for (auto p : mprops) {
+- if (!(p.first == CL_CONTEXT_PLATFORM &&
+- (cl_platform_id)p.second == NULL))
++ if (p.first != CL_CONTEXT_PLATFORM)
+ throw error(CL_INVALID_PROPERTY);
+ }
+
+@@ -61,17 +60,25 @@ clCreateContextFromType(const cl_context_properties *props,
+ cl_device_type type,
+ void (CL_CALLBACK *pfn_notify)(
+ const char *, const void *, size_t, void *),
+- void *user_data, cl_int *errcode_ret) {
++ void *user_data, cl_int *errcode_ret) try {
++ cl_platform_id platform;
++ cl_uint num_platforms;
+ cl_device_id dev;
+ cl_int ret;
+
+- ret = clGetDeviceIDs(0, type, 1, &dev, 0);
+- if (ret) {
+- ret_error(errcode_ret, ret);
+- return NULL;
+- }
++ ret = clGetPlatformIDs(1, &platform, &num_platforms);
++ if (ret || !num_platforms)
++ throw error(CL_INVALID_PLATFORM);
++
++ ret = clGetDeviceIDs(platform, type, 1, &dev, 0);
++ if (ret)
++ throw error(CL_DEVICE_NOT_FOUND);
+
+ return clCreateContext(props, 1, &dev, pfn_notify, user_data, errcode_ret);
++
++} catch(error &e) {
++ ret_error(errcode_ret, e);
++ return NULL;
+ }
+
+ PUBLIC cl_int
+diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp
+index cf68d0f..dfb440d 100644
+--- a/src/gallium/state_trackers/clover/api/device.cpp
++++ b/src/gallium/state_trackers/clover/api/device.cpp
+@@ -21,29 +21,25 @@
+ //
+
+ #include "api/util.hpp"
++#include "core/platform.hpp"
+ #include "core/device.hpp"
+
+ using namespace clover;
+
+-static device_registry registry;
+-
+ PUBLIC cl_int
+ clGetDeviceIDs(cl_platform_id platform, cl_device_type device_type,
+ cl_uint num_entries, cl_device_id *devices,
+ cl_uint *num_devices) {
+ std::vector<cl_device_id> devs;
+
+- if (platform != NULL)
+- return CL_INVALID_PLATFORM;
+-
+ if ((!num_entries && devices) ||
+ (!num_devices && !devices))
+ return CL_INVALID_VALUE;
+
+ // Collect matching devices
+- for (device &dev : registry) {
++ for (device &dev : *platform) {
+ if (((device_type & CL_DEVICE_TYPE_DEFAULT) &&
+- &dev == &registry.front()) ||
++ &dev == &platform->front()) ||
+ (device_type & dev.type()))
+ devs.push_back(&dev);
+ }
+@@ -223,13 +219,15 @@ clGetDeviceInfo(cl_device_id dev, cl_device_info param,
+ return string_property(buf, size, size_ret, "FULL_PROFILE");
+
+ case CL_DEVICE_VERSION:
+- return string_property(buf, size, size_ret, "OpenCL 1.1 MESA " PACKAGE_VERSION);
++ return string_property(buf, size, size_ret,
++ "OpenCL 1.1 MESA " PACKAGE_VERSION);
+
+ case CL_DEVICE_EXTENSIONS:
+ return string_property(buf, size, size_ret, "");
+
+ case CL_DEVICE_PLATFORM:
+- return scalar_property<cl_platform_id>(buf, size, size_ret, NULL);
++ return scalar_property<cl_platform_id>(buf, size, size_ret,
++ dev->platform);
+
+ case CL_DEVICE_HOST_UNIFIED_MEMORY:
+ return scalar_property<cl_bool>(buf, size, size_ret, CL_TRUE);
+diff --git a/src/gallium/state_trackers/clover/api/platform.cpp b/src/gallium/state_trackers/clover/api/platform.cpp
+index f99b694..90111c7 100644
+--- a/src/gallium/state_trackers/clover/api/platform.cpp
++++ b/src/gallium/state_trackers/clover/api/platform.cpp
+@@ -21,9 +21,12 @@
+ //
+
+ #include "api/util.hpp"
++#include "core/platform.hpp"
+
+ using namespace clover;
+
++static platform __platform;
++
+ PUBLIC cl_int
+ clGetPlatformIDs(cl_uint num_entries, cl_platform_id *platforms,
+ cl_uint *num_platforms) {
+@@ -34,7 +37,7 @@ clGetPlatformIDs(cl_uint num_entries, cl_platform_id *platforms,
+ if (num_platforms)
+ *num_platforms = 1;
+ if (platforms)
+- *platforms = NULL;
++ *platforms = &__platform;
+
+ return CL_SUCCESS;
+ }
+@@ -42,7 +45,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 != &__platform)
+ return CL_INVALID_PLATFORM;
+
+ switch (param_name) {
+diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
+index d93a1f6..8c6a8a6 100644
+--- a/src/gallium/state_trackers/clover/core/device.cpp
++++ b/src/gallium/state_trackers/clover/core/device.cpp
+@@ -38,13 +38,16 @@ namespace {
+ }
+ }
+
+-_cl_device_id::_cl_device_id(pipe_loader_device *ldev) : ldev(ldev) {
++_cl_device_id::_cl_device_id(clover::platform *platform,
++ pipe_loader_device *ldev) :
++ platform(platform), ldev(ldev) {
+ pipe = pipe_loader_create_screen(ldev, PIPE_SEARCH_DIR);
+ if (!pipe || !pipe->get_param(pipe, PIPE_CAP_COMPUTE))
+ throw error(CL_INVALID_DEVICE);
+ }
+
+-_cl_device_id::_cl_device_id(_cl_device_id &&dev) : pipe(dev.pipe), ldev(dev.ldev) {
++_cl_device_id::_cl_device_id(_cl_device_id &&dev) :
++ platform(dev.platform), pipe(dev.pipe), ldev(dev.ldev) {
+ dev.ldev = NULL;
+ dev.pipe = NULL;
+ }
+@@ -56,6 +59,15 @@ _cl_device_id::~_cl_device_id() {
+ pipe_loader_release(&ldev, 1);
+ }
+
++void
++_cl_device_id::operator=(_cl_device_id &&dev) {
++ platform = dev.platform;
++ pipe = dev.pipe;
++ ldev = dev.ldev;
++ dev.ldev = NULL;
++ dev.pipe = NULL;
++}
++
+ cl_device_type
+ _cl_device_id::type() const {
+ switch (ldev->type) {
+@@ -179,16 +191,3 @@ _cl_device_id::ir_target() const {
+ PIPE_COMPUTE_CAP_IR_TARGET);
+ return { target.data() };
+ }
+-
+-device_registry::device_registry() {
+- int n = pipe_loader_probe(NULL, 0);
+- std::vector<pipe_loader_device *> ldevs(n);
+-
+- pipe_loader_probe(&ldevs.front(), n);
+-
+- for (pipe_loader_device *ldev : ldevs) {
+- try {
+- devs.emplace_back(ldev);
+- } catch (error &) {}
+- }
+-}
+diff --git a/src/gallium/state_trackers/clover/core/device.hpp b/src/gallium/state_trackers/clover/core/device.hpp
+index 5b92751..897a003 100644
+--- a/src/gallium/state_trackers/clover/core/device.hpp
++++ b/src/gallium/state_trackers/clover/core/device.hpp
+@@ -32,17 +32,21 @@
+
+ namespace clover {
+ typedef struct _cl_device_id device;
++ typedef struct _cl_platform_id platform;
+ class root_resource;
+ class hard_event;
+ }
+
+ struct _cl_device_id {
+ public:
+- _cl_device_id(pipe_loader_device *ldev);
++ _cl_device_id(clover::platform *platform, pipe_loader_device *ldev);
+ _cl_device_id(_cl_device_id &&dev);
+ _cl_device_id(const _cl_device_id &dev) = delete;
+ ~_cl_device_id();
+
++ void operator=(_cl_device_id &&dev);
++ void operator=(const _cl_device_id &dev) = delete;
++
+ cl_device_type type() const;
+ cl_uint vendor_id() const;
+ size_t max_images_read() const;
+@@ -70,41 +74,11 @@ public:
+ friend std::set<cl_image_format>
+ clover::supported_formats(cl_context, cl_mem_object_type);
+
++ clover::platform *platform;
++
+ private:
+ pipe_screen *pipe;
+ pipe_loader_device *ldev;
+ };
+
+-namespace clover {
+- ///
+- /// Container of all the compute devices that are available in the
+- /// system.
+- ///
+- class device_registry {
+- public:
+- typedef std::vector<device>::iterator iterator;
+-
+- device_registry();
+-
+- iterator begin() {
+- return devs.begin();
+- }
+-
+- iterator end() {
+- return devs.end();
+- }
+-
+- device &front() {
+- return devs.front();
+- }
+-
+- device &back() {
+- return devs.back();
+- }
+-
+- protected:
+- std::vector<device> devs;
+- };
+-}
+-
+ #endif
+diff --git a/src/gallium/state_trackers/clover/core/platform.cpp b/src/gallium/state_trackers/clover/core/platform.cpp
+new file mode 100644
+index 0000000..f557ef2
+--- a/dev/null
++++ b/src/gallium/state_trackers/clover/core/platform.cpp
+@@ -0,0 +1,38 @@
++//
++// Copyright 2012 Francisco Jerez
++//
++// Permission is hereby granted, free of charge, to any person obtaining a
++// copy of this software and associated documentation files (the "Software"),
++// to deal in the Software without restriction, including without limitation
++// the rights to use, copy, modify, merge, publish, distribute, sublicense,
++// and/or sell copies of the Software, and to permit persons to whom the
++// Software is furnished to do so, subject to the following conditions:
++//
++// The above copyright notice and this permission notice shall be included in
++// all copies or substantial portions of the Software.
++//
++// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
++// THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
++// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
++// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
++// SOFTWARE.
++//
++
++#include "core/platform.hpp"
++
++using namespace clover;
++
++_cl_platform_id::_cl_platform_id() {
++ int n = pipe_loader_probe(NULL, 0);
++ std::vector<pipe_loader_device *> ldevs(n);
++
++ pipe_loader_probe(&ldevs.front(), n);
++
++ for (pipe_loader_device *ldev : ldevs) {
++ try {
++ devs.emplace_back(this, ldev);
++ } catch (error &) {}
++ }
++}
+diff --git a/src/gallium/state_trackers/clover/core/platform.hpp b/src/gallium/state_trackers/clover/core/platform.hpp
+new file mode 100644
+index 0000000..eeb6d60
+--- a/dev/null
++++ b/src/gallium/state_trackers/clover/core/platform.hpp
+@@ -0,0 +1,66 @@
++//
++// Copyright 2013 Francisco Jerez
++//
++// Permission is hereby granted, free of charge, to any person obtaining a
++// copy of this software and associated documentation files (the "Software"),
++// to deal in the Software without restriction, including without limitation
++// the rights to use, copy, modify, merge, publish, distribute, sublicense,
++// and/or sell copies of the Software, and to permit persons to whom the
++// Software is furnished to do so, subject to the following conditions:
++//
++// The above copyright notice and this permission notice shall be included in
++// all copies or substantial portions of the Software.
++//
++// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
++// THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
++// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
++// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
++// SOFTWARE.
++//
++
++#ifndef __CORE_PLATFORM_HPP__
++#define __CORE_PLATFORM_HPP__
++
++#include <vector>
++
++#include "core/base.hpp"
++#include "core/device.hpp"
++
++namespace clover {
++ typedef struct _cl_platform_id platform;
++}
++
++struct _cl_platform_id {
++public:
++ typedef std::vector<clover::device>::iterator iterator;
++
++ _cl_platform_id();
++
++ ///
++ /// Container of all compute devices that are available in the platform.
++ ///
++ /// @{
++ iterator begin() {
++ return devs.begin();
++ }
++
++ iterator end() {
++ return devs.end();
++ }
++
++ clover::device &front() {
++ return devs.front();
++ }
++
++ clover::device &back() {
++ return devs.back();
++ }
++ /// @}
++
++protected:
++ std::vector<clover::device> devs;
++};
++
++#endif
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/media-libs/mesa/mesa-9999.ebuild b/media-libs/mesa/mesa-9999.ebuild
index f679276e..66829549 100644
--- a/media-libs/mesa/mesa-9999.ebuild
+++ b/media-libs/mesa/mesa-9999.ebuild
@@ -173,7 +173,7 @@ src_prepare() {
epatch "${FILESDIR}"/${P}-dont-require-llvm-for-r300.patch
# use non-NULL platform id
- epatch "${FILESDIR}/${P}-clover-use-non-null-platform-id.patch"
+ epatch "${FILESDIR}/${P}-use-a-struct-for-cl_platform_id.patch"
# fix for hardened pax_kernel, bug 240956
[[ ${PV} != 9999* ]] && epatch "${FILESDIR}"/glx_ro_text_segm.patch