intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/10] drm/i915: Add windowing for primary planes on gen2/3 and chv
@ 2019-05-29 16:05 Ville Syrjala
  2019-05-29 16:05 ` [PATCH 02/10] drm/i915: Disable sprite gamma on ivb-bdw Ville Syrjala
                   ` (14 more replies)
  0 siblings, 15 replies; 20+ messages in thread
From: Ville Syrjala @ 2019-05-29 16:05 UTC (permalink / raw)
  To: intel-gfx

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

Plane B and C (note that we don't actually expose plane C currently)
on gen2/3 have a window generator, as does the primary plane on CHV
pipe B. So let's allow positioning of these planes freely within the
pipe source area.

Plane A on gen2/3 seems to have some kind of partial window generator
which would allow you to cut the plane off midway through the scanout,
but it would still have to start at the top-left corner of the pipe,
and it would have to be full width. That's doesn't sound all that
useful, so for simplicity let's just keep to the idea that plane A
has to be fullscreen.

Gen4 removed the plane A/B windowing support entirely, and it wasn't
reintroduced until SKL (apart from the CHV pipe B special case).

v2: s/plane/i9xx_plane/ etc. (James)
v3: Make it less confusing
v4: Deal with IS_GEN()

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 40 +++++++++++++++++++++-------
 1 file changed, 31 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index c3e2b1178d55..3b913d59cc74 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3710,10 +3710,27 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state)
 	return 0;
 }
 
+static bool i9xx_plane_has_windowing(struct intel_plane *plane)
+{
+	struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
+	enum i9xx_plane_id i9xx_plane = plane->i9xx_plane;
+
+	if (IS_CHERRYVIEW(dev_priv))
+		return i9xx_plane == PLANE_B;
+	else if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv))
+		return false;
+	else if (IS_GEN(dev_priv, 4))
+		return i9xx_plane == PLANE_C;
+	else
+		return i9xx_plane == PLANE_B ||
+			i9xx_plane == PLANE_C;
+}
+
 static int
 i9xx_plane_check(struct intel_crtc_state *crtc_state,
 		 struct intel_plane_state *plane_state)
 {
+	struct intel_plane *plane = to_intel_plane(plane_state->base.plane);
 	int ret;
 
 	ret = chv_plane_check_rotation(plane_state);
@@ -3724,7 +3741,8 @@ i9xx_plane_check(struct intel_crtc_state *crtc_state,
 						  &crtc_state->base,
 						  DRM_PLANE_HELPER_NO_SCALING,
 						  DRM_PLANE_HELPER_NO_SCALING,
-						  false, true);
+						  i9xx_plane_has_windowing(plane),
+						  true);
 	if (ret)
 		return ret;
 
@@ -3753,6 +3771,10 @@ static void i9xx_update_plane(struct intel_plane *plane,
 	u32 linear_offset;
 	int x = plane_state->color_plane[0].x;
 	int y = plane_state->color_plane[0].y;
+	int crtc_x = plane_state->base.dst.x1;
+	int crtc_y = plane_state->base.dst.y1;
+	int crtc_w = drm_rect_width(&plane_state->base.dst);
+	int crtc_h = drm_rect_height(&plane_state->base.dst);
 	unsigned long irqflags;
 	u32 dspaddr_offset;
 	u32 dspcntr;
@@ -3771,18 +3793,18 @@ static void i9xx_update_plane(struct intel_plane *plane,
 	I915_WRITE_FW(DSPSTRIDE(i9xx_plane), plane_state->color_plane[0].stride);
 
 	if (INTEL_GEN(dev_priv) < 4) {
-		/* pipesrc and dspsize control the size that is scaled from,
-		 * which should always be the user's requested size.
+		/*
+		 * PLANE_A doesn't actually have a full window
+		 * generator but let's assume we still need to
+		 * program whatever is there.
 		 */
-		I915_WRITE_FW(DSPPOS(i9xx_plane), 0);
+		I915_WRITE_FW(DSPPOS(i9xx_plane), (crtc_y << 16) | crtc_x);
 		I915_WRITE_FW(DSPSIZE(i9xx_plane),
-			      ((crtc_state->pipe_src_h - 1) << 16) |
-			      (crtc_state->pipe_src_w - 1));
+			      ((crtc_h - 1) << 16) | (crtc_w - 1));
 	} else if (IS_CHERRYVIEW(dev_priv) && i9xx_plane == PLANE_B) {
-		I915_WRITE_FW(PRIMPOS(i9xx_plane), 0);
+		I915_WRITE_FW(PRIMPOS(i9xx_plane), (crtc_y << 16) | crtc_x);
 		I915_WRITE_FW(PRIMSIZE(i9xx_plane),
-			      ((crtc_state->pipe_src_h - 1) << 16) |
-			      (crtc_state->pipe_src_w - 1));
+			      ((crtc_h - 1) << 16) | (crtc_w - 1));
 		I915_WRITE_FW(PRIMCNSTALPHA(i9xx_plane), 0);
 	}
 
-- 
2.21.0

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

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2019-06-05 15:48 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-29 16:05 [PATCH 01/10] drm/i915: Add windowing for primary planes on gen2/3 and chv Ville Syrjala
2019-05-29 16:05 ` [PATCH 02/10] drm/i915: Disable sprite gamma on ivb-bdw Ville Syrjala
2019-05-29 16:05 ` [PATCH 03/10] drm/i915: Program plane gamma ramps Ville Syrjala
2019-05-29 16:05 ` [PATCH 04/10] drm/i915: Deal with cpp==8 for g4x watermarks Ville Syrjala
2019-05-29 16:06 ` [PATCH 05/10] drm/i915: Cosmetic fix for skl+ plane switch statement Ville Syrjala
2019-05-29 16:06 ` [PATCH 06/10] drm/i915: Clean up skl vs. icl plane formats Ville Syrjala
2019-05-29 16:06 ` [PATCH 07/10] drm/i915: Add support for half float framebuffers for skl+ Ville Syrjala
2019-05-29 16:06 ` [PATCH 08/10] drm/i915: Add support for half float framebuffers for gen4+ primary planes Ville Syrjala
2019-05-29 16:06 ` [PATCH 09/10] drm/i915: Add support for half float framebuffers for ivb+ sprites Ville Syrjala
2019-05-29 16:06 ` [PATCH 10/10] drm/i915: Add support for half float framebuffers on snb sprites Ville Syrjala
2019-05-29 17:38 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/10] drm/i915: Add windowing for primary planes on gen2/3 and chv Patchwork
2019-05-29 17:42 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-05-29 18:12 ` ✓ Fi.CI.BAT: success " Patchwork
2019-05-30  5:43 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-05-31 13:05   ` Ville Syrjälä
2019-06-05 14:01     ` Maarten Lankhorst
2019-06-05 15:48       ` Ville Syrjälä
2019-06-05 15:44     ` Ville Syrjälä
2019-05-31  8:13 ` ✓ Fi.CI.BAT: success " Patchwork
2019-05-31 16:55 ` ✗ Fi.CI.IGT: failure " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).