From 054d488fb5d593dd8004f006a43aab3542cf854f Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Thu, 1 Mar 2018 17:22:27 +0100 Subject: [PATCH] Backport fix for broken amdgpu Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1550616 Signed-off-by: Igor Gnatenko --- ...ake-in-initial-hole-size-calculation.patch | 39 ++++++++++ ...se-cairo-valgrind-if-it-was-disabled.patch | 54 -------------- ...o-not-use-cairo-valgrind-if-disabled.patch | 74 +++++++++++++++++++ libdrm.spec | 10 ++- 4 files changed, 120 insertions(+), 57 deletions(-) create mode 100644 0001-amdgpu-Fix-mistake-in-initial-hole-size-calculation.patch delete mode 100644 0001-meson-do-not-use-cairo-valgrind-if-it-was-disabled.patch create mode 100644 0002-meson-do-not-use-cairo-valgrind-if-disabled.patch diff --git a/0001-amdgpu-Fix-mistake-in-initial-hole-size-calculation.patch b/0001-amdgpu-Fix-mistake-in-initial-hole-size-calculation.patch new file mode 100644 index 0000000..5c947e4 --- /dev/null +++ b/0001-amdgpu-Fix-mistake-in-initial-hole-size-calculation.patch @@ -0,0 +1,39 @@ +From 1fc0d158b55d3e833c0d819e48494b7013a44ebe Mon Sep 17 00:00:00 2001 +From: Andrey Grodzovsky +Date: Mon, 19 Feb 2018 02:18:36 -0500 +Subject: [PATCH 1/2] amdgpu: Fix mistake in initial hole size calculation. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Andrey Grodzovsky +Acked-by: Christian König +(cherry picked from commit 33a2851ab9bc3cd8a68bedf4cf0fdc549b0f3596) +--- + amdgpu/amdgpu_vamgr.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/amdgpu/amdgpu_vamgr.c b/amdgpu/amdgpu_vamgr.c +index 722067f3..58400428 100644 +--- a/amdgpu/amdgpu_vamgr.c ++++ b/amdgpu/amdgpu_vamgr.c +@@ -57,7 +57,7 @@ drm_private void amdgpu_vamgr_init(struct amdgpu_bo_va_mgr *mgr, uint64_t start, + pthread_mutex_init(&mgr->bo_va_mutex, NULL); + pthread_mutex_lock(&mgr->bo_va_mutex); + n = calloc(1, sizeof(struct amdgpu_bo_va_hole)); +- n->size = mgr->va_max; ++ n->size = mgr->va_max - start; + n->offset = start; + list_add(&n->list, &mgr->va_holes); + pthread_mutex_unlock(&mgr->bo_va_mutex); +@@ -80,6 +80,7 @@ amdgpu_vamgr_find_va(struct amdgpu_bo_va_mgr *mgr, uint64_t size, + struct amdgpu_bo_va_hole *hole, *n; + uint64_t offset = 0, waste = 0; + ++ + alignment = MAX2(alignment, mgr->va_alignment); + size = ALIGN(size, mgr->va_alignment); + +-- +2.16.2 + diff --git a/0001-meson-do-not-use-cairo-valgrind-if-it-was-disabled.patch b/0001-meson-do-not-use-cairo-valgrind-if-it-was-disabled.patch deleted file mode 100644 index 5f99e9c..0000000 --- a/0001-meson-do-not-use-cairo-valgrind-if-it-was-disabled.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 1d4f23eeafb0fe97f086f19dd5588503d77dea3f Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Sun, 18 Feb 2018 13:56:39 +0100 -Subject: [PATCH libdrm] meson: do not use cairo/valgrind if it was disabled - --Dcairo-tests=false currently results into enabling cairo support if it -was found. - -Signed-off-by: Igor Gnatenko ---- - meson.build | 20 ++++++++++++++++---- - 1 file changed, 16 insertions(+), 4 deletions(-) - -diff --git a/meson.build b/meson.build -index 166559e8..695f89b3 100644 ---- a/meson.build -+++ b/meson.build -@@ -226,8 +226,20 @@ endforeach - - dep_pciaccess = dependency('pciaccess', version : '>= 0.10', required : with_intel) - dep_cunit = dependency('cunit', version : '>= 2.1', required : false) --dep_cairo = dependency('cairo', required : with_cairo_tests == 'true') --dep_valgrind = dependency('valgrind', required : with_valgrind == 'true') -+if with_cairo_tests != 'false' -+ dep_cairo = dependency('cairo', required : with_cairo_tests == 'true') -+ with_cairo_tests = dep_cairo.found() -+else -+ dep_cairo = declare_dependency() -+ with_cairo_tests = false -+endif -+if with_valgrind != 'false' -+ dep_valgrind = dependency('valgrind', required : with_valgrind == 'true') -+ with_valgrind = dep_valgrind.found() -+else -+ dep_valgrind = declare_dependency() -+ with_valgrind = false -+endif - - with_man_pages = get_option('man-pages') - prog_xslt = find_program('xsltproc', required : with_man_pages == 'true') -@@ -259,8 +271,8 @@ foreach t : [ - [with_radeon, 'RADEON'], - [with_vc4, 'VC4'], - [with_vmwgfx, 'VMWGFX'], -- [dep_cairo.found(), 'CAIRO'], -- [dep_valgrind.found(), 'VALGRIND'], -+ [with_cairo_tests, 'CAIRO'], -+ [with_valgrind, 'VALGRIND'], - ] - config.set10('HAVE_@0@'.format(t[1]), t[0]) - endforeach --- -2.16.2 - diff --git a/0002-meson-do-not-use-cairo-valgrind-if-disabled.patch b/0002-meson-do-not-use-cairo-valgrind-if-disabled.patch new file mode 100644 index 0000000..232c94a --- /dev/null +++ b/0002-meson-do-not-use-cairo-valgrind-if-disabled.patch @@ -0,0 +1,74 @@ +From 8ba6cd71db51c245ca4bf4648a61c74a4e06741e Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Mon, 19 Feb 2018 13:55:27 +0100 +Subject: [PATCH 2/2] meson: do not use cairo/valgrind if disabled + +-Dcairo-tests=false currently results into enabling cairo support if it +was found. Same for valgrind. + +v2: +* Use underscore-prefixed variables to not change type of variable +* Use empty array for "fake" dependency instead of real empty object + +v3: +* Fix typo + +Reviewed-by: Eric Engestrom +Signed-off-by: Igor Gnatenko +(cherry picked from commit 9411f8ea03a4c019a0069845545cae45136596fc) +--- + meson.build | 24 ++++++++++++++++++------ + 1 file changed, 18 insertions(+), 6 deletions(-) + +diff --git a/meson.build b/meson.build +index 4aaeb7e1..fbde0546 100644 +--- a/meson.build ++++ b/meson.build +@@ -32,8 +32,6 @@ pkg = import('pkgconfig') + with_udev = get_option('udev') + with_freedreno_kgsl = get_option('freedreno-kgsl') + with_install_tests = get_option('install-test-programs') +-with_cairo_tests = get_option('cairo-tests') +-with_valgrind = get_option('valgrind') + + config = configuration_data() + +@@ -226,8 +224,22 @@ endforeach + + dep_pciaccess = dependency('pciaccess', version : '>= 0.10', required : with_intel) + dep_cunit = dependency('cunit', version : '>= 2.1', required : false) +-dep_cairo = dependency('cairo', required : with_cairo_tests == 'true') +-dep_valgrind = dependency('valgrind', required : with_valgrind == 'true') ++_cairo_tests = get_option('cairo-tests') ++if _cairo_tests != 'false' ++ dep_cairo = dependency('cairo', required : _cairo_tests == 'true') ++ with_cairo_tests = dep_cairo.found() ++else ++ dep_cairo = [] ++ with_cairo_tests = false ++endif ++_valgrind = get_option('valgrind') ++if _valgrind != 'false' ++ dep_valgrind = dependency('valgrind', required : _valgrind == 'true') ++ with_valgrind = dep_valgrind.found() ++else ++ dep_valgrind = [] ++ with_valgrind = false ++endif + + with_man_pages = get_option('man-pages') + prog_xslt = find_program('xsltproc', required : with_man_pages == 'true') +@@ -259,8 +271,8 @@ foreach t : [ + [with_radeon, 'RADEON'], + [with_vc4, 'VC4'], + [with_vmwgfx, 'VMWGFX'], +- [dep_cairo.found(), 'CAIRO'], +- [dep_valgrind.found(), 'VALGRIND'], ++ [with_cairo_tests, 'CAIRO'], ++ [with_valgrind, 'VALGRIND'], + ] + config.set10('HAVE_@0@'.format(t[1]), t[0]) + endforeach +-- +2.16.2 + diff --git a/libdrm.spec b/libdrm.spec index 6169bb3..4ad7baf 100644 --- a/libdrm.spec +++ b/libdrm.spec @@ -48,15 +48,16 @@ end} Name: libdrm Summary: Direct Rendering Manager runtime library Version: 2.4.90 -Release: 1%{?dist} +Release: 2%{?dist} License: MIT URL: https://dri.freedesktop.org Source0: %{url}/libdrm/%{name}-%{version}.tar.bz2 Source2: 91-drm-modeset.rules -# https://lists.freedesktop.org/archives/dri-devel/2018-February/166184.html -Patch0001: 0001-meson-do-not-use-cairo-valgrind-if-it-was-disabled.patch +# Backports from upstream +Patch0001: 0001-amdgpu-Fix-mistake-in-initial-hole-size-calculation.patch +Patch0002: 0002-meson-do-not-use-cairo-valgrind-if-disabled.patch BuildRequires: meson >= 0.43 BuildRequires: gcc @@ -286,6 +287,9 @@ install -Dpm0644 -t %{buildroot}%{_udevrulesdir} %{S:2} %endif %changelog +* Thu Mar 01 2018 Igor Gnatenko - 2.4.90-2 +- Backport fix for broken amdgpu + * Sun Feb 18 2018 Igor Gnatenko - 2.4.90-1 - Update to 2.4.90 - Switch to meson buildsystem