sys/dev/drm/i915/intel_overlay.c
/* overlay needs to be disabled in OCMD reg */
overlay needs to be disabled in OCMD reg
overlay needs to be disabled in OCMD reg
static int intel_overlay_off(struct intel_overlay *overlay)
{
	struct drm_i915_private *dev_priv = overlay->i915;
	struct intel_engine_cs *engine = &dev_priv->engine[RCS];
	struct drm_i915_gem_request *req;
	u32 flip_addr = overlay->flip_addr;
	int ret;
	WARN_ON(!overlay->active);
	flip_addr |= OFC_UPDATE;
	req = i915_gem_request_alloc(engine, NULL);
	if (IS_ERR(req))
		return PTR_ERR(req);
	ret = intel_ring_begin(req, 6);
	if (ret) {
		i915_add_request_no_flush(req);
		return ret;
	}
	intel_ring_emit(engine, MI_OVERLAY_FLIP | MI_OVERLAY_CONTINUE);
	intel_ring_emit(engine, flip_addr);
	intel_ring_emit(engine, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
	if (IS_I830(dev_priv)) {
		intel_ring_emit(engine, MI_NOOP);
		intel_ring_emit(engine, MI_NOOP);
		intel_ring_emit(engine, MI_NOOP);
	} else {
		intel_ring_emit(engine, MI_OVERLAY_FLIP | MI_OVERLAY_OFF);
		intel_ring_emit(engine, flip_addr);
		intel_ring_emit(engine,
				MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
	}
	intel_ring_advance(engine);
	return intel_overlay_do_wait_request(overlay, req, intel_overlay_off_tail);
}
static int intel_overlay_off ( struct intel_overlay * overlay ) { struct drm_i915_private * dev_priv = overlay -> i915 ; struct intel_engine_cs * engine = & dev_priv -> engine [ RCS ] ; struct drm_i915_gem_request * req ; u32 flip_addr = overlay -> flip_addr ; int ret ; WARN_ON ( ! overlay -> active ) ; flip_addr |= OFC_UPDATE ; req = i915_gem_request_alloc ( engine , NULL ) ; if ( IS_ERR ( req ) ) return PTR_ERR ( req ) ; ret = intel_ring_begin ( req , 6 ) ; if ( ret ) { i915_add_request_no_flush ( req ) ; return ret ; } intel_ring_emit ( engine , MI_OVERLAY_FLIP | MI_OVERLAY_CONTINUE ) ; intel_ring_emit ( engine , flip_addr ) ; intel_ring_emit ( engine , MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP ) ; if ( IS_I830 ( dev_priv ) ) { intel_ring_emit ( engine , MI_NOOP ) ; intel_ring_emit ( engine , MI_NOOP ) ; intel_ring_emit ( engine , MI_NOOP ) ; } else { intel_ring_emit ( engine , MI_OVERLAY_FLIP | MI_OVERLAY_OFF ) ; intel_ring_emit ( engine , flip_addr ) ; intel_ring_emit ( engine , MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP ) ; } intel_ring_advance ( engine ) ; return intel_overlay_do_wait_request ( overlay , req , intel_overlay_off_tail ) ; }
overlay needs to be disabled in OCMD reg
overlay needs to be disabled in OCMD reg
/* According to intel docs the overlay hw may hang (when switching
	 * off) without loading the filter coeffs. It is however unclear whether
	 * this applies to the disabling of the overlay or to the switching off
	 * of the hw. Do it in both cases */ /* wait for overlay to go idle */ /* turn overlay off */ /* Workaround: Don't disable the overlay fully, since otherwise
		 * it dies on the next OVERLAY_ON cmd. */