Various fixes for non-Intel compatibility
cover Various fixes for non-Intel compatibility
Here's a couple of fixes I ended up needing when I was working on trying to get the chamelium tests to pass on the other GPUs I've got available. This should make both igt_display_init() and kmstest_force_connector() work properly on most non-intel hardware.
Lyude (3):
igt_kms: Don't assume we have cursor planes if we have primary ones
igt_kms: Change the max number of pipes to 6
igt_kms: Don't require intel hardware for kmstest_force_connector
lib/igt_kms.c | 50 +++++++++++++++++++++++++++++--------------------- lib/igt_kms.h | 23 ++++++++++++++++++++--- 2 files changed, 49 insertions(+), 24 deletions(-)
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/3 igt_kms: Don't assume we have cursor planes if we have primary ones
On certain models of nvidia and AMD GPUs, we can have a primary plane without any DRM plane for the cursor plane. Check for this so we don't segfault on non-intel hardware.
--- lib/igt_kms.c | 27 +++++++++++++++------------ lib/igt_kms.h | 1 + 2 files changed, 16 insertions(+), 12 deletions(-)
lib/igt_kms.c +15 -12
@@ -1419,7 +1419,7 @@ void igt_display_init(igt_display_t *display, int drm_fd) plane = &pipe->planes[IGT_PLANE_CURSOR ]; plane->is_cursor =1 ; plane->index =IGT_PLANE_CURSOR ; - display->has_universal_planes =1 ; + display->has_cursor_plane =1 ;break ;default : plane = &pipe->planes[p];
@@ -1444,9 +1444,20 @@ void igt_display_init(igt_display_t *display, int drm_fd) plane->rotation = (igt_rotation_t )prop_value; } -if (display->has_universal_planes) { +if (!display->has_universal_planes) { +/* +* No universal plane support. Add drm_plane-less +* primary and cursor planes. +*/ + plane = &pipe->planes[IGT_PLANE_PRIMARY ]; + plane->pipe = pipe; + plane->index =IGT_PLANE_PRIMARY ; + plane->is_primary = true; + } + +if (display->has_cursor_plane) {/* -* If we have universal planes, we should have both +* If we have a cursor plane, we should have both * primary and cursor planes setup now. */ igt_assert(pipe->planes[IGT_PLANE_PRIMARY].drm_plane &&
@@ -1464,15 +1475,7 @@ void igt_display_init(igt_display_t *display, int drm_fd) sizeof *plane); } }else { -/* -* No universal plane support. Add drm_plane-less -* primary and cursor planes. -*/ - plane = &pipe->planes[IGT_PLANE_PRIMARY ]; - plane->pipe = pipe; - plane->index =IGT_PLANE_PRIMARY ; - plane->is_primary = true; - +/* Add drm_plane-less cursor */ plane = &pipe->planes[p]; plane->pipe = pipe; plane->index = p;
lib/igt_kms.h +1 -0
@@ -312,6 +312,7 @@ struct igt_display {igt_output_t *outputs;igt_pipe_t pipes[I915_MAX_PIPES ];bool has_universal_planes; +bool has_cursor_plane;bool is_atomic; };
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 1/3] igt_kms: Don't assume we have cursor planes if we have primary ones
Quoted 15 lines · Lyude
On certain models of nvidia and AMD GPUs, we can have a primary plane without any DRM plane for the cursor plane. Check for this so we don't segfault on non-intel hardware.
Signed-off-by Lyude <[email protected]>--- lib/igt_kms.c | 27 +++++++++++++++------------ lib/igt_kms.h | 1 + 2 files changed, 16 insertions(+), 12 deletions(-)lib/igt_kms.c +0
-0
lib/igt_kms.c void igt_display_init(igt_display_t *display, int drm_fd) · line 1422
Quoted 5 lines
lib/igt_kms.c +1
-1@@ -1419,7 +1419,7 @@ void igt_display_init(igt_display_t *display, int drm_fd) plane = &pipe->planes[IGT_PLANE_CURSOR ]; plane->is_cursor =1 ; plane->index =IGT_PLANE_CURSOR ; - display->has_universal_planes =1 ; + display->has_cursor_plane =1 ;
Looks good to me, but Daniel Vetter voiced support the other day for dropping support for !has_universal_planes so it may not be a good idea to complicate this further.
But if we go this way, the has_cursor_plane name could be misleading in the !universal_plane case if there's a cursor plane.
Regards,
Tomeu
Quoted 58 lines
lib/igt_kms.c +14
-11break ;default : plane = &pipe->planes[p];@@ -1444,9 +1444,20 @@ void igt_display_init(igt_display_t *display, int drm_fd) plane->rotation = (igt_rotation_t )prop_value; } -if (display->has_universal_planes) { +if (!display->has_universal_planes) { +/* +* No universal plane support. Add drm_plane-less +* primary and cursor planes. +*/ + plane = &pipe->planes[IGT_PLANE_PRIMARY ]; + plane->pipe = pipe; + plane->index =IGT_PLANE_PRIMARY ; + plane->is_primary = true; + } + +if (display->has_cursor_plane) {/* -* If we have universal planes, we should have both +* If we have a cursor plane, we should have both * primary and cursor planes setup now. */ igt_assert(pipe->planes[IGT_PLANE_PRIMARY].drm_plane &&@@ -1464,15 +1475,7 @@ void igt_display_init(igt_display_t *display, int drm_fd) sizeof *plane); } }else { -/* -* No universal plane support. Add drm_plane-less -* primary and cursor planes. -*/ - plane = &pipe->planes[IGT_PLANE_PRIMARY ]; - plane->pipe = pipe; - plane->index =IGT_PLANE_PRIMARY ; - plane->is_primary = true; - +/* Add drm_plane-less cursor */ plane = &pipe->planes[p]; plane->pipe = pipe; plane->index = p;lib/igt_kms.h +1
-1@@ -312,6 +312,7 @@ struct igt_display {igt_output_t *outputs;igt_pipe_t pipes[I915_MAX_PIPES ];bool has_universal_planes; +bool has_cursor_plane;bool is_atomic; }; --2.7.4
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/3 igt_kms: Change the max number of pipes to 6
In reply to LyudeUnfortunately the assumption that we only have 6 display pipes available is specific to Intel, and seems to be breaking igt_display_init() on both radeon and nouveau since this causes us not to leave enough space in the igt_display_t struct to hold information for all 6 pipes.
So, up the max to 6. As well, add IGT_MAX_PIPES and use that instead since this is no longer specific to Intel. We also leave I915_MAX_PIPES defined as 3 so as to not break existing tests relying on this.
--- lib/igt_kms.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
lib/igt_kms.h +19 -3
@@ -46,7 +46,10 @@* @PIPE_A: First crtc. * @PIPE_B: Second crtc. * @PIPE_C: Third crtc. -* @I915_MAX_PIPES: Max number of pipes allowed. +* @PIPE_D: Fourth crtc. +* @PIPE_E: Fifth crtc. +* @PIPE_F: Sixth crtc. +* @IGT_MAX_PIPES: Max number of pipes allowed. */ enum pipe {PIPE_NONE =-1 ,
@@ -54,10 +57,23 @@ enum pipe {PIPE_A =0 ,PIPE_B ,PIPE_C , -I915_MAX_PIPES +PIPE_D , +PIPE_E , +PIPE_F , + IGT_MAX_PIPES, };const char *kmstest_pipe_name (enum pipe pipe); +/** +* I915_MAX_PIPES: +* +* The max number of pipes on i915 devices. This should only be used for tests +* which are guaranteed to only be used on intel hardware. All other tests +* should use @IGT_MAX_PIPES and/or check the number of reported pipes on the +* hardware. +*/ +#define I915_MAX_PIPES 3 +/* We namespace this enum to not conflict with the Android i915_drm.h */ enum igt_plane { IGT_PLANE_1 = 0,
@@ -310,7 +326,7 @@ struct igt_display {int n_outputs;unsigned long pipes_in_use;igt_output_t *outputs; -igt_pipe_t pipes[I915_MAX_PIPES ]; +igt_pipe_t pipes[IGT_MAX_PIPES ];bool has_universal_planes;bool has_cursor_plane;bool is_atomic;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 2/3] igt_kms: Change the max number of pipes to 6
Quoted 8 lines · Lyude
Unfortunately the assumption that we only have 6 display pipes available is specific to Intel, and seems to be breaking
igt_display_init()on both radeon and nouveau since this causes us not to leave enough space in theigt_display_tstruct to hold information for all 6 pipes.So, up the max to 6. As well, add
IGT_MAX_PIPESand use that instead since this is no longer specific to Intel. We also leaveI915_MAX_PIPESdefined as 3 so as to not break existing tests relying on this.
Hi Lyude,
we already have igt_display_t.n_pipes for this, which is count_crtcs.
So I think any tests should stop using the hardcoded values and use the value we get from the kernel instead.
Regards,
Tomeu
Quoted 58 lines
Signed-off-by Lyude <[email protected]>--- lib/igt_kms.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)lib/igt_kms.h +19
-4@@ -46,7 +46,10 @@* @PIPE_A: First crtc. * @PIPE_B: Second crtc. * @PIPE_C: Third crtc. -* @I915_MAX_PIPES: Max number of pipes allowed. +* @PIPE_D: Fourth crtc. +* @PIPE_E: Fifth crtc. +* @PIPE_F: Sixth crtc. +* @IGT_MAX_PIPES: Max number of pipes allowed. */ enum pipe {PIPE_NONE =-1 ,@@ -54,10 +57,23 @@ enum pipe {PIPE_A =0 ,PIPE_B ,PIPE_C , -I915_MAX_PIPES +PIPE_D , +PIPE_E , +PIPE_F , + IGT_MAX_PIPES, };const char *kmstest_pipe_name (enum pipe pipe); +/** +* I915_MAX_PIPES: +* +* The max number of pipes on i915 devices. This should only be used for tests +* which are guaranteed to only be used on intel hardware. All other tests +* should use @IGT_MAX_PIPES and/or check the number of reported pipes on the +* hardware. +*/ +#define I915_MAX_PIPES 3 +/* We namespace this enum to not conflict with the Android i915_drm.h */ enum igt_plane { IGT_PLANE_1 = 0,@@ -310,7 +326,7 @@ struct igt_display {int n_outputs;unsigned long pipes_in_use;igt_output_t *outputs; -igt_pipe_t pipes[I915_MAX_PIPES ]; +igt_pipe_t pipes[IGT_MAX_PIPES ];bool has_universal_planes;bool has_cursor_plane;bool is_atomic; --2.7.4
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/3 igt_kms: Don't require intel hardware for kmstest_force_connector
In reply to LyudeDue to the unconditional call to intel_get_drm_devid() in kmstest_force_connector(), trying to use this function on anything that isn't intel hardware results in the current fixture being skipped. So, don't try to get the devid in kmstest_force_connector() unless we're on an Intel chipset.
--- lib/igt_kms.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
lib/igt_kms.c +14 -9
@@ -627,15 +627,20 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector,uint32_t devid;int len, dir, idx; - devid =intel_get_drm_devid (drm_fd); - -/* forcing hdmi or dp connectors on HSW and BDW doesn't currently work, -* so fail early to allow the test to skip if required */ -if ((connector->connector_type ==DRM_MODE_CONNECTOR_HDMIA || - connector->connector_type ==DRM_MODE_CONNECTOR_HDMIB || - connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) - && (IS_HASWELL (devid) ||IS_BROADWELL (devid))) -return false; +if (is_i915_device (drm_fd)) { + devid =intel_get_drm_devid (drm_fd); + +/* +* forcing hdmi or dp connectors on HSW and BDW doesn't +* currently work, so fail early to allow the test to skip if +* required +*/ +if ((connector->connector_type ==DRM_MODE_CONNECTOR_HDMIA || + connector->connector_type ==DRM_MODE_CONNECTOR_HDMIB || + connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) + && (IS_HASWELL (devid) ||IS_BROADWELL (devid))) +return false; + }switch (state) {case FORCE_CONNECTOR_ON :
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx