Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8a10f1bc authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drm/msm/sde: clear crtc roi if it matches full screen"

parents bd5bb698 b0e0c2ba
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -128,6 +128,20 @@ static void _msm_property_set_dirty_no_lock(
			&property_state->dirty_list);
}

bool msm_property_is_dirty(
		struct msm_property_info *info,
		struct msm_property_state *property_state,
		uint32_t property_idx)
{
	if (!info || !property_state || !property_state->values ||
			property_idx >= info->property_count) {
		DRM_ERROR("invalid argument(s), idx %u\n", property_idx);
		return false;
	}

	return !list_empty(&property_state->values[property_idx].dirty_node);
}

/**
 * _msm_property_install_integer - install standard drm range property
 * @info: Pointer to property info container struct
+13 −0
Original line number Diff line number Diff line
@@ -315,6 +315,19 @@ int msm_property_set_dirty(struct msm_property_info *info,
		struct msm_property_state *property_state,
		int property_idx);

/**
 * msm_property_is_dirty - check whether a property is dirty
 *	Note: Intended for use during atomic_check before pop_dirty usage
 * @info: Pointer to property info container struct
 * @property_state: Pointer to property state container struct
 * @property_idx: Property index
 * Returns: true if dirty, false otherwise
 */
bool msm_property_is_dirty(
		struct msm_property_info *info,
		struct msm_property_state *property_state,
		uint32_t property_idx);

