After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 754911 - mutter wayland bound to pci platform since autodetection of drm device
mutter wayland bound to pci platform since autodetection of drm device
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: wayland
git master
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2015-09-11 23:21 UTC by Alban Browaeys
Modified: 2015-11-12 19:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Let mutter detect drm device on non pci platforms. (2.88 KB, patch)
2015-09-11 23:21 UTC, Alban Browaeys
reviewed Details | Review
launcher: Fix drm device detection for non pci devices (4.25 KB, patch)
2015-11-12 18:58 UTC, Ray Strode [halfline]
none Details | Review
launcher: Fix drm device detection for non pci devices (4.32 KB, patch)
2015-11-12 19:09 UTC, Ray Strode [halfline]
committed Details | Review

Description Alban Browaeys 2015-09-11 23:21:04 UTC
Created attachment 311192 [details] [review]
Let mutter detect drm device on non pci platforms.

Reopen the use of mutter/wayland to non pci platform.

Attach patch is tested in odroid u2 (samsung exynos 4412 + GPU: Mali 400MP). Mind I run mutter/wayland through llvm as of current lack of Mali EGL armhf with wayland enabled.

Not tested on pci platform as of now.
Comment 1 Ray Strode [halfline] 2015-09-12 19:17:16 UTC
Review of attachment 311192 [details] [review]:

::: src/backends/native/meta-launcher.c
@@ +290,3 @@
   g_udev_enumerator_add_match_name (enumerator, "card*");
   g_udev_enumerator_add_match_tag (enumerator, "seat");
+  g_udev_enumerator_add_match_subsystem (enumerator, "drm");

unless i'm missing something, this shouldn't be necessary.
Note, "drm" is passed to g_udev_client_new().

@@ +328,2 @@
       pci_device = g_udev_device_get_parent_with_subsystem (dev, "pci", NULL);
+      if (pci_device) is_pci = TRUE;

I think I'd just scrap the booleans.  You're using the device variables as booleans anyway...

@@ +331,1 @@
+      platform_device = g_udev_device_get_parent_with_subsystem (dev, "platform", NULL);

probably should only do this if pci_device is NULL. (granted I guess in practice there won't ever be both)

@@ +334,2 @@
+      if (!is_platform && !is_pci)
+        continue;

I think it'd just scrap this too, the only thing it's bypassing is two condition checks, but in order to know it can do that, it has to check the same two conditions.

@@ +335,3 @@
+        continue;
+
+      if (is_pci)

so this would just be if (pci_device)

@@ +349,3 @@
+        }
+
+      if (is_platform)

and this one should just be: else if (platform_device)

@@ +354,3 @@
+          gboolean is_control = FALSE;
+
+          if (strstr(device_name, "control")) is_control = TRUE;

unless i'm missing something, this should never happen since we did

 g_udev_enumerator_add_match_name (enumerator, "card*");

above, right?
Comment 2 Ray Strode [halfline] 2015-09-13 01:22:14 UTC
interesting, there's a similar (in spirit) patch for Xorg on list right now...

https://www.mail-archive.com/xorg-devel@lists.x.org/msg46448.html
Comment 3 Daniel Stone 2015-09-16 08:31:43 UTC
(In reply to Ray Strode [halfline] from comment #1)
> Review of attachment 311192 [details] [review] [review]:
> @@ +331,1 @@
> +      platform_device = g_udev_device_get_parent_with_subsystem (dev,
> "platform", NULL);
> 
> probably should only do this if pci_device is NULL. (granted I guess in
> practice there won't ever be both)

Actually, this isn't true: Tegra combines a platform display controller (tegradrm) with a PCIE GPU (nouveau). But as we know, that's another can of worms. ;)
Comment 4 Ray Strode [halfline] 2015-09-16 12:48:39 UTC
so actually it should be the other way around then? pci should only be tried if platform comes up empty?
Comment 5 Daniel Stone 2015-09-16 13:41:35 UTC
Yeah, I'd guess that would be safer.
Comment 6 Marcin Juszkiewicz 2015-09-16 20:06:14 UTC
In Xserver world platform devices are checked first. PCI scan is done only if there is nothing on platform.

boot_vga stuff on aarch64 (xserver patch) will be handled on kernel side in same way as powerpc has it done.
Comment 7 Ray Strode [halfline] 2015-09-16 20:25:17 UTC
Marcin though in the X server world platform devices are something different.  platform devices are devices where the driver uses logind to get the drm fd.  we do that in all cases with mutter on wayland.
Comment 8 Ray Strode [halfline] 2015-11-07 12:53:31 UTC
prahal are you going to pick this back up?
Comment 9 Ray Strode [halfline] 2015-11-12 18:58:45 UTC
Created attachment 315356 [details] [review]
launcher: Fix drm device detection for non pci devices

On Odroid U2 (exynos4412) the drm device is not bound to pci.
Open the detection to platform device of the drm subsystem, exclusive of
control devices.
Comment 10 Ray Strode [halfline] 2015-11-12 18:59:42 UTC
so the above patch incorporates the changes I mentioned in the review. I haven't tried it yet.
Comment 11 Ray Strode [halfline] 2015-11-12 19:02:11 UTC
Review of attachment 315356 [details] [review]:

::: src/backends/native/meta-launcher.c
@@ +339,3 @@
+          /* get value of boot_vga attribute or 0 if the device has no boot_vga */
+          boot_vga = g_udev_device_get_sysfs_attr_as_int (pci_device, "boot_vga");
+          g_object_unref (pci_device);

this unref and the one in the other side of the if are in the wrong place, so they'll leak
Comment 12 Ray Strode [halfline] 2015-11-12 19:09:44 UTC
Created attachment 315357 [details] [review]
launcher: Fix drm device detection for non pci devices

On Odroid U2 (exynos4412) the drm device is not bound to pci.
Open the detection to platform device of the drm subsystem, exclusive of
control devices.
Comment 13 Ray Strode [halfline] 2015-11-12 19:48:05 UTC
i had rob clark try this on one of his arm machines. seems to check out, so I'm going to push it.
Comment 14 Ray Strode [halfline] 2015-11-12 19:48:52 UTC
Attachment 315357 [details] pushed as ca7c1d5 - launcher: Fix drm device detection for non pci devices