Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Subject: [Intel-gfx] [PATCH xf86-video-intel 3/8] sna/video: Use crtc index instead of pipe
Date: Sat, 18 Mar 2023 15:45:39 +0200	[thread overview]
Message-ID: <20230318134544.11033-3-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20230318134544.11033-1-ville.syrjala@linux.intel.com>

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

For consistency with most other code use the kms crtc index
instead of the hardware pipe number where either will do.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 src/sna/sna_video_sprite.c | 44 +++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c
index 711a2fb261c0..df0081878a3b 100644
--- a/src/sna/sna_video_sprite.c
+++ b/src/sna/sna_video_sprite.c
@@ -102,11 +102,11 @@ static int sna_video_sprite_stop(ddStopVideo_ARGS)
 
 	for (i = 0; i < video->sna->mode.num_real_crtc; i++) {
 		xf86CrtcPtr crtc = config->crtc[i];
-		int pipe;
+		int index;
 
-		pipe = sna_crtc_pipe(crtc);
-		assert(pipe < ARRAY_SIZE(video->bo));
-		if (video->bo[pipe] == NULL)
+		index = sna_crtc_index(crtc);
+		assert(index < ARRAY_SIZE(video->bo));
+		if (video->bo[index] == NULL)
 			continue;
 
 		memset(&s, 0, sizeof(s));
@@ -115,9 +115,9 @@ static int sna_video_sprite_stop(ddStopVideo_ARGS)
 			xf86DrvMsg(video->sna->scrn->scrnIndex, X_ERROR,
 				   "failed to disable plane\n");
 
-		if (video->bo[pipe])
-			kgem_bo_destroy(&video->sna->kgem, video->bo[pipe]);
-		video->bo[pipe] = NULL;
+		if (video->bo[index])
+			kgem_bo_destroy(&video->sna->kgem, video->bo[index]);
+		video->bo[index] = NULL;
 	}
 
 	sna_window_set_port((WindowPtr)draw, NULL);
@@ -290,7 +290,7 @@ sna_video_sprite_show(struct sna *sna,
 		      BoxPtr dstBox)
 {
 	struct local_mode_set_plane s;
-	int pipe = sna_crtc_pipe(crtc);
+	int index = sna_crtc_index(crtc);
 
 	/* XXX handle video spanning multiple CRTC */
 
@@ -301,7 +301,7 @@ sna_video_sprite_show(struct sna *sna,
 #define LOCAL_IOCTL_I915_SET_SPRITE_COLORKEY DRM_IOWR(DRM_COMMAND_BASE + DRM_I915_SET_SPRITE_COLORKEY, struct local_intel_sprite_colorkey)
 #define LOCAL_IOCTL_MODE_ADDFB2 DRM_IOWR(0xb8, struct local_mode_fb_cmd2)
 
-	if (video->color_key_changed & (1 << pipe) && video->has_color_key) {
+	if (video->color_key_changed & (1 << index) && video->has_color_key) {
 		struct local_intel_sprite_colorkey {
 			uint32_t plane_id;
 			uint32_t min_value;
@@ -339,17 +339,17 @@ sna_video_sprite_show(struct sna *sna,
 			}
 		}
 
-		video->color_key_changed &= ~(1 << pipe);
+		video->color_key_changed &= ~(1 << index);
 	}
 
-	if (video->colorspace_changed & (1 << pipe)) {
+	if (video->colorspace_changed & (1 << index)) {
 		DBG(("%s: updating colorspace: %x\n",
 		     __FUNCTION__, video->colorspace));
 
 		sna_crtc_set_sprite_colorspace(crtc, video->idx,
 					       video->colorspace);
 
-		video->colorspace_changed &= ~(1 << pipe);
+		video->colorspace_changed &= ~(1 << index);
 	}
 
 	update_dst_box_to_crtc_coords(sna, crtc, dstBox);
@@ -468,18 +468,18 @@ sna_video_sprite_show(struct sna *sna,
 
 	if (drmIoctl(sna->kgem.fd, LOCAL_IOCTL_MODE_SETPLANE, &s)) {
 		DBG(("SET_PLANE failed: ret=%d\n", errno));
-		if (video->bo[pipe]) {
-			kgem_bo_destroy(&sna->kgem, video->bo[pipe]);
-			video->bo[pipe] = NULL;
+		if (video->bo[index]) {
+			kgem_bo_destroy(&sna->kgem, video->bo[index]);
+			video->bo[index] = NULL;
 		}
 		return false;
 	}
 
 	__kgem_bo_clear_dirty(frame->bo);
 
-	if (video->bo[pipe])
-		kgem_bo_destroy(&sna->kgem, video->bo[pipe]);
-	video->bo[pipe] = kgem_bo_reference(frame->bo);
+	if (video->bo[index])
+		kgem_bo_destroy(&sna->kgem, video->bo[index]);
+	video->bo[index] = kgem_bo_reference(frame->bo);
 	return true;
 }
 
@@ -529,7 +529,7 @@ static int sna_video_sprite_put_image(ddPutImage_ARGS)
 	for (i = 0; i < video->sna->mode.num_real_crtc; i++) {
 		xf86CrtcPtr crtc = config->crtc[i];
 		struct sna_video_frame frame;
-		const int pipe = sna_crtc_pipe(crtc);
+		const int index = sna_crtc_index(crtc);
 		bool hw_scaling = has_hw_scaling(sna, video);
 		INT32 x1, x2, y1, y2;
 		Rotation rotation;
@@ -547,15 +547,15 @@ retry:
 		RegionIntersect(&reg, &reg, &clip);
 		if (RegionNil(&reg)) {
 off:
-			assert(pipe < ARRAY_SIZE(video->bo));
-			if (video->bo[pipe]) {
+			assert(index < ARRAY_SIZE(video->bo));
+			if (video->bo[index]) {
 				struct local_mode_set_plane s;
 				memset(&s, 0, sizeof(s));
 				s.plane_id = sna_crtc_to_sprite(crtc, video->idx);
 				if (drmIoctl(video->sna->kgem.fd, LOCAL_IOCTL_MODE_SETPLANE, &s))
 					xf86DrvMsg(video->sna->scrn->scrnIndex, X_ERROR,
 						   "failed to disable plane\n");
-				video->bo[pipe] = NULL;
+				video->bo[index] = NULL;
 			}
 			continue;
 		}
-- 
2.39.2


  parent reply	other threads:[~2023-03-18 13:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-18 13:45 [Intel-gfx] [PATCH xf86-video-intel 1/8] uxa: Switch to using crtc index instead of pipe Ville Syrjala
2023-03-18 13:45 ` [Intel-gfx] [PATCH xf86-video-intel 2/8] sna: " Ville Syrjala
2023-03-18 13:45 ` Ville Syrjala [this message]
2023-03-18 13:45 ` [Intel-gfx] [PATCH xf86-video-intel 4/8] sna: Switch debugs/errors to use crtc index rather than pipe Ville Syrjala
2023-03-18 13:45 ` [Intel-gfx] [PATCH xf86-video-intel 5/8] sna/gen2: Silence compiler warn Ville Syrjala
2023-03-18 13:45 ` [Intel-gfx] [PATCH xf86-video-intel 6/8] sna/gen3: Fix 3DSTATE_PIXEL_SHADER_PROGRAM debugs Ville Syrjala
2023-03-18 13:45 ` [Intel-gfx] [PATCH xf86-video-intel 7/8] sna/gen3: Silence compiler warn Ville Syrjala
2023-03-18 13:45 ` [Intel-gfx] [PATCH xf86-video-intel 8/8] intel: Fix some theoretical buffer overflow Ville Syrjala
2023-03-18 14:15 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [xf86-video-intel,1/8] uxa: Switch to using crtc index instead of pipe Patchwork

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=20230318134544.11033-3-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=chris@chris-wilson.co.uk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox