Skip to contentSkip to conversation

Add panning test for primary plane.

PATCH New Yi Sun 1 participant 1 message May 16, 2014 Library code

lore
Share & tools
lore

Yi Sun

author
#0 lore raw

PATCH 1/1 Add panning test for primary plane.

Get CRCs of a full red and a full blue surface as reference.

Create a big framebuffer that is twice width and twice height as the current display mode.

Fill the top left quarter with red, bottom right quarter with blue Check the scanned out image with the CRTC at position (0, 0) of the framebuffer and it should be the same CRC as the full red fb Check the scanned out image with the CRTC at position (hdisplay, vdisplay) and it should be the same CRC as the full blue fb

lib/igt_kms.c +30 -3
index fffad9f..5cdc48b 100644
@@ -532,6 +532,13 @@ void igt_display_init(igt_display_t *display, int drm_fd)
 	display->outputs = calloc(display->n_outputs, sizeof(igt_output_t));
 	igt_assert(display->outputs);
 
+	/*
+	 * Be default display can scan out from the original position of the frame buffer.
+	 * But we can change this position making display scan out with a offset.
+	 */
+	display->buffer_x = 0;
+	display->buffer_y = 0;
+
 	for (i = 0; i < display->n_outputs; i++) {
 		igt_output_t *output = &display->outputs[i];
 
@@ -830,13 +837,13 @@ static int igt_output_commit(igt_output_t *output)
 			    igt_output_name(output),
 			    pipe_name(output->config.pipe),
 			    fb_id,
-			    0, 0,
+			    display->buffer_x, display->buffer_y,
 			    mode->hdisplay, mode->vdisplay);
 
 			ret = drmModeSetCrtc(display->drm_fd,
 					     crtc_id,
 					     fb_id,
-					     0, 0, /* x, y */
+					     display->buffer_x, display->buffer_y, /* x, y */
 					     &output->id,
 					     1,
 					     mode);
@@ -849,7 +856,7 @@ static int igt_output_commit(igt_output_t *output)
 			ret = drmModeSetCrtc(display->drm_fd,
 					     crtc_id,
 					     fb_id,
-					     0, 0, /* x, y */
+					     display->buffer_x, display->buffer_y, /* x, y */
 					     NULL, /* connectors */
 					     0,    /* n_connectors */
 					     NULL  /* mode */);
@@ -987,6 +994,26 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
 	plane->fb_changed = true;
 }
 
+void igt_plane_set_fb_offset(igt_plane_t *plane, struct igt_fb *fb, int x, int y)
+{
+	igt_pipe_t *pipe = plane->pipe;
+	igt_display_t *display = pipe->display;
+
+	(*display).buffer_x = x;
+	(*display).buffer_y = y;
+
+	LOG(display, "%c.%d: plane_set_fb(%d)\n", pipe_name(pipe->pipe),
+	    plane->index, fb ? fb->fb_id : 0);
+
+	plane->fb = fb;
+
+	if (plane->is_primary)
+		pipe->need_set_crtc = true;
+	else if (plane->is_cursor)
+		pipe->need_set_cursor = true;
+
+	plane->fb_changed = true;
+}
 void igt_plane_set_position(igt_plane_t *plane, int x, int y)
 {
 	igt_pipe_t *pipe = plane->pipe;
lib/igt_kms.h +2 -0
index 439a634..cb9370e 100644
@@ -139,6 +139,8 @@ struct igt_display {
 	int log_shift;
 	int n_pipes;
 	int n_outputs;
+	int buffer_x;
+	int buffer_y;
 	unsigned long pipes_in_use;
 	igt_output_t *outputs;
 	igt_pipe_t pipes[I915_MAX_PIPES];
tests/kms_plane.c +169 -13

263 lines not on this page · raw message

Signature · 1 line
1.7.6.4