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

Damien Lespiau damien.lespiau at intel.com
Wed Mar 11 06:26:45 PDT 2015


On Wed, Mar 11, 2015 at 01:33:00PM +0200, Ander Conselvan de Oliveira wrote:
> So that it is possible to use a custom mode with the simplified mode set API.

Maybe just igt_output_set_mode()?

-- 
Damien

> ---
>  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
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx


More information about the Intel-gfx mailing list