lib/igt_kms: Introduce get_first_connected_output to retrieve a valid output
PATCH 1/1 lib/igt_kms: Introduce get_first_connected_output to retrieve a valid output
In some cases, we just need one valid output to perform a test. This macro can help in these situations by avoiding iterating over all the outputs.
--- lib/igt_kms.h | 5 +++++ tests/kms_rotation_crc.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-)
lib/igt_kms.h +5 -0
@@ -278,6 +278,11 @@ 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__++) +#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
tests/kms_rotation_crc.c +3 -2
@@ -272,14 +272,15 @@ static void test_plane_rotation_ytiled_obj(data_t *data, enum igt_plane plane_tyint bpp =igt_drm_format_to_bpp (format);enum igt_commit_style commit =COMMIT_LEGACY ;int fd = data->gfx_fd; -igt_output_t *output = &display->outputs[0 ]; +igt_output_t *output =NULL ;igt_plane_t *plane;drmModeModeInfo *mode;unsigned int stride, size, w, h;uint32_t gem_handle;int ret; -igt_require (output !=NULL && output->valid == true); +get_first_connected_output (display, output); +igt_require (output !=NULL ); plane =igt_output_get_plane (output, plane_type);igt_require (igt_plane_supports_rotation (plane));
Signature · 6 lines
2.4.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 18 lines · Vivek Kasireddy
In some cases, we just need one valid output to perform a test. This macro can help in these situations by avoiding iterating over all the outputs.
Suggested-by Matt Roper <[email protected]>CC Tvrtko Ursulin <[email protected]>CC Matt Roper <[email protected]>Signed-off-by Vivek Kasireddy <[email protected]>--- lib/igt_kms.h | 5 +++++ tests/kms_rotation_crc.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-)lib/igt_kms.h +0
-0
lib/igt_kms.h void igt_wait_for_vblank(int drm_fd, enum pipe pipe); · line 280
Quoted 3 lines
lib/igt_kms.h +0
-0@@ -278,6 +278,11 @@ 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__++)
Please add some API documentation here.
Quoted 33 lines
lib/igt_kms.h +5
-0+#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 tests/kms_rotation_crc.c +3
-3@@ -272,14 +272,15 @@ static void test_plane_rotation_ytiled_obj(data_t *data, enum igt_plane plane_tyint bpp =igt_drm_format_to_bpp (format);enum igt_commit_style commit =COMMIT_LEGACY ;int fd = data->gfx_fd; -igt_output_t *output = &display->outputs[0 ]; +igt_output_t *output =NULL ;igt_plane_t *plane;drmModeModeInfo *mode;unsigned int stride, size, w, h;uint32_t gem_handle;int ret; -igt_require (output !=NULL && output->valid == true); +get_first_connected_output (display, output); +igt_require (output !=NULL ); plane =igt_output_get_plane (output, plane_type);igt_require (igt_plane_supports_rotation (plane)); --2.4.3
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 igt/igt_kms: Introduce get_first_connected_output (v2)
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.
--- lib/igt_kms.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
lib/igt_kms.h +12 -0
@@ -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
Signature · 6 lines
2.4.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] igt/igt_kms: Introduce get_first_connected_output (v2)
Quoted 5 lines · Vivek Kasireddy
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.
Quoted 32 lines
Suggested-by Matt Roper <matthew.d.roper at intel.com>Cc Thomas Wood <[email protected]>Signed-off-by Vivek Kasireddy <[email protected]>--- lib/igt_kms.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)lib/igt_kms.h +12
-1@@ -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 --
Quoted 2 lines
2.4.3
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] igt/igt_kms: Introduce get_first_connected_output (v2)
Quoted 7 lines · On Fri, 13 Nov 2015 15:59:21 +0000 Thomas Wood <[email protected]> wrote:
Quoted 5 lines · Vivek Kasireddy
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.
Quoted 5 lines
Quoted 1 line
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.
Quoted 7 lines
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
Quoted 31 lines
Quoted 31 lines
Suggested-by Matt Roper <matthew.d.roper at intel.com>Cc Thomas Wood <[email protected]>Signed-off-by Vivek Kasireddy <[email protected]>--- lib/igt_kms.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)lib/igt_kms.h +0
-0@@ -278,6 +278,18 @@ void igt_wait_for_vblank(int drm_fd, enum pipepipe); for (int
i__= 0; (plane) =
&(display)->pipes[(pipe)].planes[i__], \i__<
(display)->pipes[(pipe)].n_planes; i__++)lib/igt_kms.h +10
-0+/** +* 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
Quoted 8 lines
Quoted 8 lines
+
/*
* Can be used withigt_output_set_pipe()to mean we don't care
about the pipe
* that should drive this output
--
2.4.3
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH] igt/igt_kms: Introduce get_first_connected_output (v2)
Quoted 24 lines · Vivek Kasireddy
Quoted 7 lines · On Fri, 13 Nov 2015 15:59:21 +0000 Thomas Wood <[email protected]> wrote:
Quoted 5 lines · Vivek Kasireddy
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.
Quoted 5 lines
Quoted 1 line
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.Quoted 4 lines
Also, if re-sending the patch, please make sure it is tagged correctly as described in:
Quoted 6 lines
Quoted 3 lines
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.
Quoted 35 lines
Thanks and Regards,
VivekQuoted 31 lines
Quoted 31 lines
Suggested-by Matt Roper <matthew.d.roper at intel.com>Cc Thomas Wood <[email protected]>Signed-off-by Vivek Kasireddy <[email protected]>--- lib/igt_kms.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)lib/igt_kms.h +0
-0@@ -278,6 +278,18 @@ void igt_wait_for_vblank(int drm_fd, enum pipepipe); for (int
i__= 0; (plane) =
&(display)->pipes[(pipe)].planes[i__], \i__<
(display)->pipes[(pipe)].n_planes; i__++)lib/igt_kms.h +10
-0+/** +* 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
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
+
/*
* Can be used withigt_output_set_pipe()to mean we don't care
about the pipe
* that should drive this output
--
2.4.3
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/1 lib/igt_kms: Introduce get_first_connected_output macro
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.
--- lib/igt_kms.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
lib/igt_kms.h +12 -0
@@ -279,6 +279,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 +#define IGT_FIXED (i,f) ((i) << 16 | (f))void igt_enable_connectors (void );
Signature · 6 lines
2.4.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t v2] lib/igt_kms: Introduce get_first_connected_output macro
Quoted 23 lines · Vivek Kasireddy
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 <[email protected]>Signed-off-by Vivek Kasireddy <[email protected]>--- lib/igt_kms.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)lib/igt_kms.h +2
-0@@ -279,6 +279,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:
lib/igt_kms.h void igt_wait_for_vblank(int drm_fd, enum pipe pipe); · line 293
Quoted 10 lines
lib/igt_kms.h +10
-0+* @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 +
Is it possible that there is no valid output?
Ander
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t v2] lib/igt_kms: Introduce get_first_connected_output macro
Quoted 22 lines · Ander Conselvan De Oliveira
Quoted 21 lines · Vivek Kasireddy
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 <[email protected]>Signed-off-by Vivek Kasireddy <[email protected]>--- lib/igt_kms.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)lib/igt_kms.h +0
-0@@ -279,6 +279,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__++)
Quoted 15 lines
lib/igt_kms.h void igt_wait_for_vblank(int drm_fd, enum pipe pipe); · line 293
Quoted 12 lines
lib/igt_kms.h +12
-0+/** +* 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 +Is it possible that there is no valid output?
We also need to check at least crtc restrictions, otherwise bsw will fall over mightly. Or well anything with MIPI DSI encoders. -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t v2] lib/igt_kms: Introduce get_first_connected_output macro
In reply to Vivek KasireddyQuoted 22 lines · Vivek Kasireddy
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 <[email protected]>Signed-off-by Vivek Kasireddy <[email protected]>--- lib/igt_kms.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)lib/igt_kms.h +1
-0@@ -279,6 +279,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__++) +/**
lib/igt_kms.h void igt_wait_for_vblank(int drm_fd, enum pipe pipe); · line 292
Quoted 10 lines
lib/igt_kms.h +10
-0+* 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
Why is this a fragile macro instead of a simple function that just returns what we need?
Quoted 11 lines
lib/igt_kms.h +1
-0+#define IGT_FIXED (i,f) ((i) << 16 | (f))void igt_enable_connectors (void );Signature · 6 lines
2.4.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/1 tests/kms_rotation_crc: Use get_first_connected_output macro
In reply to Thomas WoodIn some cases, the only connected connector might not occupy the first slot and hence output[0] might be empty. Therefore, use the get_first_connected_output macro to find the output object associated with the connected connector.
--- tests/kms_rotation_crc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
tests/kms_rotation_crc.c +6 -4
@@ -323,14 +323,15 @@ static void test_plane_rotation_ytiled_obj(data_t *data, enum igt_plane plane_tyint bpp =igt_drm_format_to_bpp (format);enum igt_commit_style commit =COMMIT_LEGACY ;int fd = data->gfx_fd; -igt_output_t *output = &display->outputs[0 ]; +igt_output_t *output =NULL ;igt_plane_t *plane;drmModeModeInfo *mode;unsigned int stride, size, w, h;uint32_t gem_handle;int ret; -igt_require (output !=NULL && output->valid == true); +get_first_connected_output (display, output); +igt_require (output !=NULL ); plane =igt_output_get_plane (output, plane_type);igt_require (igt_plane_supports_rotation (plane));
@@ -385,7 +386,7 @@ static void test_plane_rotation_exhaust_fences(data_t *data, enum igt_plane planint bpp =igt_drm_format_to_bpp (format);enum igt_commit_style commit =COMMIT_LEGACY ;int fd = data->gfx_fd; -igt_output_t *output = &display->outputs[0 ]; +igt_output_t *output =NULL ;igt_plane_t *plane;drmModeModeInfo *mode;data_t data2[MAX_FENCES +1 ] = {};
@@ -394,7 +395,8 @@ static void test_plane_rotation_exhaust_fences(data_t *data, enum igt_plane planuint64_t total_aperture_size, total_fbs_size;int i, ret; -igt_require (output !=NULL && output->valid == true); +get_first_connected_output (display, output); +igt_require (output !=NULL ); plane =igt_output_get_plane (output, plane_type);igt_require (igt_plane_supports_rotation (plane));
Signature · 6 lines
2.4.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx