Bug 214581

Summary: graphics/dri: Update the Mesa ports to 13.0.3
Product: Ports & Packages Reporter: Matthew Rezny <rezny>
Component: Individual Port(s)Assignee: Koop Mast <kwm>
Status: Closed FIXED    
Severity: Affects Many People CC: kwm, meowthink, mnd999, rezny
Priority: --- Flags: bugzilla: maintainer-feedback? (x11)
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on: 214580, 214883    
Bug Blocks:    
Description Flags
update Mesa ports to 13.0.1
update Mesa ports to 13.0.1
update Mesa ports to 13.0.2
update Mesa ports to 13.0.3
update Mesa ports to 13.0.3 none

Description Matthew Rezny freebsd_committer 2016-11-16 20:24:01 UTC
Created attachment 177088 [details]
update Mesa ports to 13.0.1

I'm moving the local diffs I've been maintaining for far too long into PRs since the flow to and from the external repo has become too slow with only two partially active members of graphics team remaining. I have tried to incorporate most of the work from the external repo that is ports-ready in my local patches. It is my hope that making the changes available in reasonable chunks and visible in PRs will lead to quicker commit to the ports tree than leaving the updates to languish in an external repo.

This is an update of the Mesa ports (graphics/dri,gbm,libglapi,libglesv2,libGL,libEGL) to 13.0.1. This is a leap straight from the tail of 11.x to the start of 13.x, no need to bother with any version from 12.x. Jumping to v13 allows to drop all the libdevq patches since Mesa now relies on libdrm to find the graphics hardware (part of the need to update libdrm and add the libdevq support there). This update does need a newer version of LLVM, which has just become available with the necessary libLLVM.so (part of the reason to flush these ports now). I've had to add a few patches through the course of v12 and a couple more for v13, some of which should definitely go upstream. Existing, non-obsolete patches have been refreshed in the course of many updates. This patch is ahead of the external repo (which is at 12.0.4, incomplete and untested), but specifically excludes the experimental DRI3 switches added in that repo since there is no support for DRI3 in the DRM drivers we have in kernel. There is far too much churn to itemize changes.

QA: I have been running Mesa 12.x for many months on multiple 10/11-STABLE amd64 systems with both Radeon and Intel hardware for months and have recently been running Mesa 13 on 11-STABLE amd64 with Radeon GPU. Everything passes stage-qa and check-orphans.
Comment 1 Matthew Rezny freebsd_committer 2016-11-21 15:50:52 UTC
Created attachment 177235 [details]
update Mesa ports to 13.0.1

I have refreshed the patch to remove the stale libdevq dependency and to remove a stale distinfo file form graphics/libosmesa, which is also one of the Mesa slave ports.
Comment 2 Koop Mast freebsd_committer 2016-11-21 19:01:58 UTC
I think this mesa release should get some more testing before commit. I also want to bump the llvm requirement in this version together with libclc/beignet/pocl too. 

I'm working on updating to mesa 12.0.4 in the mean time.
Comment 3 Mark Dixon 2016-11-23 20:28:47 UTC
I get:

../../../../src/gallium/state_trackers/clover/.libs/libclover.a(libclllvm_la-invocation.o): In function `(anonymous namespace)::create_compiler_instance(clover::llvm::target const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&)':
/usr/ports/graphics/dri/work/mesa-13.0.1/src/gallium/state_trackers/clover/llvm/invocation.cpp:108: undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::c_str() const'
/usr/bin/ld: ../../../../src/gallium/state_trackers/clover/.libs/libclover.a(libclllvm_la-invocation.o): relocation R_X86_64_PC32 against `_ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5c_strEv' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
Comment 4 Matthew Rezny freebsd_committer 2016-11-27 16:13:55 UTC
(In reply to Mark Dixon from comment #3)

I saw a very similar but different error when trying to build with LLVM 3.8 while working on Mesa 12.0.4 and 13.0.1, but saw no such error with LLVM 3.9 so assumed it was resolved and decided to punt on LLVM 3.8 and Mesa 12.x entirely. There may be some issue with multiple LLVM versions present, possibly picking up the static libs from 3.7 instead of the dynamic lib from 3.9, or there may be some issue with an older libclc, which is a build dep and also tied to a LLVM version. I have submitted a libclc update in PR 214883. Try updating libclc and purging past LLVM versions before building the Mesa ports.
Comment 5 Matthew Rezny freebsd_committer 2016-11-28 19:51:31 UTC
Created attachment 177492 [details]
update Mesa ports to 13.0.2

Mesa 13.0.2 was released today so I have updated the patch after some quick testing.
Comment 6 meowthink 2016-12-27 07:57:45 UTC
(In reply to Mark Dixon from comment #3)
Same error on my STABLE-10.
A quick diagnostic on the problem shows that something wrong generated by clang in combine with libc++ from the base. There's such a call map(std::mem_fn(&std::string::c_str) in /src/gallium/state_trackers/clover/llvm/invocation.cpp line 108 which results such unresolvable symbol, _ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5c_strEv.
This symbol actually exists in libc++.a but not .so. Even strange, clang within an i386 chroot won't generate such symbol in corresponding files, resulting a complete build. Anyway, I think this is OpenCL related only and can be ignored, yet.
Comment 7 Matthew Rezny freebsd_committer 2017-01-15 12:43:23 UTC
Created attachment 178914 [details]
update Mesa ports to 13.0.3

Mesa 13.0.3 was released so the patch is updated. Also, I added another patch to clover to fix the build issues seen on any version of Clang other than 3.8 (it just happened to have been ok on 11.0), and configure patch to correct a build issue on 10 i386 with old Clang 3.4.

This has been tested on 11-STABLE (clang 3.9) amd64, ppc64, on 11.0 (Clang 3.9) amd64, i386, and on on 10.3 (Clang 3.4) amd64, i386
Comment 8 Matthew Rezny freebsd_committer 2017-01-19 08:45:57 UTC
Created attachment 179062 [details]
update Mesa ports to 13.0.3

After further testing I found an issue with the previous patch. The question had been raised why glx-tls was not enabled, so I tried enabling it version of FreeBSD where we have thread local storage. While that worked for simple tests, e.g. glxgears and openarena, it caused more demanding programs, e.g. xonotic and nexuiz, to segfault in glXMakeCurrentReadSGI. Thus, I have reverted that change in the 13.0.3 update. Additionally, DRI3 is no longer disabled. Testing shows it is not used if the supporting parts are not present so there is no harm in general and it may benefit those on drm-next.
Comment 9 commit-hook freebsd_committer 2017-02-11 13:32:09 UTC
A commit references this bug:

Author: rezny
Date: Sat Feb 11 13:32:01 UTC 2017
New revision: 433862
URL: https://svnweb.freebsd.org/changeset/ports/433862

  Update Mesa to 13.0.4

  * Use LLVM 3.9
  * OpenGL 4.4 support for recent Intel and ReadeonSI

  PR:	214581
  Approved by:	swills (mentor)
  Differential Revision:	https://reviews.freebsd.org/D9438