On my CoffeeLake machine, when build i915 driver as kernel module,
will got following error message in Xorg.0.log:
(EE) /dev/dri/card0: failed to set DRM interface version 1.4: Permission denied

When compile i915 as kernel module, drm device won't be initiated
after rootfs was mounted. This may led Xorg access DRM device failed,
since DRM  was not successful created by i915 driver yet.
Then the set version process will not be done in InitOutput(),
and it will be delayed to InitInput(), when came into InitInput()
DRM device already maped to memory, So through ioctl set DRM interface
version will failed, then print the error message in Xorg.0.log.

To avoid the timing problem between i915.ko and Xorg,  we need make
sure DRM device was created and no process hold it, because nobody
hold it in InitOutput(), then the rest work is to ensure DRM was
created successful. So add a loop method to wait DRM device are

Signed-off-by: Liwei Song <liwei.s...@windriver.com>
 config/udev.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/config/udev.c b/config/udev.c
index 3a73189e2558..2398603cd87b 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -486,8 +486,11 @@ config_udev_odev_probe(config_odev_probe_proc_ptr 
     struct udev *udev;
     struct udev_enumerate *enumerate;
     struct udev_list_entry *devices, *device;
+    int loop = 0;
     udev = udev_monitor_get_udev(udev_monitor);
     enumerate = udev_enumerate_new(udev);
     if (!enumerate)
@@ -500,6 +503,12 @@ config_udev_odev_probe(config_odev_probe_proc_ptr 
     devices = udev_enumerate_get_list_entry(enumerate);
+    if (!devices && loop++ <= 10){
+       usleep(100000);
+       udev_enumerate_unref(enumerate);
+       goto retry;
+    }
     udev_list_entry_foreach(device, devices) {
         const char *syspath = udev_list_entry_get_name(device);
         struct udev_device *udev_device = udev_device_new_from_syspath(udev, 

xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to