diff mbox

igt/igt_kms: Introduce get_first_connected_output (v2)

Message ID 1446687245-5345-1-git-send-email-vivek.kasireddy@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kasireddy, Vivek Nov. 5, 2015, 1:34 a.m. UTC
In some cases, we just need one valid (connected) output to perform
a test. This macro can help in these situations by not having to
put the test code inside a for loop that iterates over all the outputs.

v2: Added a brief documentation for this macro.

Suggested-by: Matt Roper <matthew.d.roper at intel.com>
Cc: Thomas Wood <thomas.wood@intel.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
---
 lib/igt_kms.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Thomas Wood Nov. 13, 2015, 3:59 p.m. UTC | #1
On 5 November 2015 at 01:34, Vivek Kasireddy <vivek.kasireddy@intel.com> wrote:
> In some cases, we just need one valid (connected) output to perform
> a test. This macro can help in these situations by not having to
> put the test code inside a for loop that iterates over all the outputs.
>
> v2: Added a brief documentation for this macro.

The new macro is no longer being used anywhere. Is there a new patch
that uses the macro?


Also, if re-sending the patch, please make sure it is tagged correctly
as described in:

http://lists.freedesktop.org/archives/intel-gfx/2015-November/079712.html

This also explains how to manage the version tag in the subject line.


