unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: taylanbayirli@gmail.com (Taylan Ulrich Bayırlı/Kammer)
To: guix-devel@gnu.org
Subject: [PATCHES] Mesa dlopen() calls & more optional features
Date: Tue, 17 Mar 2015 17:26:55 +0100	[thread overview]
Message-ID: <87h9tj614g.fsf@taylan.uni.cx> (raw)

[-- Attachment #1: Type: text/plain, Size: 431 bytes --]

Here's a pair of patches, the first patching all non-absolute dlopen()
uses I could detect (except for GBM), and the second enabling a few
optional features of Mesa, including GBM, and adding that last GBM
dlopen() patch.  (My intent is to keep the patches stylistically
agnostic to each other; I guess it doesn't really matter much.)  (And
FWIW, GBM is enabled automatically when one enables the DRM platform
support for EGL...)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch1 --]
[-- Type: text/x-diff, Size: 2758 bytes --]

From 8e3324c0b5d63aa3d53341b7dea090c9a64d3c40 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <taylanbayirli@gmail.com>
Date: Sat, 14 Mar 2015 14:57:27 +0100
Subject: [PATCH 5/6] gnu: mesa: Fix file names passed to dlopen(3).

* gnu/packages/gl.scm (mesa): Patch source files to make file names passed to
  dlopen(3) absolute.
---
 gnu/packages/gl.scm | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index 5e2f72a..e811142 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -222,16 +222,30 @@ also known as DXTn or DXTC) for Mesa.")
                     (substitute* "src/glsl/tests/lower_jumps/create_test_cases.py"
                       (("/usr/bin/env bash") (which "bash"))))
                   (alist-cons-before
-                   'build 'fix-dxtn-libname
-                   (lambda* (#:key inputs #:allow-other-keys)
-                     (let ((s2tc (assoc-ref inputs "s2tc")))
+                   'build 'fix-dlopen-libnames
+                   (lambda* (#:key inputs outputs #:allow-other-keys)
+                     (let ((s2tc (assoc-ref inputs "s2tc"))
+                           (udev (assoc-ref inputs "udev"))
+                           (out (assoc-ref outputs "out")))
                        ;; Remain agnostic to .so.X.Y.Z versions while doing
                        ;; the substitutions so we're future-safe.
                        (substitute*
                            '("src/gallium/auxiliary/util/u_format_s3tc.c"
                              "src/mesa/main/texcompress_s3tc.c")
                          (("\"libtxc_dxtn\\.so")
-                          (string-append "\"" s2tc "/lib/libtxc_dxtn.so")))))
+                          (string-append "\"" s2tc "/lib/libtxc_dxtn.so")))
+                       (substitute* "src/gallium/targets/egl-static/egl_st.c"
+                         (("\"libglapi\"")
+                          (string-append "\"" out "/lib/libglapi\"")))
+                       (substitute* "src/loader/loader.c"
+                         (("dlopen\\(\"libudev\\.so")
+                          (string-append "dlopen(\"" udev "/lib/libudev.so")))
+                       (substitute* "src/glx/dri_common.c"
+                         (("dlopen\\(\"libGL\\.so")
+                          (string-append "dlopen(\"" out "/lib/libGL.so")))
+                       (substitute* "src/egl/drivers/dri2/egl_dri2.c"
+                         (("\"libglapi\\.so")
+                          (string-append "\"" out "/lib/libglapi.so")))))
                    %standard-phases)))))
     (home-page "http://mesa3d.org/")
     (synopsis "OpenGL implementation")
-- 
2.2.1


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: patch2 --]
[-- Type: text/x-diff, Size: 2154 bytes --]

From 5deb64affa47dfa9a9521dc20fbbc58e90f1f7e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <taylanbayirli@gmail.com>
Date: Tue, 17 Mar 2015 17:15:52 +0100
Subject: [PATCH 6/6] gnu: mesa: Enable more optional features.

* gnu/packages/gl.scm (mesa): Enable DRM support of EGL, thread local storage
  in GLX, and off-screen rendering.
---
 gnu/packages/gl.scm | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gl.scm b/gnu/packages/gl.scm
index e811142..ef0485c 100644
--- a/gnu/packages/gl.scm
+++ b/gnu/packages/gl.scm
@@ -198,6 +198,13 @@ also known as DXTn or DXTC) for Mesa.")
      `(#:configure-flags
        '(;; drop r300 from default gallium drivers, as it requires llvm
          "--with-gallium-drivers=r600,svga,swrast"
+         ;; Enable various optional features.  TODO: opencl requires libclc,
+         ;; omx requires libomxil-bellagio
+         "--with-egl-platforms=x11,drm"
+         "--enable-glx-tls"        ;Thread Local Storage, improves performance
+         ;; "--enable-opencl"
+         ;; "--enable-omx"
+         "--enable-osmesa"
          "--enable-xa"
 
          ;; on non-intel systems, drop i915 and i965
@@ -245,7 +252,13 @@ also known as DXTn or DXTC) for Mesa.")
                           (string-append "dlopen(\"" out "/lib/libGL.so")))
                        (substitute* "src/egl/drivers/dri2/egl_dri2.c"
                          (("\"libglapi\\.so")
-                          (string-append "\"" out "/lib/libglapi.so")))))
+                          (string-append "\"" out "/lib/libglapi.so")))
+                       (substitute* "src/gbm/main/backend.c"
+                         ;; No need to patch the gbm_gallium_drm.so reference;
+                         ;; it's never installed since Mesa removed its
+                         ;; egl_gallium support.
+                         (("\"gbm_dri\\.so")
+                          (string-append "\"" out "/lib/dri/gbm_dri.so")))))
                    %standard-phases)))))
     (home-page "http://mesa3d.org/")
     (synopsis "OpenGL implementation")
-- 
2.2.1


             reply	other threads:[~2015-03-17 16:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-17 16:26 Taylan Ulrich Bayırlı/Kammer [this message]
2015-03-19 16:04 ` [PATCHES] Mesa dlopen() calls & more optional features Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h9tj614g.fsf@taylan.uni.cx \
    --to=taylanbayirli@gmail.com \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).