diff options
Diffstat (limited to 'drivers/gpu/drm/i915/display/intel_overlay.c')
| -rw-r--r-- | drivers/gpu/drm/i915/display/intel_overlay.c | 22 | 
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/gpu/drm/i915/display/intel_overlay.c b/drivers/gpu/drm/i915/display/intel_overlay.c index 76845d34ad0c..ee46561b5ae8 100644 --- a/drivers/gpu/drm/i915/display/intel_overlay.c +++ b/drivers/gpu/drm/i915/display/intel_overlay.c @@ -958,19 +958,21 @@ static void update_pfit_vscale_ratio(struct intel_overlay *overlay)  static int check_overlay_dst(struct intel_overlay *overlay,  			     struct drm_intel_overlay_put_image *rec)  { -	const struct intel_crtc_state *pipe_config = +	const struct intel_crtc_state *crtc_state =  		overlay->crtc->config; +	struct drm_rect req, clipped; -	if (rec->dst_height == 0 || rec->dst_width == 0) -		return -EINVAL; +	drm_rect_init(&req, rec->dst_x, rec->dst_y, +		      rec->dst_width, rec->dst_height); -	if (rec->dst_x < pipe_config->pipe_src_w && -	    rec->dst_x + rec->dst_width <= pipe_config->pipe_src_w && -	    rec->dst_y < pipe_config->pipe_src_h && -	    rec->dst_y + rec->dst_height <= pipe_config->pipe_src_h) -		return 0; -	else +	clipped = req; +	drm_rect_intersect(&clipped, &crtc_state->pipe_src); + +	if (!drm_rect_visible(&clipped) || +	    !drm_rect_equals(&clipped, &req))  		return -EINVAL; + +	return 0;  }  static int check_overlay_scaling(struct drm_intel_overlay_put_image *rec) @@ -1160,7 +1162,7 @@ int intel_overlay_put_image_ioctl(struct drm_device *dev, void *data,  		crtc->overlay = overlay;  		/* line too wide, i.e. one-line-mode */ -		if (crtc->config->pipe_src_w > 1024 && +		if (drm_rect_width(&crtc->config->pipe_src) > 1024 &&  		    crtc->config->gmch_pfit.control & PFIT_ENABLE) {  			overlay->pfit_active = true;  			update_pfit_vscale_ratio(overlay);  |