[PATCH xf86-video-ati] Make selection between DRI2 and DRI3 consistent with other drivers.

Michel Dänzer michel at daenzer.net
Mon Aug 10 00:05:05 PDT 2015


On 09.08.2015 17:11, Mario Kleiner wrote:
> Add Option "DRI" to allow selection of maximum DRI level.
> 
> This allows the user to select the maximum level of DRI
> implementation to use, DRI2 or DRI3. It replaces the old
> option "DRI3" which had exactly the same purpose, but
> differs from the method used in both intel ddx and nouveau ddx.
> Make this consistent before a new stable driver is released.

Thanks for this. The following applies to the amdgpu patch as well:

First of all, I think Option "DRI3" should continue working for
backwards compatibility with existing configurations. It doesn't need to
be documented anymore though.


> @@ -1517,7 +1517,7 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
>      RADEONInfoPtr  info  = RADEONPTR(pScrn);
>      int            subPixelOrder = SubPixelUnknown;
>      MessageType from;
> -    Bool value;
> +    int value;
>      const char *s;
>      void *front_ptr;
>  
> @@ -1628,13 +1628,13 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
>      }
>  #endif
>  
> -    value = FALSE;
> -    if (xf86GetOptValBool(info->Options, OPTION_DRI3, &value))
> +    value = 2;
> +    if (xf86GetOptValInteger(info->Options, OPTION_DRI, &value))
>  	from = X_CONFIG;
>      else
>  	from = X_DEFAULT;
>  
> -    if (value) {
> +    if (value >= 3) {
>  	value = radeon_sync_init(pScreen) &&
>  	    radeon_present_screen_init(pScreen) &&
>  	    radeon_dri3_screen_init(pScreen);
> @@ -1642,6 +1642,9 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
>  	if (!value)
>  	    from = X_WARNING;
>      }
> +    else
> +	value = 0;
> +
>      xf86DrvMsg(pScrn->scrnIndex, from, "DRI3 %sabled\n", value ? "en" : "dis");
>  
>      pScrn->vtSema = TRUE;
> 

This mixture of treating 'value' as an integer and as a boolean is a bit
ugly. To keep Option "DRI3" working, it's probably better to keep the
Bool variable and add an int one:

1. Initialize Bool variable to FALSE
2. xf86GetOptValBool(info->Options, OPTION_DRI3, &<Bool variable>)
3. xf86GetOptValInteger(info->Options, OPTION_DRI, &<int variable>),
   set Bool variable = <int variable> == 3.

In 3. it might be safer to ignore values other than 3 or 2, but I'm fine
either way.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the xorg-driver-ati mailing list