So that it is possible to use a custom mode with the simplified mode set API. v2: Add documentation for igt_output_override_mode(). (Thomas) --- lib/igt_kms.c | 18 ++++++++++++++++++ lib/igt_kms.h | 3 +++ 2 files changed, 21 insertions(+) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 6cb1f08..9cdb204 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -905,6 +905,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; @@ -1656,6 +1659,21 @@ drmModeModeInfo *igt_output_get_mode(igt_output_t *output) return &output->config.default_mode; } +/** + * igt_output_override_mode: + * @output: Output of which the mode will be overriden + * @mode: New mode + * + * Overrides the output's mode with @mode, so that it is used instead of the + * mode obtained with get connectors. Note that the mode is used without + * checking if the output supports it, so this might lead to unexpect results. + */ +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 565df14..067402c 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -217,6 +217,8 @@ typedef struct { char *name; bool valid; unsigned long pending_crtc_idx_mask; + bool use_override_mode; + drmModeModeInfo override_mode; } igt_output_t; struct igt_display { @@ -239,6 +241,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 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx