All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH v2 06/13] drm/i915: Disallow plane scaling with specific pixel formats
Date: Wed, 30 May 2018 19:59:26 +0300	[thread overview]
Message-ID: <20180530165933.11424-7-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20180530165933.11424-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Plane scaling is not supported with specific pixel formats. Disallow
plane scaling when such a format is used. Currently the only such
pixel format we expose is C8, but in case we add more in the future
let's make it easy to deal with them.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c |  2 +-
 drivers/gpu/drm/i915/intel_drv.h     |  1 +
 drivers/gpu/drm/i915/intel_sprite.c  | 41 ++++++++++++++++++++++++------------
 3 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index c9ed32d7b869..453ea548fbd1 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -13034,7 +13034,7 @@ intel_check_primary_plane(struct intel_plane *plane,
 
 	if (INTEL_GEN(dev_priv) >= 9) {
 		/* use scaler when colorkey is not required */
-		if (!state->ckey.flags) {
+		if (!state->ckey.flags && intel_fb_scalable(state->base.fb)) {
 			min_scale = 1;
 			if (state->base.fb)
 				pixel_format = state->base.fb->format->format;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index fd6256632482..e39827b5da5f 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -2070,6 +2070,7 @@ bool intel_sdvo_init(struct drm_i915_private *dev_priv,
 
 /* intel_sprite.c */
 bool intel_format_is_yuv(u32 format);
+bool intel_fb_scalable(const struct drm_framebuffer *fb);
 int intel_usecs_to_scanlines(const struct drm_display_mode *adjusted_mode,
 			     int usecs);
 struct intel_plane *intel_sprite_plane_create(struct drm_i915_private *dev_priv,
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 2ce3ffbf8ab1..73a74e6ef847 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -928,6 +928,19 @@ g4x_plane_get_hw_state(struct intel_plane *plane)
 	return ret;
 }
 
+bool intel_fb_scalable(const struct drm_framebuffer *fb)
+{
+	if (!fb)
+		return false;
+
+	switch (fb->format->format) {
+	case DRM_FORMAT_C8:
+		return false;
+	default:
+		return true;
+	}
+}
+
 static int
 intel_check_sprite_plane(struct intel_plane *plane,
 			 struct intel_crtc_state *crtc_state,
@@ -940,7 +953,6 @@ intel_check_sprite_plane(struct intel_plane *plane,
 	int max_scale, min_scale;
 	bool can_scale;
 	int ret;
-	uint32_t pixel_format = 0;
 
 	if (!fb) {
 		state->base.visible = false;
@@ -960,24 +972,25 @@ intel_check_sprite_plane(struct intel_plane *plane,
 	}
 
 	/* setup can_scale, min_scale, max_scale */
+	can_scale = false;
+	min_scale = DRM_PLANE_HELPER_NO_SCALING;
+	max_scale = DRM_PLANE_HELPER_NO_SCALING;
+
 	if (INTEL_GEN(dev_priv) >= 9) {
-		if (state->base.fb)
-			pixel_format = state->base.fb->format->format;
 		/* use scaler when colorkey is not required */
-		if (!state->ckey.flags) {
-			can_scale = 1;
+		if (!state->ckey.flags && intel_fb_scalable(fb)) {
+			u32 pixel_format = fb ? fb->format->format : 0;
+
+			can_scale = true;
 			min_scale = 1;
-			max_scale =
-				skl_max_scale(crtc, crtc_state, pixel_format);
-		} else {
-			can_scale = 0;
-			min_scale = DRM_PLANE_HELPER_NO_SCALING;
-			max_scale = DRM_PLANE_HELPER_NO_SCALING;
+			max_scale = skl_max_scale(crtc, crtc_state, pixel_format);
 		}
 	} else {
-		can_scale = plane->can_scale;
-		max_scale = plane->max_downscale << 16;
-		min_scale = plane->can_scale ? 1 : (1 << 16);
+		if (intel_fb_scalable(fb)) {
+			can_scale = plane->can_scale;
+			max_scale = plane->max_downscale << 16;
+			min_scale = plane->can_scale ? 1 : (1 << 16);
+		}
 	}
 
 	ret = drm_atomic_helper_check_plane_state(&state->base,
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-05-30 16:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-30 16:59 [PATCH v2 00/13] drm/i915: Some plane init cleanups Ville Syrjala
2018-05-30 16:59 ` [PATCH v2 01/13] drm/i915: Constify intel_plane_funcs Ville Syrjala
2018-05-30 21:45   ` Kristian Høgsberg
2018-05-30 16:59 ` [PATCH v2 02/13] drm/i915: Fix tabs vs. spaces Ville Syrjala
2018-05-31  6:13   ` Jani Nikula
2018-06-01 15:54     ` Ville Syrjälä
2018-05-30 16:59 ` [PATCH v2 03/13] drm/i915: Populate possible_crtcs for primary/cursor planes Ville Syrjala
2018-05-30 16:59 ` [PATCH v2 04/13] drm/i915: Don't populate plane->i9xx_plane for sprites Ville Syrjala
2018-05-30 16:59 ` [PATCH v2 05/13] drm/i915: Allow horizontal mirroring for cnl+ "sprite" planes Ville Syrjala
2018-05-30 16:59 ` Ville Syrjala [this message]
2018-05-30 16:59 ` [PATCH v2 07/13] drm/i915: Add missing pixel formats for skl+ "sprites" Ville Syrjala
2018-05-30 16:59 ` [PATCH v2 08/13] drm/i915: Move plane_state->scaler_id initialization into intel_create_plane_state() Ville Syrjala
2018-05-30 16:59 ` [PATCH v2 09/13] drm/i915: Introduce intel_plane_alloc() Ville Syrjala
2018-05-30 17:15 ` [PATCH v2 10/13] drm/i915: Extract skl_universal_plane_init() Ville Syrjala
2018-05-30 17:15   ` [PATCH v2 11/13] drm/i915: Simplify skl_plane_has_planar() Ville Syrjala
2018-05-30 17:16   ` [PATCH v2 12/13] drm/i915: s/intel_plane/plane/ in sprite init Ville Syrjala
2018-05-30 17:16   ` [PATCH v2 13/13] drm/i915: Rename variables in intel_primary_plane_create() Ville Syrjala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180530165933.11424-7-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.