>
> Suggested-by: Matt Roper <matthew.d.roper at intel.com>
> Cc: Thomas Wood <thomas.wood@intel.com>
> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
> ---
>  lib/igt_kms.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 09c08aa..91fa206 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -278,6 +278,18 @@ void igt_wait_for_vblank(int drm_fd, enum pipe pipe);
>         for (int i__ = 0; (plane) = &(display)->pipes[(pipe)].planes[i__], \
>                      i__ < (display)->pipes[(pipe)].n_planes; i__++)
>
> +/**
> + * get_first_connected_output:
> + * @display: Initialized igt_display_t type object
> + * @output: igt_output_t type object
> + *
> + * Returns: First valid (connected) output.
> + */
> +#define get_first_connected_output(display, output)            \
> +       for (int i__ = 0;  i__ < (display)->n_outputs; i__++)   \
> +               if ((output = &(display)->outputs[i__]), output->valid) \
> +                       break
> +
>  /*
>   * Can be used with igt_output_set_pipe() to mean we don't care about the pipe
>   * that should drive this output
> --
> 2.4.3
>
Kasireddy, Vivek Nov. 14, 2015, 3:08 a.m. UTC | #2
On Fri, 13 Nov 2015 15:59:21 +0000
Thomas Wood <thomas.wood@intel.com> wrote:

> On 5 November 2015 at 01:34, Vivek Kasireddy
> <vivek.kasireddy@intel.com> wrote:
> > In some cases, we just need one valid (connected) output to perform
> > a test. This macro can help in these situations by not having to
> > put the test code inside a for loop that iterates over all the
> > outputs.
> >
> > v2: Added a brief documentation for this macro.
> 
> The new macro is no longer being used anywhere. Is there a new patch
> that uses the macro?
> 

Hi Thomas,
I wanted to have this patch merged before I updated the tests to use
the macro.

> 
> Also, if re-sending the patch, please make sure it is tagged correctly
> as described in:
> 
> http://lists.freedesktop.org/archives/intel-gfx/2015-November/079712.html
> 
> This also explains how to manage the version tag in the subject line.

Thanks for the link; I wasn't aware of it. Do you want me to resend the
patch in this format?

Thanks and Regards,
Vivek

> 
> 
> >
> > Suggested-by: Matt Roper <matthew.d.roper at intel.com>
> > Cc: Thomas Wood <thomas.wood@intel.com>
> > Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
> > ---
> >  lib/igt_kms.h | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> >
> > diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> > index 09c08aa..91fa206 100644
> > --- a/lib/igt_kms.h
> > +++ b/lib/igt_kms.h
> > @@ -278,6 +278,18 @@ void igt_wait_for_vblank(int drm_fd, enum pipe
> > pipe); for (int i__ = 0; (plane) =
> > &(display)->pipes[(pipe)].planes[i__], \ i__ <
> > (display)->pipes[(pipe)].n_planes; i__++)
> >
> > +/**
> > + * get_first_connected_output:
> > + * @display: Initialized igt_display_t type object
> > + * @output: igt_output_t type object
> > + *
> > + * Returns: First valid (connected) output.
> > + */
> > +#define get_first_connected_output(display, output)            \
> > +       for (int i__ = 0;  i__ < (display)->n_outputs; i__++)   \
> > +               if ((output = &(display)->outputs[i__]),
> > output->valid) \
> > +                       break
> > +
> >  /*
> >   * Can be used with igt_output_set_pipe() to mean we don't care
> > about the pipe
> >   * that should drive this output
> > --
> > 2.4.3
> >
Thomas Wood Nov. 16, 2015, 1:30 p.m. UTC | #3
On 14 November 2015 at 03:08, Vivek Kasireddy <vivek.kasireddy@intel.com> wrote:
> On Fri, 13 Nov 2015 15:59:21 +0000
> Thomas Wood <thomas.wood@intel.com> wrote:
>
>> On 5 November 2015 at 01:34, Vivek Kasireddy
>> <vivek.kasireddy@intel.com> wrote:
>> > In some cases, we just need one valid (connected) output to perform
>> > a test. This macro can help in these situations by not having to
>> > put the test code inside a for loop that iterates over all the
>> > outputs.
>> >
>> > v2: Added a brief documentation for this macro.
>>
>> The new macro is no longer being used anywhere. Is there a new patch
>> that uses the macro?
>>
>
> Hi Thomas,
> I wanted to have this patch merged before I updated the tests to use
> the macro.
>
>>
>> Also, if re-sending the patch, please make sure it is tagged correctly
>> as described in:
>>
>> http://lists.freedesktop.org/archives/intel-gfx/2015-November/079712.html
>>
>> This also explains how to manage the version tag in the subject line.
>
> Thanks for the link; I wasn't aware of it. Do you want me to resend the
> patch in this format?

Just resend it with the patches that use the macro so that they can
all be reviewed and applied together.


>
> Thanks and Regards,
> Vivek
>
>>
>>
>> >
>> > Suggested-by: Matt Roper <matthew.d.roper at intel.com>
>> > Cc: Thomas Wood <thomas.wood@intel.com>
>> > Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
>> > ---
>> >  lib/igt_kms.h | 12 ++++++++++++
>> >  1 file changed, 12 insertions(+)
>> >
>> > diff --git a/lib/igt_kms.h b/lib/igt_kms.h
>> > index 09c08aa..91fa206 100644
>> > --- a/lib/igt_kms.h
>> > +++ b/lib/igt_kms.h
>> > @@ -278,6 +278,18 @@ void igt_wait_for_vblank(int drm_fd, enum pipe
>> > pipe); for (int i__ = 0; (plane) =
>> > &(display)->pipes[(pipe)].planes[i__], \ i__ <
>> > (display)->pipes[(pipe)].n_planes; i__++)
>> >
>> > +/**
>> > + * get_first_connected_output:
>> > + * @display: Initialized igt_display_t type object
>> > + * @output: igt_output_t type object
>> > + *
>> > + * Returns: First valid (connected) output.
>> > + */
>> > +#define get_first_connected_output(display, output)            \
>> > +       for (int i__ = 0;  i__ < (display)->n_outputs; i__++)   \
>> > +               if ((output = &(display)->outputs[i__]),
>> > output->valid) \
>> > +                       break
>> > +
>> >  /*
>> >   * Can be used with igt_output_set_pipe() to mean we don't care
>> > about the pipe
>> >   * that should drive this output
>> > --
>> > 2.4.3
>> >
>
diff mbox

Patch

diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 09c08aa..91fa206 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -278,6 +278,18 @@  void igt_wait_for_vblank(int drm_fd, enum pipe pipe);
 	for (int i__ = 0; (plane) = &(display)->pipes[(pipe)].planes[i__], \
 		     i__ < (display)->pipes[(pipe)].n_planes; i__++)
 
+/**
+ * get_first_connected_output:
+ * @display: Initialized igt_display_t type object
+ * @output: igt_output_t type object
+ *
+ * Returns: First valid (connected) output.
+ */
+#define get_first_connected_output(display, output)		\
+	for (int i__ = 0;  i__ < (display)->n_outputs; i__++)	\
+		if ((output = &(display)->outputs[i__]), output->valid) \
+			break
+
 /*
  * Can be used with igt_output_set_pipe() to mean we don't care about the pipe
  * that should drive this output