[PATCH i-g-t 1/4] lib/intel: Extract gem_store_dword_needs_physical()

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Oct 11 08:45:16 UTC 2024


Hi Ville,
On 2024-10-02 at 13:45:12 +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
> 
> Extract a small helper that can determine if MI_STORE_DWORD
> operates with physical addresses or not.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

> ---
>  lib/igt_gt.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/igt_gt.c b/lib/igt_gt.c
> index 9641a6610bf2..331783e49acf 100644
> --- a/lib/igt_gt.c
> +++ b/lib/igt_gt.c
> @@ -655,21 +655,27 @@ unsigned intel_detect_and_clear_missed_interrupts(int fd)
>  	return missed;
>  }
>  
> +static bool gem_store_dword_needs_physical(const struct intel_device_info *info)
> +{
> +	switch (info->graphics_ver) {
> +	case 2:
> +		return true;
> +	case 3:
> +		return info->is_grantsdale || info->is_alviso;
> +	default:
> +		return false;
> +	}
> +}
> +
>  bool gem_class_can_store_dword(int fd, int class)
>  {
>  	uint16_t devid = intel_get_drm_devid(fd);
>  	const struct intel_device_info *info = intel_get_device_info(devid);
>  	const int ver = info->graphics_ver;
>  
> -	if (ver == 0) /* unknown, assume it just works */
> -		return true;
> -
> -	if (ver <= 2) /* requires physical addresses */
> +	if (gem_store_dword_needs_physical(info))
>  		return false;
>  
> -	if (ver == 3 && (info->is_grantsdale || info->is_alviso))
> -		return false; /* only supports physical addresses */
> -
>  	if (ver == 6 && class == I915_ENGINE_CLASS_VIDEO)
>  		return false; /* broken, unbelievably broken */
>  
> -- 
> 2.45.2
> 


More information about the igt-dev mailing list