[PATCH 1/2] drm/amdgpu: don't clean the framebuffer for VF

Christian K├Ânig christian.koenig at amd.com
Mon Feb 6 08:49:49 UTC 2017


Am 06.02.2017 um 07:24 schrieb Pixel Ding:
> The SRIOV host driver cleans framebuffer for each VF, guest driver
> needn't this action which costs much time on some virtualization
> platform, otherwise it might get timeout to initialize.
>
> Signed-off-by: Pixel Ding <Pixel.Ding at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> index 1e735c4..f1eb4f5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
> @@ -242,7 +242,9 @@ static int amdgpufb_create(struct drm_fb_helper *helper,
>   	/* setup helper */
>   	rfbdev->helper.fb = fb;
>   
> -	memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
> +	if (!amdgpu_sriov_vf(adev)) {
> +		memset_io(abo->kptr, 0x0, amdgpu_bo_size(abo));
> +	}

Nit pick only, but coding style says to not use "{" "}" in an if without 
else and only a single line of code.

Additional to that I'm not sure if that's a good idea. The memory 
allocated here might be already be used and so we need to clear it no 
matter where it came from.

It's probably easier to just set the AMDGPU_GEM_CREATE_VRAM_CLEARED in 
the call to amdgpu_gem_object_create(). This makes the GPU clear the 
memory before the first CPU access to it.

Regards,
Christian.

>   
>   	strcpy(info->fix.id, "amdgpudrmfb");
>   




More information about the amd-gfx mailing list