[Intel-gfx] [PATCH igt 1/2] lib/kms: Add a way to override an output's mode

Ander Conselvan de Oliveira ander.conselvan.de.oliveira at intel.com
Wed Mar 11 04:33:00 PDT 2015


So that it is possible to use a custom mode with the simplified mode set API.
---
 lib/igt_kms.c | 9 +++++++++
 lib/igt_kms.h | 4 ++++
 2 files changed, 13 insertions(+)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 26e4913..0dccd2d 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -895,6 +895,9 @@ static void igt_output_refresh(igt_output_t *output)
 	if (!output->valid)
 		return;
 
+	if (output->use_override_mode)
+		output->config.default_mode = output->override_mode;
+
 	if (!output->name) {
 		drmModeConnector *c = output->config.connector;
 
@@ -1797,6 +1800,12 @@ drmModeModeInfo *igt_output_get_mode(igt_output_t *output)
 	return &output->config.default_mode;
 }
 
+void igt_output_override_mode(igt_output_t *output, drmModeModeInfo *mode)
+{
+	output->override_mode = *mode;
+	output->use_override_mode = true;
+}
+
 void igt_output_set_pipe(igt_output_t *output, enum pipe pipe)
 {
 	igt_display_t *display = output->display;
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 2fab30e..ddf4432 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -228,6 +228,9 @@ typedef struct {
 	bool valid;
 	unsigned long pending_crtc_idx_mask;
 
+	bool use_override_mode;
+	drmModeModeInfo override_mode;
+
 #ifdef HAVE_ATOMIC
 	/* Property set for nuclear pageflip */
 	drmModePropertySetPtr set;
@@ -255,6 +258,7 @@ int  igt_display_get_n_pipes(igt_display_t *display);
 
 const char *igt_output_name(igt_output_t *output);
 drmModeModeInfo *igt_output_get_mode(igt_output_t *output);
+void igt_output_override_mode(igt_output_t *output, drmModeModeInfo *mode);
 void igt_output_set_pipe(igt_output_t *output, enum pipe pipe);
 igt_plane_t *igt_output_get_plane(igt_output_t *output, enum igt_plane plane);
 
-- 
2.1.0



More information about the Intel-gfx mailing list