diff mbox

[igt,1/2] lib/kms: Add a way to override an output's mode

Message ID 1426073581-30504-1-git-send-email-ander.conselvan.de.oliveira@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ander Conselvan de Oliveira March 11, 2015, 11:33 a.m. UTC
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(+)

Comments

Lespiau, Damien March 11, 2015, 1:26 p.m. UTC | #1
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()?
Ander Conselvan de Oliveira March 11, 2015, 1:48 p.m. UTC | #2
On Wed, 2015-03-11 at 13:26 +0000, Damien Lespiau wrote:
> 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()?

That works too. I used override since there's a chance the desired mode
won't produce the expected results. But now that I think about it "force
mode" would sound more like that. In any case, I don't mind either way.

Ander
Lespiau, Damien March 11, 2015, 2:26 p.m. UTC | #3
On Wed, Mar 11, 2015 at 03:48:00PM +0200, Ander Conselvan De Oliveira wrote:
> On Wed, 2015-03-11 at 13:26 +0000, Damien Lespiau wrote:
> > 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()?
> 
> That works too. I used override since there's a chance the desired mode
> won't produce the expected results. But now that I think about it "force
> mode" would sound more like that. In any case, I don't mind either way.

No, me neither, can go as is anyway.
Thomas Wood March 27, 2015, 1:30 p.m. UTC | #4
On 11 March 2015 at 11:33, Ander Conselvan de Oliveira
<ander.conselvan.de.oliveira@intel.com> wrote:
> 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;
>  }
>


Please add some API documentation for the new function here.

> +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@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

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);