Unverified Commit c3cbafb1 authored by K900's avatar K900 Committed by GitHub
Browse files

mesa: 25.0.5 -> 25.1.1 (#399388)

parents 8a07db95 c80aab43
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -5,14 +5,14 @@
# nix build .#legacyPackages.x86_64-darwin.mesa .#legacyPackages.aarch64-darwin.mesa
rec {
  pname = "mesa";
  version = "25.0.6";
  version = "25.1.1";

  src = fetchFromGitLab {
    domain = "gitlab.freedesktop.org";
    owner = "mesa";
    repo = "mesa";
    rev = "mesa-${version}";
    hash = "sha256-SuSs8rwcu3GizOFfoUQZkVfwS1gxihgnmIGnD90YS54=";
    hash = "sha256-Vk5sE7D8XHDOtxq0ax2a3FmQFWp7IDP4Y510EpnKWo4=";
  };

  meta = {
+22 −8
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
  libdrm,
  libgbm,
  libglvnd,
  libpng,
  libunwind,
  libva-minimal,
  libvdpau,
@@ -45,10 +46,12 @@

  galliumDrivers ?
    [
      "asahi" # Apple AGX, built on non-aarch64 for cross tools
      "d3d12" # WSL emulated GPU (aka Dozen)
      "iris" # new Intel (Broadwell+)
      "llvmpipe" # software renderer
      "nouveau" # Nvidia
      "panfrost" # ARM Mali Midgard and up (T/G series), built on non-ARM for cross tools
      "r300" # very old AMD
      "r600" # less old AMD
      "radeonsi" # new AMD (GCN+)
@@ -61,7 +64,6 @@
      "etnaviv" # Vivante GPU designs (mostly NXP/Marvell SoCs)
      "freedreno" # Qualcomm Adreno (all Qualcomm SoCs)
      "lima" # ARM Mali 4xx
      "panfrost" # ARM Mali Midgard and up (T/G series)
      "vc4" # Broadcom VC4 (Raspberry Pi 0-3)
    ]
    ++ lib.optionals stdenv.hostPlatform.isAarch64 [
@@ -75,6 +77,7 @@
  vulkanDrivers ?
    [
      "amd" # AMD (aka RADV)
      "asahi" # Apple AGX, built on non-aarch64 for cross tools
      "intel" # new Intel (aka ANV)
      "microsoft-experimental" # WSL virtualized GPU (aka DZN/Dozen)
      "nouveau" # Nouveau (aka NVK)
@@ -103,8 +106,10 @@
  ],
  vulkanLayers ? [
    "device-select"
    "overlay"
    "intel-nullhw"
    "overlay"
    "screenshot"
    "vram-report-limit"
  ],
  mesa,
  mesa-gl-headers,
@@ -161,7 +166,6 @@ stdenv.mkDerivation {

  patches = [
    ./opencl.patch
    ./system-gbm.patch
  ];

  postPatch = ''
@@ -223,7 +227,6 @@ stdenv.mkDerivation {
      (lib.mesonBool "libgbm-external" true)

      (lib.mesonBool "gallium-nine" false) # Direct3D9 in Wine, largely supplanted by DXVK
      (lib.mesonBool "osmesa" false) # deprecated upstream

      # Only used by xf86-video-vmware, which has more features than VMWare's KMS driver,
      # so we're keeping it for now. Should be removed when that's no longer the case.
@@ -245,14 +248,14 @@ stdenv.mkDerivation {

      # Rusticl, new OpenCL frontend
      (lib.mesonBool "gallium-rusticl" true)
      (lib.mesonOption "gallium-rusticl-enable-drivers" "auto")

      # meson auto_features enables this, but we do not want it
      (lib.mesonEnable "android-libbacktrace" false)
      (lib.mesonEnable "microsoft-clc" false) # Only relevant on Windows (OpenCL 1.2 API on top of D3D12)

      # Build and install extra tools for cross
      (lib.mesonBool "install-mesa-clc" true)
      (lib.mesonBool "install-precomp-compiler" true)
      # Enable more sensors in gallium-hud
      (lib.mesonBool "gallium-extra-hud" true)

      # Disable valgrind on targets where it's not available
      (lib.mesonEnable "valgrind" withValgrind)
@@ -260,6 +263,12 @@ stdenv.mkDerivation {
    ++ lib.optionals enablePatentEncumberedCodecs [
      (lib.mesonOption "video-codecs" "all")
    ]
    ++ lib.optionals (!needNativeCLC) [
      # Build and install extra tools for cross
      (lib.mesonOption "tools" "asahi,panfrost")
      (lib.mesonBool "install-mesa-clc" true)
      (lib.mesonBool "install-precomp-compiler" true)
    ]
    ++ lib.optionals needNativeCLC [
      (lib.mesonOption "mesa-clc" "system")
      (lib.mesonOption "precomp-compiler" "system")
@@ -277,6 +286,7 @@ stdenv.mkDerivation {
      libdrm
      libgbm
      libglvnd
      libpng
      libunwind
      libva-minimal
      libvdpau
@@ -348,9 +358,13 @@ stdenv.mkDerivation {
  doCheck = false;

  postInstall = ''
    moveToOutput bin/asahi_clc $cross_tools
    moveToOutput bin/intel_clc $cross_tools
    moveToOutput bin/mesa_clc $cross_tools
    moveToOutput bin/vtn_bindgen $cross_tools
    moveToOutput bin/panfrost_compile $cross_tools
    moveToOutput bin/panfrost_texfeatures $cross_tools
    moveToOutput bin/panfrostdump $cross_tools
    moveToOutput bin/vtn_bindgen2 $cross_tools

    moveToOutput "lib/lib*OpenCL*" $opencl
    # Construct our own .icd file that contains an absolute path.
+2 −2
Original line number Diff line number Diff line
@@ -13,8 +13,8 @@ index c150bff74ff..37fa7f0531b 100644
 
diff --git a/meson_options.txt b/meson_options.txt
index 82324617884..4bde97a8568 100644
--- a/meson_options.txt
+++ b/meson_options.txt
--- a/meson.options
+++ b/meson.options
@@ -738,3 +738,10 @@ option(
     'none', 'dri2'
   ],
+0 −195
Original line number Diff line number Diff line
commit 69914d79c3d86b0aee80665c51074cf8cc55f660
Author: K900 <me@0upti.me>
Date:   2025-03-05 13:14:02 +0300

    meson: support building with system libgbm
    
    This is the next step towards making libgbm just a loader.

diff --git a/meson.build b/meson.build
index 4766ce838ba..300a6bb0cc8 100644
--- a/meson.build
+++ b/meson.build
@@ -2377,7 +2377,7 @@ summary(egl_summary, section: 'EGL', bool_yn: true, list_sep: ' ')
 
 gbm_summary = {'Enabled': with_gbm}
 if with_gbm
-  gbm_summary += {'Backends path': gbm_backends_path}
+  gbm_summary += {'External libgbm': get_option('libgbm-external'), 'Backends path': gbm_backends_path}
 endif
 summary(gbm_summary, section: 'GBM', bool_yn: true, list_sep: ' ')
 
diff --git a/meson_options.txt b/meson_options.txt
index 2622cf1d235..7bf8ae8a1c5 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -329,6 +329,13 @@ option(
   description : 'Build support for gbm platform'
 )
 
+option(
+  'libgbm-external',
+  type: 'boolean',
+  value: false,
+  description: 'Whether to use external libgbm (default: use in-tree copy)'
+)
+
 option(
   'gbm-backends-path',
   type : 'string',
diff --git a/src/egl/meson.build b/src/egl/meson.build
index a02b83419c4..ae4b0c5e063 100644
--- a/src/egl/meson.build
+++ b/src/egl/meson.build
@@ -108,9 +108,8 @@ if with_dri
   endif
   if with_gbm and not with_platform_android
     files_egl += files('drivers/dri2/platform_drm.c')
-    link_for_egl += libgbm
-    incs_for_egl += [inc_gbm, include_directories('../gbm/main')]
-    deps_for_egl += dep_libdrm
+    incs_for_egl += [include_directories('../gbm/backends/dri')]
+    deps_for_egl += [dep_libdrm, dep_gbm]
   endif
   if with_platform_wayland
     deps_for_egl += [dep_wayland_client, dep_wayland_server, dep_wayland_egl_headers]
diff --git a/src/gallium/targets/dril/dril_target.c b/src/gallium/targets/dril/dril_target.c
index 339e9376c3d..f1a0bb18ed8 100644
--- a/src/gallium/targets/dril/dril_target.c
+++ b/src/gallium/targets/dril/dril_target.c
@@ -25,7 +25,7 @@
 #include <dlfcn.h>
 #include <EGL/egl.h>
 #include <EGL/eglext.h>
-#include "gbm/main/gbm.h"
+#include <gbm.h>
 #include "drm-uapi/drm_fourcc.h"
 
 #define EGL_PLATFORM_GBM_MESA             0x31D7
diff --git a/src/gallium/targets/dril/meson.build b/src/gallium/targets/dril/meson.build
index 7cfa982ffe1..22b955b9074 100644
--- a/src/gallium/targets/dril/meson.build
+++ b/src/gallium/targets/dril/meson.build
@@ -51,10 +51,10 @@ dril_dri = shared_library(
   link_depends : dril_link_depends,
   link_with : [
     libgallium,
-    libgbm,
   ],
   dependencies : [
     idep_mesautil,
+    dep_gbm,
   ],
   # Will be deleted during installation, see install_megadrivers.py
   install : true,
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index a51e3cb3b8d..f1a5e0f7649 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -43,7 +43,7 @@
 
 #include "mesa_interface.h"
 #include "gbm_driint.h"
-#include "gbmint.h"
+#include <gbm_backend_abi.h>
 #include "loader_dri_helper.h"
 #include "kopper_interface.h"
 #include "loader.h"
diff --git a/src/gbm/backends/dri/gbm_driint.h b/src/gbm/backends/dri/gbm_driint.h
index 9b324aeaf12..9c7588e5726 100644
--- a/src/gbm/backends/dri/gbm_driint.h
+++ b/src/gbm/backends/dri/gbm_driint.h
@@ -31,7 +31,7 @@
 #include <xf86drm.h>
 #include <string.h>
 #include <sys/mman.h>
-#include "gbmint.h"
+#include <gbm_backend_abi.h>
 #include "c11/threads.h"
 
 #include <GL/gl.h> /* mesa_interface needs GL types */
diff --git a/src/gbm/backends/dri/meson.build b/src/gbm/backends/dri/meson.build
index 9b5d13e9db8..84a40656980 100644
--- a/src/gbm/backends/dri/meson.build
+++ b/src/gbm/backends/dri/meson.build
@@ -11,10 +11,10 @@ endif
 shared_library(
   'dri_gbm',
   files('gbm_dri.c', 'gbm_driint.h'),
-  include_directories : [incs_gbm, incs_gbm_dri, inc_st_dri, inc_gallium_aux],
+  include_directories : [inc_gallium, incs_gbm_dri, inc_loader, inc_st_dri, inc_gallium_aux],
   link_args : [ld_args_gc_sections],
   link_with : [libloader, libgallium_dri],
-  dependencies : [deps_gbm_dri, dep_dl, dep_libdrm, idep_mesautil, idep_xmlconfig],
+  dependencies : [deps_gbm_dri, dep_dl, dep_gbm, dep_libdrm, idep_mesautil, idep_xmlconfig],
   gnu_symbol_visibility : 'hidden',
   install : true,
   install_dir: join_paths(get_option('libdir'), 'gbm'),
diff --git a/src/gbm/meson.build b/src/gbm/meson.build
index eaed028d049..97e8d5fa044 100644
--- a/src/gbm/meson.build
+++ b/src/gbm/meson.build
@@ -15,10 +15,6 @@ args_gbm = [
 ]
 incs_gbm = [include_directories('main'), inc_loader, inc_gallium]
 
-if with_dri2
-  subdir('backends/dri')
-endif
-
 libgbm_name = 'gbm'
 
 if with_platform_android and get_option('platform-sdk-version') >= 30
@@ -43,7 +39,7 @@ if with_tests
   test('gbm-abi-check', abi_check, suite : ['gbm'])
 endif
 
-install_headers('main/gbm.h')
+install_headers('main/gbm.h', 'main/gbm_backend_abi.h')
 
 pkg.generate(
   name : 'gbm',
@@ -67,3 +63,8 @@ if with_symbols_check
     suite : ['gbm'],
   )
 endif
+
+dep_gbm = declare_dependency(
+  link_with : libgbm,
+  include_directories : inc_gbm,
+)
diff --git a/src/meson.build b/src/meson.build
index d443d2b41bb..74250ed2148 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -127,11 +127,17 @@ endif
 if with_glx == 'dri'
   subdir('glx')
 endif
+
 if with_gbm
-  subdir('gbm')
+  if get_option('libgbm-external')
+    dep_gbm = dependency('gbm')
+  else
+    subdir('gbm')
+  endif
 else
-  inc_gbm = []
+  dep_gbm = null_dep
 endif
+
 if with_egl
   subdir('egl')
 endif
@@ -141,6 +147,10 @@ if with_gallium and with_gbm
   endif
 endif
 
+if with_gbm and with_dri2
+  subdir('gbm/backends/dri')
+endif
+
 # This must be after at least mesa, glx, and gallium, since libgl will be
 # defined in one of those subdirs depending on the glx provider.
 if with_glx != 'disabled' and not with_glvnd