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

Commit d6e24ff5 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: add rectangle utility functions to sde" into msm-4.9

parents bc63c139 e0e11e23
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -628,8 +628,8 @@ static void _sde_crtc_setup_dim_layer_cfg(struct drm_crtc *crtc,
		split_dim_layer.flags = dim_layer->flags;
		mixer_rect.x = i * mixer_width;

		sde_kms_rect_intersect(&split_dim_layer.rect, &mixer_rect,
					&dim_layer->rect);
		sde_kms_rect_intersect(&mixer_rect, &dim_layer->rect,
					&split_dim_layer.rect);
		if (!split_dim_layer.rect.w && !split_dim_layer.rect.h) {
			/*
			 * no extra programming required for non-intersecting
+40 −6
Original line number Diff line number Diff line
@@ -397,13 +397,47 @@ void sde_kms_info_append_format(struct sde_kms_info *info,
void sde_kms_info_stop(struct sde_kms_info *info);

/**
 * sde_kms_rect_intersect() - find the intersecting region between two rects
 * @res: Intersecting region between the two rectangles
 * @rect1: first rectangle coordinates
 * @rect2: second rectangle coordinates
 * sde_kms_rect_intersect - intersect two rectangles
 * @r1: first rectangle
 * @r2: scissor rectangle
 * @result: result rectangle, all 0's on no intersection found
 */
void sde_kms_rect_intersect(struct sde_rect *res,
		const struct sde_rect *rect1, const struct sde_rect *rect2);
void sde_kms_rect_intersect(const struct sde_rect *r1,
		const struct sde_rect *r2,
		struct sde_rect *result);

/**
 * sde_kms_rect_is_equal - compares two rects
 * @r1: rect value to compare
 * @r2: rect value to compare
 *
 * Returns 1 if the rects are same, 0 otherwise.
 */
static inline bool sde_kms_rect_is_equal(struct sde_rect *r1,
		struct sde_rect *r2)
{
	if ((!r1 && r2) || (r1 && !r2))
		return false;

	if (!r1 && !r2)
		return true;

	return r1->x == r2->x && r1->y == r2->y && r1->w == r2->w &&
			r1->h == r2->h;
}

/**
 * sde_kms_rect_is_null - returns true if the width or height of a rect is 0
 * @rect: rectangle to check for zero size
 * @Return: True if width or height of rectangle is 0
 */
static inline bool sde_kms_rect_is_null(const struct sde_rect *r)
{
	if (!r)
		return true;

	return (!r->w || !r->h);
}

/**
 * Vblank enable/disable functions
+18 −10
Original line number Diff line number Diff line
@@ -152,18 +152,26 @@ void sde_kms_info_stop(struct sde_kms_info *info)
	}
}

void sde_kms_rect_intersect(struct sde_rect *res,
		const struct sde_rect *rect1, const struct sde_rect *rect2)
void sde_kms_rect_intersect(const struct sde_rect *r1,
		const struct sde_rect *r2,
		struct sde_rect *result)
{
	int l, t, r, b;

	l = max(rect1->x, rect2->x);
	t = max(rect1->y, rect2->y);
	r = min((rect1->x + rect1->w), (rect2->x + rect2->w));
	b = min((rect1->y + rect1->h), (rect2->y + rect2->h));
	if (!r1 || !r2 || !result)
		return;

	l = max(r1->x, r2->x);
	t = max(r1->y, r2->y);
	r = min((r1->x + r1->w), (r2->x + r2->w));
	b = min((r1->y + r1->h), (r2->y + r2->h));

	if (r < l || b < t)
		*res = (struct sde_rect) {0, 0, 0, 0};
	else
		*res = (struct sde_rect) {l, t, (r - l), (b - t)};
	if (r < l || b < t) {
		memset(result, 0, sizeof(*result));
	} else {
		result->x = l;
		result->y = t;
		result->w = r - l;
		result->h = b - t;
	}
}
+1 −1
Original line number Diff line number Diff line
@@ -2853,7 +2853,7 @@ static int sde_plane_sspp_atomic_check(struct drm_plane *plane,
		 * Cropping is not required as hardware will consider only the
		 * intersecting region with the src rect.
		 */
		sde_kms_rect_intersect(&intersect, &src, &pstate->excl_rect);
		sde_kms_rect_intersect(&src, &pstate->excl_rect, &intersect);
		if (!intersect.w || !intersect.h || SDE_FORMAT_IS_YUV(fmt)) {
			SDE_ERROR_PLANE(psde,
				"invalid excl_rect:{%d,%d,%d,%d} src:{%d,%d,%d,%d}, fmt: %4.4s\n",