From patchwork Sat Mar 29 20:07:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 60227 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64A1AC36008 for ; Sat, 29 Mar 2025 20:07:58 +0000 (UTC) Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by mx.groups.io with SMTP id smtpd.web10.18136.1743278868233917269 for ; Sat, 29 Mar 2025 13:07:48 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@qualcomm.com header.s=qcppdkim1 header.b=lTeUyKYe; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: oss.qualcomm.com, ip: 205.220.180.131, mailfrom: dmitry.baryshkov@oss.qualcomm.com) Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 52TJYM33025685 for ; Sat, 29 Mar 2025 20:07:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= J1CB4JmobkT6cTmvwIq+nCiQkFb38IeE55rDWfE7EuI=; b=lTeUyKYentJ0u7nQ ZOlfSn/Ssopg71rrqLe9NXODBmRb2G6SWz7B5UI/qUBl+7FaDz8JkzC4uSpIJTZH RdVCzD57a8+OPaHJxRCKvMkUxnyKV+iOovuSexsGeChe5LZ5fKAkt6WhYzklsloN HFEnrMzySWglu7beqkhp1akFD4GfCyWdZWdLtLcZO4lefFqtxS+CXq68Mbege048 666oO60XQh0fitka3/WWEixV70fDCfwNwUnmuMvIFZS7FqxDdbXRITfOoompcsSI 3sYSrcPS5G3NkXqq0cwauHu+wa5BauTc6U18QkHzoOnfTO1ofwnCgJgrSbMQWeb2 8PtgSw== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 45p7v89bpe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Sat, 29 Mar 2025 20:07:47 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-7c5ba3b91b1so151294085a.0 for ; Sat, 29 Mar 2025 13:07:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743278866; x=1743883666; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=J1CB4JmobkT6cTmvwIq+nCiQkFb38IeE55rDWfE7EuI=; b=LZhdcp7in1WD8uIoFJ1B+AudlsVu1qtTsR0XHDAjVdBFRLXjx0TPx0mWGNi0V0LZgk vwacEpuBk09EinlcTGTlnhSw3Is9HXf4jSAaStEY+FUaPSg75UbaiJQhTwzBytKBTGwA 81iUh8HYbV8iHr0aGmXVqyb8Yv2pK3vtxR5+O3Oh1YNNKpD9wpqAHm3iysEzsBD1DaWu ogA6Uwcco0yjRBMyy5LbOjbDn1iOGeuw0dn9fvz+fPVvt7B7bwyo/ulXmQzxMqTW3BeO pKeYEVSC5kyoLYAPzdFmOKARt3bd3t9CJcC6Ox9PI/vTvmr5dSxhTmhkiC3Va4jFPFsg 9ytA== X-Gm-Message-State: AOJu0YwzmccT4yMcCEMLhgAkUVl5u+OgPoVqq6n4czBP3/3ogy0hQOfx h9tn609pWVIXEwLNWGLI+cA0qS/0M+1tsEBc42uhrCq4Gb1yrUzcnktbk/99+ZrmJNo2qBQFLAA BGX4SZ9D0/ymOqtg4h/EB/xqRYBKbler7pv5J5EDdIMgG5F5I0gmh8P3IJ6RWP0EpzTprt0ThEh 5DSPc= X-Gm-Gg: ASbGncs0uZFsaA804ahCcrafTpgLwIcYt5HyfV23VJYf5QxRQ4PsURevU+dhGcG92DD 5iwEVO6MSPUuj/h+JoV2ig+ZoEUgcAPj5mjqb2QS2PngTFljQSGPRrF4YUA+NR0o87lwWb2zrrM w2bABUYIWBZtvFhfsS6YnKus1KKlHx4/dPq77n7GzP114+AOCMqK+PYbqjX0xHSV7GkdPyN/Snu X3ob4aV+cJ1IAmap/iLsqs8toIyy73CC2BkZJ98KFLV/lQkz4+PYiDVpC0c/1ZpyjZlYfGa88pa 8FMFDOqSXlMi8RQQ0jRIVXJ7dUP5Lr35enFfMvnvrL2em9z1ehyRrFS9py78tX27BIGlo/F3/wt yke/nf7qOq+b314QAObZpw+HMbr5R X-Received: by 2002:a05:620a:170e:b0:7c3:ca29:c87e with SMTP id af79cd13be357-7c5f9bf8928mr1137207385a.21.1743278866462; Sat, 29 Mar 2025 13:07:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9kY1NCHGUcCVNDVMTvrqFDdcvZ61i3ZvFQRU/6L38LjViNBoVlWoeaof/jM7vCzoo3scZ7A== X-Received: by 2002:a05:620a:170e:b0:7c3:ca29:c87e with SMTP id af79cd13be357-7c5f9bf8928mr1137204485a.21.1743278866061; Sat, 29 Mar 2025 13:07:46 -0700 (PDT) Received: from umbar.lan (2001-14ba-a0c3-3a00-264b-feff-fe8b-be8a.rev.dnainternet.fi. [2001:14ba:a0c3:3a00:264b:feff:fe8b:be8a]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-54b094bb365sm685848e87.29.2025.03.29.13.07.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Mar 2025 13:07:43 -0700 (PDT) From: Dmitry Baryshkov Date: Sat, 29 Mar 2025 22:07:20 +0200 Subject: [PATCH v3 9/9] mesa: add support for RustiCL under PACKAGECONFIG "opencl" MIME-Version: 1.0 Message-Id: <20250329-mesa-25-v3-9-f4d0328eb867@oss.qualcomm.com> References: <20250329-mesa-25-v3-0-f4d0328eb867@oss.qualcomm.com> In-Reply-To: <20250329-mesa-25-v3-0-f4d0328eb867@oss.qualcomm.com> To: openembedded-core@lists.openembedded.org Cc: Khem Raj , =?utf-8?b?Wm9sdMOhbiBCw7ZzesO2cm3DqW55?= =?utf-8?b?aQ==?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=7608; i=dmitry.baryshkov@oss.qualcomm.com; h=from:subject:message-id; bh=138WZeZ4omX2qzoYRhMr5MGdsHoIG+BWIMgNxdTXfo0=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBn6FL1zxfTZLGsngB88KzJAgiKV9yZ/8Q4LV5K7 3i4KtBdZWeJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ+hS9QAKCRCLPIo+Aiko 1XsNCACpHO2ypnwNnX1/GBfl+xal1HQtedUGZTFyTzJPDVUBxc83SSdw+i7vtSHNb9/d1Q+C9Wh dOyS0lryhoQOFSzWPAGPE1I6Bjx57CLY2rv6zgsGUZwURVDntH6K4gG58VZ4fbRxXLPkWo6+JcN ec1kQ6nQIYO0WJpeJ+PmdiSGwd6JZkss1XvXDG+wLQO/P9KmOBPQ2FDttBZp5DqM7bdIYpaQv+a /Hsg++mFaH+HZxWBIycoEf7m9y30tyQtA/BJgDPEUzjKMC+/O+5tPCw801NBzaR+Cn7F0j7atQX eX0c/5m052n4EyUPG5I+vkeBc/EywPxPoCJlFB1ytjQ6mW16 X-Developer-Key: i=dmitry.baryshkov@oss.qualcomm.com; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-Proofpoint-ORIG-GUID: ltQxKLdyd6yyrjcbPLlgpBnu2JOKroEF X-Authority-Analysis: v=2.4 cv=fdaty1QF c=1 sm=1 tr=0 ts=67e85313 cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=Vs1iUdzkB0EA:10 a=ZpVaWaFtAAAA:8 a=pGLkceISAAAA:8 a=EUspDBNiAAAA:8 a=NIk5LsUNV1RiDaC6tVwA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=bTQJ7kPSJx9SKPbeHEYW:22 a=5tn4MO8azEBWFjlAA-rn:22 X-Proofpoint-GUID: ltQxKLdyd6yyrjcbPLlgpBnu2JOKroEF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-03-29_03,2025-03-27_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 malwarescore=0 suspectscore=0 spamscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 clxscore=1015 adultscore=0 lowpriorityscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2502280000 definitions=main-2503290146 X-MIME-Autoconverted: from 8bit to quoted-printable by mx0a-0031df01.pphosted.com id 52TJYM33025685 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sat, 29 Mar 2025 20:07:58 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/213903 From: Zoltán Böszörményi Mesa now has two OpenCL implementations: Clover (older one) and RustiCL (newer one). Extend the "opencl" package config to include both implementations into the libopencl-mesa (-dev) packages. As the Clover implementation is in maintenance mode and is expected to be removed at Mesa 25.2, it doesn't make sense to split the packages or to provide two config options. Signed-off-by: Zoltán Böszörményi [DB: merged "rusticl" and "clover" back to "opencl", reworked rust inheritance] Signed-off-by: Dmitry Baryshkov --- ...vide-cross-compilation-arguments-to-LLVM-.patch | 66 ++++++++++++++++++++++ meta/recipes-graphics/mesa/mesa.inc | 20 +++++-- 2 files changed, 81 insertions(+), 5 deletions(-) diff --git a/meta/recipes-graphics/mesa/files/0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch b/meta/recipes-graphics/mesa/files/0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch new file mode 100644 index 0000000000000000000000000000000000000000..652f99bc80653cfaf34ab069ed9d370ae3c4948a --- /dev/null +++ b/meta/recipes-graphics/mesa/files/0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch @@ -0,0 +1,66 @@ +From b9cf34f39ca7e7546508ce2ab1f053edef5fc201 Mon Sep 17 00:00:00 2001 +From: Dmitry Baryshkov +Date: Wed, 26 Mar 2025 17:47:09 +0200 +Subject: [PATCH] rusticl: provide cross-compilation arguments to LLVM bindgen + invocation + +Correctly generating LLVM bindings requires several croos-compilation +arguments. Provide them to rust.bindgen(). Karol Herbst on IRC suggested +that a proper fix should be to fix meson's rust.bindgen() to support +cross-compilation. Carry this patch until meson is fixed. + +Upstream-Status: Inappropriate [OE-Specific] +Signed-off-by: Dmitry Baryshkov +--- + meson_options.txt | 14 ++++++++++++++ + src/gallium/frontends/rusticl/meson.build | 8 ++++++++ + 2 files changed, 22 insertions(+) + +diff --git a/meson_options.txt b/meson_options.txt +index 0147cafcb146..f73e83fded18 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -796,3 +796,17 @@ option( + value : false, + description : 'Install the drivers internal shader compilers (if needed for cross builds).' + ) ++ ++option( ++ 'bindgen-includedir', ++ type : 'string', ++ value : '', ++ description : 'system-wide include directory for cross-generating LLVM bindings' ++ ) ++ ++option( ++ 'bindgen-target', ++ type : 'string', ++ value : '', ++ description : 'Clang target for cross-generating LLVM bindings' ++ ) +diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build +index a5d1dcf3abb9..480c220b7f5f 100644 +--- a/src/gallium/frontends/rusticl/meson.build ++++ b/src/gallium/frontends/rusticl/meson.build +@@ -180,13 +180,21 @@ rusticl_opencl_gen = static_library( + ], + ) + ++bindgen_c_args = [] ++bindgen_target = get_option('bindgen-target') ++if bindgen_target != '' ++ bindgen_c_args += [ '-target', bindgen_target ] ++endif ++ + rusticl_llvm_bindings_rs = rust.bindgen( + input : 'rusticl_llvm_bindings.hpp', + output : 'rusticl_llvm_bindings.rs', + c_args : [ + rusticl_bindgen_c_args, + pre_args, ++ bindgen_c_args, + ], ++ include_directories : get_option('bindgen-includedir'), + dependencies : [ + dep_clang, + dep_llvm, diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc index 52079f536ef785084e4a1e61969d162d067ee12d..b7db5f8d00a10d59c15fdfaea318875d2b4ddc4d 100644 --- a/meta/recipes-graphics/mesa/mesa.inc +++ b/meta/recipes-graphics/mesa/mesa.inc @@ -17,6 +17,7 @@ PE = "2" SRC_URI = "https://archive.mesa3d.org/mesa-${PV}.tar.xz \ file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \ file://0001-freedreno-don-t-encode-build-path-into-binaries.patch\ + file://0001-rusticl-provide-cross-compilation-arguments-to-LLVM-.patch \ " SRC_URI[sha256sum] = "adf904d083b308df95898600ffed435f4b5c600d95fb6ec6d4c45638627fdc97" @@ -45,7 +46,7 @@ PROVIDES = " \ virtual/mesa \ " -inherit meson pkgconfig python3native gettext features_check +inherit meson pkgconfig python3native gettext features_check rust BBCLASSEXTEND = "native nativesdk" @@ -84,6 +85,9 @@ PACKAGECONFIG = " \ ${@bb.utils.contains('DISTRO_FEATURES', 'vulkan', 'zink', '', d)} \ " +# skip all Rust dependencies if we are not building OpenCL" +INHIBIT_DEFAULT_RUST_DEPS = "${@bb.utils.contains('PACKAGECONFIG', 'opencl', '', '1', d)}" + PACKAGECONFIG:append:x86 = " libclc gallium-llvm" PACKAGECONFIG:append:x86-64 = " libclc gallium-llvm" PACKAGECONFIG:append:class-native = " libclc gallium-llvm r600" @@ -139,9 +143,15 @@ PACKAGECONFIG[gles] = "-Dgles1=enabled -Dgles2=enabled, -Dgles1=disabled -Dgles2 # "egl" requires "opengl" PACKAGECONFIG[egl] = "-Degl=enabled, -Degl=disabled" +BINDGEN_TARGET = "${TARGET_ARCH}-${TARGET_OS}${@['-gnu', ''][d.getVar('LIBCEXTENSION') != '']}" + # "opencl" also requires libclc and gallium-llvm to be present in PKGCONFIG! # Be sure to enable them both for the target and for the native build. -PACKAGECONFIG[opencl] = "-Dgallium-opencl=icd,-Dgallium-opencl=disabled," +PACKAGECONFIG[opencl] = " \ + -Dgallium-opencl=icd -Dgallium-rusticl=true -Dbindgen-includedir=${STAGING_INCDIR} -Dbindgen-target=${BINDGEN_TARGET},\ + -Dgallium-opencl=disabled -Dgallium-rusticl=false, \ + bindgen-cli-native \ +" PACKAGECONFIG[broadcom] = "" PACKAGECONFIG[etnaviv] = ",,python3-pycparser-native" @@ -241,7 +251,7 @@ RDEPENDS:libgles3-mesa-dev += "libgles2-mesa-dev" RDEPENDS:libgles2-mesa += "libgles3-mesa" ALLOW_EMPTY:libgles3-mesa = "1" -RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'opencl', 'libclc spirv-tools', '', d)}" +RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'opencl', 'libclc spirv-tools spirv-llvm-translator', '', d)}" PACKAGES =+ "libegl-mesa libegl-mesa-dev \ libosmesa libosmesa-dev \ @@ -347,7 +357,7 @@ FILES:libgles1-mesa = "${libdir}/libGLESv1*.so.*" FILES:libgles2-mesa = "${libdir}/libGLESv2.so.*" FILES:libgl-mesa = "${libdir}/libGL.so.*" FILES:libglx-mesa = "${libdir}/libGLX*.so.*" -FILES:libopencl-mesa = "${libdir}/libMesaOpenCL.so.* ${libdir}/gallium-pipe/*.so ${sysconfdir}/OpenCL/vendors/mesa.icd" +FILES:libopencl-mesa = "${libdir}/lib*OpenCL.so.* ${libdir}/gallium-pipe/*.so ${sysconfdir}/OpenCL/vendors/*.icd" FILES:libglapi = "${libdir}/libglapi.so.*" FILES:libosmesa = "${libdir}/libOSMesa.so.*" FILES:libxatracker = "${libdir}/libxatracker.so.*" @@ -361,7 +371,7 @@ FILES:libglapi-dev = "${libdir}/libglapi.*" FILES:libgles1-mesa-dev = "${libdir}/libGLESv1*.* ${includedir}/GLES ${libdir}/pkgconfig/glesv1*.pc" FILES:libgles2-mesa-dev = "${libdir}/libGLESv2.* ${includedir}/GLES2 ${libdir}/pkgconfig/glesv2.pc" FILES:libgles3-mesa-dev = "${includedir}/GLES3" -FILES:libopencl-mesa-dev = "${libdir}/libMesaOpenCL.so" +FILES:libopencl-mesa-dev = "${libdir}/lib*OpenCL.so" FILES:libosmesa-dev = "${libdir}/libOSMesa.* ${includedir}/GL/osmesa.h ${libdir}/pkgconfig/osmesa.pc" FILES:libxatracker-dev = "${libdir}/libxatracker.so ${libdir}/libxatracker.la \ ${includedir}/xa_tracker.h ${includedir}/xa_composite.h ${includedir}/xa_context.h \