/**
 * msm_property_atomic_set - helper function for atomic property set callback
 * @info: Pointer to property info container struct
+44 −0
Original line number Diff line number Diff line
@@ -806,6 +806,21 @@ void sde_crtc_get_crtc_roi(struct drm_crtc_state *state,
	*crtc_roi = &crtc_state->crtc_roi;
}

bool sde_crtc_is_crtc_roi_dirty(struct drm_crtc_state *state)
{
	struct sde_crtc_state *cstate;
	struct sde_crtc *sde_crtc;

	if (!state || !state->crtc)
		return false;

	sde_crtc = to_sde_crtc(state->crtc);
	cstate = to_sde_crtc_state(state);

	return msm_property_is_dirty(&sde_crtc->property_info,
			&cstate->property_state, CRTC_PROP_ROI_V1);
}

static int _sde_crtc_set_roi_v1(struct drm_crtc_state *state,
		void __user *usr_ptr)
{
@@ -894,6 +909,8 @@ static int _sde_crtc_set_crtc_roi(struct drm_crtc *crtc,
	struct sde_crtc_state *crtc_state;
	struct sde_rect *crtc_roi;
	int i, num_attached_conns = 0;
	bool is_crtc_roi_dirty;
	bool is_any_conn_roi_dirty;

	if (!crtc || !state)
		return -EINVAL;
@@ -902,7 +919,11 @@ static int _sde_crtc_set_crtc_roi(struct drm_crtc *crtc,
	crtc_state = to_sde_crtc_state(state);
	crtc_roi = &crtc_state->crtc_roi;

	is_crtc_roi_dirty = sde_crtc_is_crtc_roi_dirty(state);
	is_any_conn_roi_dirty = false;

	for_each_connector_in_state(state->state, conn, conn_state, i) {
		struct sde_connector *sde_conn;
		struct sde_connector_state *sde_conn_state;
		struct sde_rect conn_roi;

@@ -917,8 +938,15 @@ static int _sde_crtc_set_crtc_roi(struct drm_crtc *crtc,
		}
		++num_attached_conns;

		sde_conn = to_sde_connector(conn_state->connector);
		sde_conn_state = to_sde_connector_state(conn_state);

		is_any_conn_roi_dirty = is_any_conn_roi_dirty ||
				msm_property_is_dirty(
						&sde_conn->property_info,
						&sde_conn_state->property_state,
						CONNECTOR_PROP_ROI_V1);

		/*
		 * current driver only supports same connector and crtc size,
		 * but if support for different sizes is added, driver needs
@@ -938,8 +966,24 @@ static int _sde_crtc_set_crtc_roi(struct drm_crtc *crtc,
				conn_roi.w, conn_roi.h);
	}

	/*
	 * Check against CRTC ROI and Connector ROI not being updated together.
	 * This restriction should be relaxed when Connector ROI scaling is
	 * supported.
	 */
	if (is_any_conn_roi_dirty != is_crtc_roi_dirty) {
		SDE_ERROR("connector/crtc rois not updated together\n");
		return -EINVAL;
	}

	sde_kms_rect_merge_rectangles(&crtc_state->user_roi_list, crtc_roi);

	/* clear the ROI to null if it matches full screen anyways */
	if (crtc_roi->x == 0 && crtc_roi->y == 0 &&
			crtc_roi->w == state->adjusted_mode.hdisplay &&
			crtc_roi->h == state->adjusted_mode.vdisplay)
		memset(crtc_roi, 0, sizeof(*crtc_roi));

	SDE_DEBUG("%s: crtc roi (%d,%d,%d,%d)\n", sde_crtc->name,
			crtc_roi->x, crtc_roi->y, crtc_roi->w, crtc_roi->h);
	SDE_EVT32_VERBOSE(DRMID(crtc), crtc_roi->x, crtc_roi->y, crtc_roi->w,
+8 −0
Original line number Diff line number Diff line
@@ -684,6 +684,14 @@ void sde_crtc_res_put(struct drm_crtc_state *state, u32 type, u64 tag);
void sde_crtc_get_crtc_roi(struct drm_crtc_state *state,
		const struct sde_rect **crtc_roi);

/**
 * sde_crtc_is_crtc_roi_dirty - retrieve whether crtc_roi was updated this frame
 *	Note: Only use during atomic_check since dirty properties may be popped
 * @crtc_state: Pointer to crtc state
 * Return: true if roi is dirty, false otherwise
 */
bool sde_crtc_is_crtc_roi_dirty(struct drm_crtc_state *state);

/** sde_crt_get_secure_level - retrieve the secure level from the give state
 *	object, this is used to determine the secure state of the crtc
 * @crtc : Pointer to drm crtc structure
+5 −4
Original line number Diff line number Diff line
@@ -3593,7 +3593,6 @@ static int sde_plane_sspp_atomic_update(struct drm_plane *plane,
	struct drm_crtc *crtc;
	struct drm_framebuffer *fb;
	struct sde_rect src, dst;
	const struct sde_rect *crtc_roi;
	bool q16_data = true;
	bool blend_enabled = true;
	int idx;
@@ -3712,9 +3711,8 @@ static int sde_plane_sspp_atomic_update(struct drm_plane *plane,
	_sde_plane_sspp_atomic_check_mode_changed(psde, state,
								old_state);

	/* re-program the output rects always in the case of partial update */
	sde_crtc_get_crtc_roi(crtc->state, &crtc_roi);
	if (!sde_kms_rect_is_null(crtc_roi))
	/* re-program the output rects always if partial update roi changed */
	if (sde_crtc_is_crtc_roi_dirty(crtc->state))
		pstate->dirty |= SDE_PLANE_DIRTY_RECTS;

	if (pstate->dirty & SDE_PLANE_DIRTY_RECTS)
@@ -3747,6 +3745,8 @@ static int sde_plane_sspp_atomic_update(struct drm_plane *plane,

	/* update roi config */
	if (pstate->dirty & SDE_PLANE_DIRTY_RECTS) {
		const struct sde_rect *crtc_roi;

		POPULATE_RECT(&src, rstate->out_src_x, rstate->out_src_y,
			rstate->out_src_w, rstate->out_src_h, q16_data);
		POPULATE_RECT(&dst, state->crtc_x, state->crtc_y,
@@ -3773,6 +3773,7 @@ static int sde_plane_sspp_atomic_update(struct drm_plane *plane,
		 * adjust layer mixer position of the sspp in the presence
		 * of a partial update to the active lm origin
		 */
		sde_crtc_get_crtc_roi(crtc->state, &crtc_roi);
		dst.x -= crtc_roi->x;
		dst.y -= crtc_roi->y;