extra/libdrm to 2.4.94-1

This commit is contained in:
Kevin Mihelich 2018-09-04 13:56:59 +00:00
parent 9ab67c66bf
commit e81caed35c
4 changed files with 174 additions and 4 deletions

View file

@ -0,0 +1,81 @@
From bcb9d976cd91c018aa4eef13563813288984601f Mon Sep 17 00:00:00 2001
From: Emil Velikov <emil.velikov@collabora.com>
Date: Thu, 23 Aug 2018 10:49:54 +0100
Subject: [PATCH 1/3] xf86drm: fallback to normal path when realpath fails
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Earlier commit reworked our sysfs handling to use realpath.
Sadly that backfired since the Firefox sandboxing mechanism rejects
that. Despite the files/folders being in the allowed list, of the
sandboxing mechanism.
Oddly enough, the Chromium sandboxing doesn't complain about any of
this.
Since there are no Firefox releases with the fix, add a temporary
solution which falls back to the original handling.
Sadly, this won't work for virgl.
v2: drop return type - function cannot return NULL (Eric)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107516
Fixes: a02900133b3 ("xf86drm: introduce a get_real_pci_path() helper")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Signed-off-by: Laurent Carlier <lordheavym@gmail.com>
---
xf86drm.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/xf86drm.c b/xf86drm.c
index 336d64de..7807dce9 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -3014,6 +3014,12 @@ get_real_pci_path(int maj, int min, char *real_path)
return real_path;
}
+static void
+get_normal_pci_path(int maj, int min, char *normal_path)
+{
+ snprintf(normal_path, PATH_MAX, "/sys/dev/char/%d:%d/device", maj, min);
+}
+
static int drmParsePciBusInfo(int maj, int min, drmPciBusInfoPtr info)
{
#ifdef __linux__
@@ -3022,7 +3028,7 @@ static int drmParsePciBusInfo(int maj, int min, drmPciBusInfoPtr info)
int num;
if (get_real_pci_path(maj, min, real_path) == NULL)
- return -ENOENT;
+ get_normal_pci_path(maj, min, real_path);
value = sysfs_uevent_get(real_path, "PCI_SLOT_NAME");
if (!value)
@@ -3143,7 +3149,7 @@ static int parse_separate_sysfs_files(int maj, int min,
int ret;
if (get_real_pci_path(maj, min, real_path) == NULL)
- return -ENOENT;
+ get_normal_pci_path(maj, min, real_path);
for (unsigned i = ignore_revision ? 1 : 0; i < ARRAY_SIZE(attrs); i++) {
snprintf(path, PATH_MAX, "%s/%s", real_path, attrs[i]);
@@ -3175,7 +3181,7 @@ static int parse_config_sysfs_file(int maj, int min,
int fd, ret;
if (get_real_pci_path(maj, min, real_path) == NULL)
- return -ENOENT;
+ get_normal_pci_path(maj, min, real_path);
snprintf(path, PATH_MAX, "%s/config", real_path);
fd = open(path, O_RDONLY);
--
2.18.0

View file

@ -0,0 +1,27 @@
From f3d90e8db42d8d8a839558c0bc4c368c0107a4b9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <michel.daenzer@amd.com>
Date: Mon, 27 Aug 2018 11:48:48 +0200
Subject: [PATCH 2/3] amdgpu-symbol-check: Add amdgpu_find_bo_by_cpu_mapping
Fixes: 4d454424e1f2 ("amdgpu: add a function to find bo by cpu mapping
(v2)"
Signed-off-by: Laurent Carlier <lordheavym@gmail.com>
---
amdgpu/amdgpu-symbol-check | 1 +
1 file changed, 1 insertion(+)
diff --git a/amdgpu/amdgpu-symbol-check b/amdgpu/amdgpu-symbol-check
index 90b7a1d6..b5e4fe60 100755
--- a/amdgpu/amdgpu-symbol-check
+++ b/amdgpu/amdgpu-symbol-check
@@ -53,6 +53,7 @@ amdgpu_cs_wait_fences
amdgpu_cs_wait_semaphore
amdgpu_device_deinitialize
amdgpu_device_initialize
+amdgpu_find_bo_by_cpu_mapping
amdgpu_get_marketing_name
amdgpu_query_buffer_size_alignment
amdgpu_query_crtc_from_id
--
2.18.0

View file

@ -0,0 +1,52 @@
From f17725108809efaaf139f141808d537d14db3708 Mon Sep 17 00:00:00 2001
From: Junwei Zhang <Jerry.Zhang@amd.com>
Date: Thu, 30 Aug 2018 17:35:40 +0800
Subject: [PATCH 3/3] amdgpu: add error return value for finding bo by cpu
mapping (v2)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If nothing is found, error should be returned.
v2: udpate the error value different from parameter check
Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Laurent Carlier <lordheavym@gmail.com>
---
amdgpu/amdgpu_bo.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/amdgpu/amdgpu_bo.c b/amdgpu/amdgpu_bo.c
index 2f4f90f6..a2fc5250 100644
--- a/amdgpu/amdgpu_bo.c
+++ b/amdgpu/amdgpu_bo.c
@@ -549,8 +549,9 @@ int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev,
amdgpu_bo_handle *buf_handle,
uint64_t *offset_in_bo)
{
- uint32_t i;
struct amdgpu_bo *bo;
+ uint32_t i;
+ int r = 0;
if (cpu == NULL || size == 0)
return -EINVAL;
@@ -577,10 +578,11 @@ int amdgpu_find_bo_by_cpu_mapping(amdgpu_device_handle dev,
} else {
*buf_handle = NULL;
*offset_in_bo = 0;
+ r = -ENXIO;
}
pthread_mutex_unlock(&dev->bo_table_mutex);
- return 0;
+ return r;
}
int amdgpu_create_bo_from_user_mem(amdgpu_device_handle dev,
--
2.18.0

View file

@ -6,7 +6,7 @@
# - drop valgrind makdepend
pkgname=libdrm
pkgver=2.4.93
pkgver=2.4.94
pkgrel=1
pkgdesc="Userspace interface to kernel DRM services"
url="https://dri.freedesktop.org/"
@ -16,12 +16,17 @@ depends=('libpciaccess')
makedepends=('libxslt' 'docbook-xsl' 'meson')
checkdepends=('cairo')
replaces=('libdrm-new' 'libdrm-nouveau')
source=(https://dri.freedesktop.org/$pkgname/$pkgname-$pkgver.tar.bz2{,.sig}
source=(https://dri.freedesktop.org/$pkgname/$pkgname-$pkgver.tar.bz2 #{,.sig}
no-drmdevice-test.diff
0001-xf86drm-fallback-to-normal-path-when-realpath-fails.patch
0002-amdgpu-symbol-check-Add-amdgpu_find_bo_by_cpu_mappin.patch
0003-amdgpu-add-error-return-value-for-finding-bo-by-cpu-.patch
COPYING)
sha512sums=('ba4221e8d6a3a9872fb6d30a0ea391e30ea0e17f249c66f067bed9c2161ed1ad8083959cb2c212834c6566c3e025f4daae31e9533d77aae19bbbbb9de6c2ab3d'
'SKIP'
sha512sums=('1a1699d6ea70b8759b37f3863e0802a99430b58f02e62632ad451356e2463eaf6faf4b810323f7dcc85ffdcca28f674b32caa5631ebd65b83e5b86bd59a35937'
'f1dd5d8c2270c092ccb8e4f92a0da9ab27706dfa22dcedd3fb2414b968ced9333c8bf62baf0219b822e43dce0d804d1dd5cc27d09b0afe8c01967c1784d4a4bb'
'abdbb6a53db4abb31c2884cfc8b753be112bff50f112f36adbd8179ad84dc2d706e27175ca9c12d0a5cc059367314850a496a3bf6083ee7ca6eae8fa6466a83c'
'1acb785be6dffad791945d56321d773d88584ec162983493e8cb66d80563bcbb4b2bb50ce223b5945b38dad0c4926e532bf3633676f15af3546b479372a485c6'
'9cc8e9900b12ea0fefce8dae55da5637c9df30f7309bc2ecd9edc1e116be4af047f951c855c5864681a3ef339dd1267835cc5aad47cb66b518b6c62830448cd1'
'b0ca349b882a4326b19f81f22804fabdb6fb7aef31cdc7b16b0a7ae191bfbb50c7daddb2fc4e6c33f1136af06d060a273de36f6f3412ea326f16fa4309fda660')
validpgpkeys=('B97BD6A80CAC4981091AE547FE558C72A67013C3') # Maarten Lankhorst <maarten.lankhorst@canonical.com>
validpgpkeys+=('215DEE688925CCB965BE5DA97C03D7797B6E1AE2') # Damien Lespiau <damien.lespiau@intel.com>
@ -41,6 +46,11 @@ prepare() {
# Fails in a container; autotools skipped this one already
patch -Np1 -i ../no-drmdevice-test.diff
# upstream fixes
patch -Np1 -i ../0001-xf86drm-fallback-to-normal-path-when-realpath-fails.patch
patch -Np1 -i ../0002-amdgpu-symbol-check-Add-amdgpu_find_bo_by_cpu_mappin.patch
patch -Np1 -i ../0003-amdgpu-add-error-return-value-for-finding-bo-by-cpu-.patch
}
build() {