[PATCH 1/2] drm/amdgpu/gmc: steal the appropriate amount of vram for fw hand-over (v2)

Michel Dänzer michel at daenzer.net
Mon Apr 9 07:47:24 UTC 2018


On 2018-04-06 09:54 PM, Alex Deucher wrote:
> Steal 9 MB for vga emulation and fb if vga is enabled, otherwise,
> steal enough to cover the current display size as set by the vbios.
> 
> If no memory is used (e.g., secondary or headless card), skip
> stolen memory reserve.
> 
> v2: skip reservation if vram is limited, address Christian's comments
> 
> Reviewed-and-Tested-by: Andrey Grodzovsky <andrey.grodzovsky at amd.com> (v1)
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>

[...]

> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> index 5617cf62c566..24e1ea36b454 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> @@ -825,6 +825,25 @@ static int gmc_v6_0_late_init(void *handle)
>  		return 0;
>  }
>  
> +static unsigned gmc_v6_0_get_vbios_fb_size(struct amdgpu_device *adev)
> +{
> +	u32 d1vga_control = RREG32(mmD1VGA_CONTROL);
> +	unsigned size;
> +
> +	if (REG_GET_FIELD(d1vga_control, D1VGA_CONTROL, D1VGA_MODE_ENABLE)) {
> +		size = 9 * 1024 * 1024; /* reserve 8MB for vga emulator and 1 MB for FB */
> +	} else {
> +		u32 viewport = RREG32(mmVIEWPORT_SIZE);
> +		size = (REG_GET_FIELD(viewport, VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
> +			REG_GET_FIELD(viewport, VIEWPORT_SIZE, VIEWPORT_WIDTH) *
> +			4);
> +	}

Any particular reason for not calculating the FB size based on the
viewport even if VGA is enabled? VGA text mode can use higher
resolutions as well.

Other than that, these patches look good to me.


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


More information about the amd-gfx mailing list