[PATCH v2 04/16] drm/ast: Reorganize widescreen test around hardware Gens

Jocelyn Falempe jfalempe at redhat.com
Wed Jan 29 11:08:20 UTC 2025


On 29/01/2025 10:54, Thomas Zimmermann wrote:
> Testing for support of widescreen modes mixes up various hardware
> Gens. First branch by hardware Gen, then do specific tests for each
> Gen. By default, widesscreen support is disabled.
> 
> Later patches will add more specific tests for each Gen.
> 
> v2:
> - move shared detection code into helper (Jocelyn)

Thank for the v2, it looks good to me.

Reviewed-by: Jocelyn Falempe <jfalempe at redhat.com>

> 
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> ---
>   drivers/gpu/drm/ast/ast_main.c | 54 ++++++++++++++++++++--------------
>   1 file changed, 32 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
> index 1cfbe404e5a0a..93ae9a275c960 100644
> --- a/drivers/gpu/drm/ast/ast_main.c
> +++ b/drivers/gpu/drm/ast/ast_main.c
> @@ -36,33 +36,43 @@
>   
>   #include "ast_drv.h"
>   
> +/* Try to detect WSXGA+ on Gen2+ */
> +static bool __ast_2100_detect_wsxga_p(struct ast_device *ast)
> +{
> +	u8 vgacrd0 = ast_get_index_reg(ast, AST_IO_VGACRI, 0xd0);
> +
> +	if (!(vgacrd0 & AST_IO_VGACRD0_VRAM_INIT_BY_BMC))
> +		return true;
> +	if (vgacrd0 & AST_IO_VGACRD0_IKVM_WIDESCREEN)
> +		return true;
> +
> +	return false;
> +}
> +
>   static void ast_detect_widescreen(struct ast_device *ast)
>   {
> -	u8 vgacrd0;
> +	ast->support_wsxga_p = false;
>   
> -	/* Check if we support wide screen */
> -	switch (AST_GEN(ast)) {
> -	case 1:
> -		ast->support_wsxga_p = false;
> -		break;
> -	default:
> -		vgacrd0 = ast_get_index_reg(ast, AST_IO_VGACRI, 0xd0);
> -		if (!(vgacrd0 & AST_IO_VGACRD0_VRAM_INIT_BY_BMC))
> +	if (AST_GEN(ast) >= 7) {
> +		ast->support_wsxga_p = true;
> +	} else if (AST_GEN(ast) >= 6) {
> +		if (__ast_2100_detect_wsxga_p(ast))
>   			ast->support_wsxga_p = true;
> -		else if (vgacrd0 & AST_IO_VGACRD0_IKVM_WIDESCREEN)
> +		else if (ast->chip == AST2510)
> +			ast->support_wsxga_p = true;
> +	} else if (AST_GEN(ast) >= 5) {
> +		if (__ast_2100_detect_wsxga_p(ast))
> +			ast->support_wsxga_p = true;
> +		else if (ast->chip == AST1400)
> +			ast->support_wsxga_p = true;
> +	} else if (AST_GEN(ast) >= 4) {
> +		if (__ast_2100_detect_wsxga_p(ast))
> +			ast->support_wsxga_p = true;
> +		else if (ast->chip == AST1300)
> +			ast->support_wsxga_p = true;
> +	} else if (AST_GEN(ast) >= 2) {
> +		if (__ast_2100_detect_wsxga_p(ast))
>   			ast->support_wsxga_p = true;
> -		else {
> -			ast->support_wsxga_p = false;
> -			if (ast->chip == AST1300)
> -				ast->support_wsxga_p = true;
> -			if (ast->chip == AST1400)
> -				ast->support_wsxga_p = true;
> -			if (ast->chip == AST2510)
> -				ast->support_wsxga_p = true;
> -			if (IS_AST_GEN7(ast))
> -				ast->support_wsxga_p = true;
> -		}
> -		break;
>   	}
>   }
>   



More information about the dri-devel mailing list