[PATCH 4/6] xfree86: Keep trying to set interface on drm for 2 seconds.

walter harms wharms at bfs.de
Thu Mar 21 06:45:16 PDT 2013



Am 19.03.2013 20:12, schrieb Bryce Harrington:
> And if we've had to delay booting due to not being able to set the
> interface, fess up.
> 
> Signed-off-by: Bryce Harrington <bryce at canonical.com>
> Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  hw/xfree86/os-support/linux/lnx_platform.c |   20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/xfree86/os-support/linux/lnx_platform.c b/hw/xfree86/os-support/linux/lnx_platform.c
> index 3ae2db1..10c8ecf 100644
> --- a/hw/xfree86/os-support/linux/lnx_platform.c
> +++ b/hw/xfree86/os-support/linux/lnx_platform.c
> @@ -26,16 +26,26 @@ get_drm_info(struct OdevAttributes *attribs, char *path)
>      char *buf;
>      int fd;
>      int err = 0;
> +    int tries = 0;
>  
>      fd = open(path, O_RDWR, O_CLOEXEC);
>      if (fd == -1)
>          return FALSE;
>  
> -    sv.drm_di_major = 1;
> -    sv.drm_di_minor = 4;
> -    sv.drm_dd_major = -1;       /* Don't care */
> -    sv.drm_dd_minor = -1;       /* Don't care */
> -    err = drmSetInterfaceVersion(fd, &sv);
> +    while (tries++ < 200) {
> +	sv.drm_di_major = 1;
> +	sv.drm_di_minor = 4;
> +	sv.drm_dd_major = -1;       /* Don't care */
> +	sv.drm_dd_minor = -1;       /* Don't care */
> +
> +	err = drmSetInterfaceVersion(fd, &sv);
> +	if (!err) {
> +	    if (tries > 1)
> +		LogMessage(X_INFO, "setversion 1.4 succeeded on try #%d\n", tries);
> +	    break;
> +	}
> +	usleep(10000);


nitpicking:
posix 2008 says that usleep() is obsolet, perhaps you can use sleep() here ?

re,
 wh
> +    }
>      if (err) {
>          ErrorF("setversion 1.4 failed: %s\n", strerror(-err));
>  	goto out;


More information about the xorg-devel mailing list