[Intel-gfx] [PATCH v6 2/2] vga_switcheroo: Support deferred probing of audio clients

Daniel Vetter daniel at ffwll.ch
Tue May 31 11:16:52 UTC 2016


On Tue, May 31, 2016 at 11:13:27AM +0200, Lukas Wunner wrote:
> Daniel Vetter pointed out that vga_switcheroo_client_probe_defer() could
> be needed by audio clients as well. To avoid mistakes when someone adds
> conditions for these in the future, constrain the single existing
> condition to VGA clients by checking for PCI_BASE_CLASS_DISPLAY. This
> encompasses both PCI_CLASS_DISPLAY_VGA as well as PCI_CLASS_DISPLAY_3D,
> which is used by some Nvidia Optimus GPUs.
> 
> Any future checks for audio clients should then be constrained to
> PCI_BASE_CLASS_MULTIMEDIA.
> 
> v6: Spun out from commit introducing vga_switcheroo_client_probe_defer()
>     to keep it a pure refactoring change. (Emil Velikov, Jani Nikula)
> 
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> Cc: Emil Velikov <emil.l.velikov at gmail.com>
> Cc: Jani Nikula <jani.nikula at linux.intel.com>
> Signed-off-by: Lukas Wunner <lukas at wunner.de>

Both applied to drm-misc.
-Daniel

> ---
>  drivers/gpu/vga/vga_switcheroo.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
> index d349bf9..2df216b3 100644
> --- a/drivers/gpu/vga/vga_switcheroo.c
> +++ b/drivers/gpu/vga/vga_switcheroo.c
> @@ -331,7 +331,8 @@ EXPORT_SYMBOL(vga_switcheroo_register_client);
>   * @id: client identifier
>   *
>   * Register audio client (audio device on a GPU). The power state of the
> - * client is assumed to be ON.
> + * client is assumed to be ON. Beforehand, vga_switcheroo_client_probe_defer()
> + * shall be called to ensure that all prerequisites are met.
>   *
>   * Return: 0 on success, -ENOMEM on memory allocation error.
>   */
> @@ -390,13 +391,15 @@ find_active_client(struct list_head *head)
>   */
>  bool vga_switcheroo_client_probe_defer(struct pci_dev *pdev)
>  {
> -	/*
> -	 * apple-gmux is needed on pre-retina MacBook Pro
> -	 * to probe the panel if pdev is the inactive GPU.
> -	 */
> -	if (apple_gmux_present() && pdev != vga_default_device() &&
> -	    !vgasr_priv.handler_flags)
> -		return true;
> +	if ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) {
> +		/*
> +		 * apple-gmux is needed on pre-retina MacBook Pro
> +		 * to probe the panel if pdev is the inactive GPU.
> +		 */
> +		if (apple_gmux_present() && pdev != vga_default_device() &&
> +		    !vgasr_priv.handler_flags)
> +			return true;
> +	}
>  
>  	return false;
>  }
> -- 
> 2.8.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list