Merge ~b-stolk/chromium-browser/+git/snap-from-source:fix-expansion into ~chromium-team/chromium-browser/+git/snap-from-source:hwacc-beta

Proposed by Bram Stolk
Status: Merged
Merged at revision: 29ffdcf126f4b476ff4b6ff404c9ec4e84a9fa62
Proposed branch: ~b-stolk/chromium-browser/+git/snap-from-source:fix-expansion
Merge into: ~chromium-team/chromium-browser/+git/snap-from-source:hwacc-beta
Diff against target: 67 lines (+42/-0)
3 files modified
build/chromium-patches/extra:fix-dri-loading.diff (+40/-0)
build/chromium-patches/series (+1/-0)
snapcraft.yaml (+1/-0)
Reviewer Review Type Date Requested Status
Nathan Teodosio Approve
Review via email: mp+437855@code.launchpad.net

This proposal supersedes a proposal from 2023-02-23.

Commit message

Fix the usage of DRI_DRIVER_DIR variable.

The build configuration for minigbm was lacking the dri config.
This causes DRI_DRIVER_DIR to be undefined.
In addition, when the dri config is properly included, the
definition will include the quotation marks, making the
STRINGIZE step unnecessary.
To find the correct directory in the snap, we now prefix
DRI_DRIVER_DIR with /snap/chromium/current/gnome-platform

Fixes LP:2004586
Fixes LP:2006646
KIVU-90

Description of the change

can be applied to all hwacc branches.

To post a comment you must log in.
Revision history for this message
Bram Stolk (b-stolk) wrote : Posted in a previous version of this proposal

This can be applied to all hwacc branches.

Revision history for this message
Nathan Teodosio (nteodosio) wrote : Posted in a previous version of this proposal

Copying my response from merge request 437529:

>> The path is incorrect: we should be using /snap/gnome-3-38-2004/current/usr/lib/x86_64-linux-gnu/dri instead.
>
> But we do stage mesa-va-drivers, which provides /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so. We haven't been using the GNOME SDK ones so far for our hwacc improvements.

Furthermore, if we bind mount this, we are as a side-effect overriding the iHD_drv_video.so we ourselves build (as in snapcraft.yaml) by the one that GNOME SDK provides.

review: Needs Fixing
Revision history for this message
Bram Stolk (b-stolk) wrote : Posted in a previous version of this proposal

NOTE: I still need to test how this affects chromium on intel GPU, though.

Can it still find the video drivers for HW accelerated video?

Revision history for this message
Nathan Teodosio (nteodosio) wrote : Posted in a previous version of this proposal

I am pointing out that, with the proposed changes, the drivers built
(iHD) and staged (radeonsi) via the va_drivers part would be overridden
by the ones from /snap/gnome-3-38-2004/.

Am 2023/02/23 um 14:59 schrieb Bram Stolk:
> NOTE: I still need to test how this affects chromium on intel GPU, though.
>
> Can it still find the video drivers for HW accelerated video?

Revision history for this message
Bram Stolk (b-stolk) wrote (last edit ):

New version of patch works differently: no layout mapping.

Instead, the correct DRI_DRIVER_DIR is used from the gnome snap.

Revision history for this message
Nathan Teodosio (nteodosio) wrote (last edit ):

I've submitted two builds, one using this merge request and another using mesa-va-drivers path instead. If the latter works I think we should prefer it.

Edit: For the record, I was conflating radeon_dri.so and radeonsi_drv_video.so. So yes we'll go with the one in gnome-platform.

review: Approve
Revision history for this message
Nathan Teodosio (nteodosio) wrote :

For the record, I added headers to your patch.

And thanks again!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/build/chromium-patches/extra:fix-dri-loading.diff b/build/chromium-patches/extra:fix-dri-loading.diff
2new file mode 100644
3index 0000000..f4828df
4--- /dev/null
5+++ b/build/chromium-patches/extra:fix-dri-loading.diff
6@@ -0,0 +1,40 @@
7+diff -u src/third_party/minigbm/BUILD.gn src2/third_party/minigbm/BUILD.gn
8+--- src/third_party/minigbm/BUILD.gn 2023-02-22 10:11:45.378628381 -0800
9++++ src2/third_party/minigbm/BUILD.gn 2023-02-08 10:48:28.479158349 -0800
10+@@ -80,6 +80,7 @@
11+
12+ configs -= [ "//build/config/compiler:chromium_code" ]
13+ configs += [ "//build/config/compiler:no_chromium_code" ]
14++ configs += [ "//build/config/linux/dri" ]
15+
16+ deps = [ "//build/config/linux/libdrm" ]
17+ public_configs = [ ":minigbm_config" ]
18+diff -u src/third_party/minigbm/src/amdgpu.c src2/third_party/minigbm/src/amdgpu.c
19+--- src/third_party/minigbm/src/amdgpu.c
20++++ src2/third_party/minigbm/src/amdgpu.c
21+@@ -23,9 +23,11 @@
22+ #include "drv_priv.h"
23+ #include "util.h"
24+
25+-// clang-format off
26+-#define DRI_PATH STRINGIZE(DRI_DRIVER_DIR/radeonsi_dri.so)
27+-// clang-format on
28++#if !defined(DRI_DRIVER_DIR)
29++# error "DRI_DRIVER_DIR is not defined."
30++#else
31++# define DRI_PATH DRI_DRIVER_DIR "/radeonsi_dri.so"
32++#endif
33+
34+ #define TILE_TYPE_LINEAR 0
35+ /* We decide a modifier and then use DRI to manage allocation */
36+diff --git src/build/config/linux/dri/BUILD.gn src2/build/config/linux/dri/BUILD.gn
37+index e3a0a83..6e0f7ee 100644
38+--- src/build/config/linux/dri/BUILD.gn
39++++ src2/build/config/linux/dri/BUILD.gn
40+@@ -14,5 +14,5 @@ pkg_config("dri") {
41+ "dri",
42+ ],
43+ "string")
44+- defines = [ "DRI_DRIVER_DIR=\"$dri_driver_dir\"" ]
45++ defines = [ "DRI_DRIVER_DIR=\"/snap/chromium/current/gnome-platform$dri_driver_dir\"" ]
46+ }
47diff --git a/build/chromium-patches/series b/build/chromium-patches/series
48index 9f7583b..214cc86 100644
49--- a/build/chromium-patches/series
50+++ b/build/chromium-patches/series
51@@ -1,3 +1,4 @@
52+extra:fix-dri-loading.diff
53 extra:fe38fdb:dynamic-check-nv12.diff
54 guide-0.9.1:a45401f:vaapi-flag-ozone-wayland.diff
55 guide-0.9.1:b49ca2f:one-copy.diff
56diff --git a/snapcraft.yaml b/snapcraft.yaml
57index 61e1bb5..a8b18ba 100644
58--- a/snapcraft.yaml
59+++ b/snapcraft.yaml
60@@ -25,6 +25,7 @@ apps:
61 SPA_PLUGIN_DIR: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/spa-0.2
62 PIPEWIRE_CONFIG_NAME: $SNAP/usr/share/pipewire/pipewire.conf
63 PIPEWIRE_MODULE_DIR: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pipewire-0.3
64+ MINIGBM_DEBUG: 1
65 plugs:
66 - audio-playback
67 - audio-record

Subscribers

People subscribed via source and target branches

to status/vote changes: