[PATCH xserver 2/2] fbdevhw: add loop to wait /dev/fb0 get ready

Liwei Song liwei.song at windriver.com
Thu Apr 12 02:49:44 UTC 2018


After compile i915 driver as kernel module, will got error message:
(EE) open /dev/fb0: No such file or directory

This is because i915 driver did not finish fb initialized work
while process trying to open it. This is still a timing problem between
i915.ko and Xorg

Add a loop to wait i915 driver finished its initialize work
can fix this error.

Signed-off-by: Liwei Song <liwei.song at windriver.com>
---
 hw/xfree86/fbdevhw/fbdevhw.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
index 0bd77df87e04..adca43809b59 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
@@ -309,6 +309,7 @@ fbdev_open(int scrnIndex, const char *dev, char **namep)
 {
     struct fb_fix_screeninfo fix;
     int fd;
+    int loop = 0;
 
     /* try argument (from XF86Config) first */
     if (dev) {
@@ -320,7 +321,8 @@ fbdev_open(int scrnIndex, const char *dev, char **namep)
         if ((NULL == dev) || ((fd = open(dev, O_RDWR, 0)) == -1)) {
             /* last try: default device */
             dev = "/dev/fb0";
-            fd = open(dev, O_RDWR, 0);
+            while ((fd = open(dev, O_RDWR, 0)) == -1 && loop++ <= 100)
+               usleep(20000);
         }
     }
 
-- 
2.7.4



More information about the xorg-devel mailing list