[Intel-gfx] [RFC, drm-misc-next v4 3/9] drm/radeon: Implement .be_primary() callback

Christian König christian.koenig at amd.com
Tue Sep 5 05:50:59 UTC 2023


Am 04.09.23 um 21:57 schrieb Sui Jingfeng:
> From: Sui Jingfeng <suijingfeng at loongson.cn>
>
> On a machine with multiple GPUs, a Linux user has no control over which one
> is primary at boot time.

Question is why is that useful? Should we give users the ability to 
control that?

I don't see an use case for this.

Regards,
Christian.

>   This patch tries to solve the mentioned problem by
> implementing the .be_primary() callback. Pass radeon.modeset=10 on the
> kernel cmd line if you really want the device bound by radeon to be the
> primary video adapter, no matter what VGAARB say.
>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Cc: Christian Koenig <christian.koenig at amd.com>
> Signed-off-by: Sui Jingfeng <suijingfeng at loongson.cn>
> ---
>   drivers/gpu/drm/radeon/radeon_device.c | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
> index 71f2ff39d6a1..b661cd3a8dc2 100644
> --- a/drivers/gpu/drm/radeon/radeon_device.c
> +++ b/drivers/gpu/drm/radeon/radeon_device.c
> @@ -1263,6 +1263,14 @@ static const struct vga_switcheroo_client_ops radeon_switcheroo_ops = {
>   	.can_switch = radeon_switcheroo_can_switch,
>   };
>   
> +static bool radeon_want_to_be_primary(struct pci_dev *pdev)
> +{
> +	if (radeon_modeset == 10)
> +		return true;
> +
> +	return false;
> +}
> +
>   /**
>    * radeon_device_init - initialize the driver
>    *
> @@ -1425,7 +1433,7 @@ int radeon_device_init(struct radeon_device *rdev,
>   	/* if we have > 1 VGA cards, then disable the radeon VGA resources */
>   	/* this will fail for cards that aren't VGA class devices, just
>   	 * ignore it */
> -	vga_client_register(rdev->pdev, radeon_vga_set_decode, NULL);
> +	vga_client_register(rdev->pdev, radeon_vga_set_decode, radeon_want_to_be_primary);
>   
>   	if (rdev->flags & RADEON_IS_PX)
>   		runtime = true;



More information about the Intel-gfx mailing list