Re: [PATCH] drm/amdgpu/virtual_dce: Need to pin the fb's bo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2018-12-21 8:26 a.m., Emily Deng wrote:
> When the bo is used to set mode, the bo need to be pinned.
> 
> Signed-off-by: Emily Deng <Emily.Deng@xxxxxxx>
> 
> [...]
>  
> @@ -235,6 +222,47 @@ static bool dce_virtual_crtc_mode_fixup(struct drm_crtc *crtc,
>  static int dce_virtual_crtc_set_base(struct drm_crtc *crtc, int x, int y,
>  				  struct drm_framebuffer *old_fb)
>  {
> +	struct drm_framebuffer *target_fb;
> +	struct drm_gem_object *obj;
> +	struct amdgpu_bo *abo;
> +	int r;
> +
> +	/* no fb bound */
> +	if (!crtc->primary->fb) {
> +		DRM_DEBUG_KMS("No FB bound\n");
> +		return 0;
> +	}
> +
> +	target_fb = crtc->primary->fb;
> +
> +	obj = kcl_drm_fb_get_gem_obj(target_fb, 0);
> +	abo = gem_to_amdgpu_bo(obj);
> +	r = amdgpu_bo_reserve(abo, false);
> +	if (unlikely(r != 0))
> +		return r;
> +
> +	r = amdgpu_bo_pin(abo, AMDGPU_GEM_DOMAIN_VRAM);
> +	if (unlikely(r != 0)) {
> +		amdgpu_bo_unreserve(abo);
> +		return -EINVAL;
> +	}
> +
> +	amdgpu_bo_unreserve(abo);
> +	return 0;
> +}

Good catch, but old_fb also needs to be unpinned, otherwise the pinning
is unbalanced and a BO will always be pinned after it's scanned out once.


> +static int dce_virtual_crtc_mode_set(struct drm_crtc *crtc,
> +				  struct drm_display_mode *mode,
> +				  struct drm_display_mode *adjusted_mode,
> +				  int x, int y, struct drm_framebuffer *old_fb)

Indentation of the continuation lines here looks wrong (needs 3 more
spaces if I'm counting correctly). Would be good to fix that up while
you're moving the function. :)


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux