Skip to contentSkip to conversation

i915/kms_fbcon_fbt: Add crct_id to struct

PATCH In review Swati Sharma 2 participants 3 messages Mar 31, 2023 – May 31, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i915/kms_fbcon_fbt: Add crct_id to struct

Remove hard-coding of PIPE_A while computing CRC.

---
 tests/i915/kms_fbcon_fbt.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
tests/i915/kms_fbcon_fbt.c +6 -6
index 831ec867a..6c557dca7 100644
@@ -39,7 +39,7 @@ IGT_TEST_DESCRIPTION("Test the relationship between fbcon and the frontbuffer "
 #define MAX_CONNECTORS 32
 
 struct drm_info {
-	int fd, debugfs_fd;
+	int fd, debugfs_fd, crtc_id;
 	struct igt_fb fb;
 	drmModeResPtr res;
 	drmModeConnectorPtr connectors[MAX_CONNECTORS];
@@ -117,9 +117,10 @@ static bool fbc_check_cursor_blinking(struct drm_info *drm)
 	igt_pipe_crc_t *pipe_crc;
 	igt_crc_t crc[2];
 	bool ret;
-	int i;
+	int i, pipe;
 
-	pipe_crc = igt_pipe_crc_new(drm->fd, PIPE_A, IGT_PIPE_CRC_SOURCE_AUTO);
+	pipe = kmstest_get_pipe_from_crtc_id(drm->fd, drm->crtc_id);
+	pipe_crc = igt_pipe_crc_new(drm->fd, pipe, IGT_PIPE_CRC_SOURCE_AUTO);
 
 	igt_pipe_crc_start(pipe_crc);
 	igt_pipe_crc_drain(pipe_crc);
@@ -165,7 +166,6 @@ static void set_mode_for_one_screen(struct drm_info *drm,
 				    connector_possible_fn connector_possible)
 {
 	int i, rc;
-	uint32_t crtc_id;
 	drmModeModeInfoPtr mode;
 	uint32_t buffer_id;
 	drmModeConnectorPtr c = NULL;
@@ -182,7 +182,7 @@ static void set_mode_for_one_screen(struct drm_info *drm,
 	igt_require_f(i < drm->res->count_connectors,
 		      "No connector available\n");
 
-	crtc_id = kmstest_find_crtc_for_connector(drm->fd, drm->res, c, 0);
+	drm->crtc_id = kmstest_find_crtc_for_connector(drm->fd, drm->res, c, 0);
 
 	buffer_id = igt_create_fb(drm->fd, mode->hdisplay, mode->vdisplay,
 				  DRM_FORMAT_XRGB8888,
@@ -193,7 +193,7 @@ static void set_mode_for_one_screen(struct drm_info *drm,
 		 mode->hdisplay, mode->vdisplay,
 		 kmstest_connector_type_str(c->connector_type));
 
-	rc = drmModeSetCrtc(drm->fd, crtc_id, buffer_id, 0, 0,
+	rc = drmModeSetCrtc(drm->fd, drm->crtc_id, buffer_id, 0, 0,
 			    &c->connector_id, 1, mode);
 	igt_assert_eq(rc, 0);
 }
Signature · 1 line
2.25.1
#1 lore raw

Hi Swati,

On 2023-03-31 at 12:44:26 +0530, Swati Sharma wrote:

may you change patch description from subject ? I would like to see there something like you wrote below, for example:

i915/kms_fbcon_fbt: remove hard-coding of PIPE_A for CRC calc

Quoted 1 line

Remove hard-coding of PIPE_A while computing CRC.

You can write here how you did it (added crtc_id to drm_info struct) but imho it is not needed.

Please also test it again as CI didn't tested it.

Regards,
Kamil

Quoted 61 lines
---
 tests/i915/kms_fbcon_fbt.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
tests/i915/kms_fbcon_fbt.c +6 -6
index 831ec867a..6c557dca7 100644
@@ -39,7 +39,7 @@ IGT_TEST_DESCRIPTION("Test the relationship between fbcon and the frontbuffer "
 #define MAX_CONNECTORS 32
 
 struct drm_info {
-	int fd, debugfs_fd;
+	int fd, debugfs_fd, crtc_id;
 	struct igt_fb fb;
 	drmModeResPtr res;
 	drmModeConnectorPtr connectors[MAX_CONNECTORS];
@@ -117,9 +117,10 @@ static bool fbc_check_cursor_blinking(struct drm_info *drm)
 	igt_pipe_crc_t *pipe_crc;
 	igt_crc_t crc[2];
 	bool ret;
-	int i;
+	int i, pipe;
 
-	pipe_crc = igt_pipe_crc_new(drm->fd, PIPE_A, IGT_PIPE_CRC_SOURCE_AUTO);
+	pipe = kmstest_get_pipe_from_crtc_id(drm->fd, drm->crtc_id);
+	pipe_crc = igt_pipe_crc_new(drm->fd, pipe, IGT_PIPE_CRC_SOURCE_AUTO);
 
 	igt_pipe_crc_start(pipe_crc);
 	igt_pipe_crc_drain(pipe_crc);
@@ -165,7 +166,6 @@ static void set_mode_for_one_screen(struct drm_info *drm,
 				    connector_possible_fn connector_possible)
 {
 	int i, rc;
-	uint32_t crtc_id;
 	drmModeModeInfoPtr mode;
 	uint32_t buffer_id;
 	drmModeConnectorPtr c = NULL;
@@ -182,7 +182,7 @@ static void set_mode_for_one_screen(struct drm_info *drm,
 	igt_require_f(i < drm->res->count_connectors,
 		      "No connector available\n");
 
-	crtc_id = kmstest_find_crtc_for_connector(drm->fd, drm->res, c, 0);
+	drm->crtc_id = kmstest_find_crtc_for_connector(drm->fd, drm->res, c, 0);
 
 	buffer_id = igt_create_fb(drm->fd, mode->hdisplay, mode->vdisplay,
 				  DRM_FORMAT_XRGB8888,
@@ -193,7 +193,7 @@ static void set_mode_for_one_screen(struct drm_info *drm,
 		 mode->hdisplay, mode->vdisplay,
 		 kmstest_connector_type_str(c->connector_type));
 
-	rc = drmModeSetCrtc(drm->fd, crtc_id, buffer_id, 0, 0,
+	rc = drmModeSetCrtc(drm->fd, drm->crtc_id, buffer_id, 0, 0,
 			    &c->connector_id, 1, mode);
 	igt_assert_eq(rc, 0);
 }
Signature · 1 line
2.25.1
#2 lore raw

Thanks for the review. Floated v2:
https://patchwork.freedesktop.org/series/118537/

Quoted 80 lines · Kamil Konieczny

Hi Swati,

On 2023-03-31 at 12:44:26 +0530, Swati Sharma wrote:

may you change patch description from subject ? I would like to see there something like you wrote below, for example:

i915/kms_fbcon_fbt: remove hard-coding of PIPE_A for CRC calc

Quoted 1 line

Remove hard-coding of PIPE_A while computing CRC.

You can write here how you did it (added crtc_id to drm_info struct) but imho it is not needed.

Please also test it again as CI didn't tested it.

Regards,
Kamil

Quoted 61 lines
---
  tests/i915/kms_fbcon_fbt.c | 12 ++++++------
  1 file changed, 6 insertions(+), 6 deletions(-)
tests/i915/kms_fbcon_fbt.c +6 -6
index 831ec867a..6c557dca7 100644
@@ -39,7 +39,7 @@ IGT_TEST_DESCRIPTION("Test the relationship between fbcon and the frontbuffer "
  #define MAX_CONNECTORS 32
 
  struct drm_info {
-	int fd, debugfs_fd;
+	int fd, debugfs_fd, crtc_id;
  	struct igt_fb fb;
  	drmModeResPtr res;
  	drmModeConnectorPtr connectors[MAX_CONNECTORS];
@@ -117,9 +117,10 @@ static bool fbc_check_cursor_blinking(struct drm_info *drm)
  	igt_pipe_crc_t *pipe_crc;
  	igt_crc_t crc[2];
  	bool ret;
-	int i;
+	int i, pipe;
 
-	pipe_crc = igt_pipe_crc_new(drm->fd, PIPE_A, IGT_PIPE_CRC_SOURCE_AUTO);
+	pipe = kmstest_get_pipe_from_crtc_id(drm->fd, drm->crtc_id);
+	pipe_crc = igt_pipe_crc_new(drm->fd, pipe, IGT_PIPE_CRC_SOURCE_AUTO);
 
  	igt_pipe_crc_start(pipe_crc);
  	igt_pipe_crc_drain(pipe_crc);
@@ -165,7 +166,6 @@ static void set_mode_for_one_screen(struct drm_info *drm,
  				    connector_possible_fn connector_possible)
  {
  	int i, rc;
-	uint32_t crtc_id;
  	drmModeModeInfoPtr mode;
  	uint32_t buffer_id;
  	drmModeConnectorPtr c = NULL;
@@ -182,7 +182,7 @@ static void set_mode_for_one_screen(struct drm_info *drm,
  	igt_require_f(i < drm->res->count_connectors,
  		      "No connector available\n");
 
-	crtc_id = kmstest_find_crtc_for_connector(drm->fd, drm->res, c, 0);
+	drm->crtc_id = kmstest_find_crtc_for_connector(drm->fd, drm->res, c, 0);
 
  	buffer_id = igt_create_fb(drm->fd, mode->hdisplay, mode->vdisplay,
  				  DRM_FORMAT_XRGB8888,
@@ -193,7 +193,7 @@ static void set_mode_for_one_screen(struct drm_info *drm,
  		 mode->hdisplay, mode->vdisplay,
  		 kmstest_connector_type_str(c->connector_type));
 
-	rc = drmModeSetCrtc(drm->fd, crtc_id, buffer_id, 0, 0,
+	rc = drmModeSetCrtc(drm->fd, drm->crtc_id, buffer_id, 0, 0,
  			    &c->connector_id, 1, mode);
  	igt_assert_eq(rc, 0);
  }
Signature · 1 line
2.25.1