tests/kms_force_connector: Fixes
PATCH 1/3 tests/kms_force_connector: Fixes
Two things:
- Somehow the kernel's mode list changed with our EDID. No idea whether that's the right thing here since I'm not really an EDID expert. But then again the testcase wants to check that the injection works, not validate the kernel's parser.
- We need to disable the forcing _before_ we reprobe to check whether everything is back to normal: With the EDID gone but the connection still force to on the kernel will fall back to a default low-res mode list, making the testcase fail.
--- tests/kms_force_connector.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
tests/kms_force_connector.c +5 -3
@@ -153,20 +153,22 @@ int main(int argc, char **argv)CHECK_MODE (temp->modes[1 ],1280 ,720 ,60 );CHECK_MODE (temp->modes[2 ],1024 ,768 ,60 );CHECK_MODE (temp->modes[3 ],800 ,600 ,60 ); -CHECK_MODE (temp->modes[4 ],640 ,480 ,60 ); +CHECK_MODE (temp->modes[4 ],800 ,600 ,56 ); +CHECK_MODE (temp->modes[5 ],848 ,480 ,60 ); +CHECK_MODE (temp->modes[6 ],640 ,480 ,60 );drmModeFreeConnector (temp);/* remove edid */ kmstest_force_edid (drm_fd, vga_connector,NULL ,0 ); +kmstest_force_connector (drm_fd, vga_connector, +FORCE_CONNECTOR_UNSPECIFIED ); temp =drmModeGetConnector (drm_fd, vga_connector->connector_id);/* the connector should now have the same number of modes that * it started with */ igt_assert_eq (temp->count_modes, start_n_modes);drmModeFreeConnector (temp); -kmstest_force_connector (drm_fd, vga_connector, -FORCE_CONNECTOR_UNSPECIFIED ); } igt_fixture {
Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/3 lib/kms+tests: Use cached connector state
Speeds up testcases except for those where we want to exercise the probing itself. The only exceptions left where we do a full probe are
- pm_rpm: We use it to make sure the kernel doesn't get things wrong with power domains, so we really want to exercise the full probe paths. And there the only place really is the specific validation done with the data gathered by get_drm_info.
- kmstest_force_ functions: Newer kernels should be better at re-probing state when the force sysfs fields change, but better safe than sorry.
--- lib/igt_kms.c | 16 ++++++++++++++-- tests/kms_3d.c | 4 ++-- tests/kms_draw_crc.c | 4 ++-- tests/kms_fbcon_fbt.c | 2 +- tests/kms_flip.c | 2 +- tests/kms_force_connector.c | 37 ++++++++++++++++++++++++------------- tests/kms_frontbuffer_tracking.c | 2 +- tests/kms_setmode.c | 2 +- tests/pm_lpsp.c | 2 +- tests/pm_rpm.c | 4 +++- tests/testdisplay.c | 3 ++- 11 files changed, 52 insertions(+), 26 deletions(-)
lib/igt_kms.c +14 -2
@@ -393,6 +393,7 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector,char *path, **tmp;const char *value;int debugfs_fd, ret, len; +drmModeConnector *temp;uint32_t devid; devid =intel_get_drm_devid (drm_fd);
@@ -459,6 +460,11 @@ bool kmstest_force_connector(int drm_fd, drmModeConnector *connector,igt_install_exit_handler (reset_connectors_at_exit); +/* To allow callers to always use GetConnectorCurrent we need to force a +* redetection here. */ + temp =drmModeGetConnector (drm_fd, connector->connector_id); +drmModeFreeConnector (temp); +igt_assert (ret !=-1 );return (ret ==-1 ) ? false : true; }
@@ -480,6 +486,7 @@ void kmstest_force_edid(int drm_fd, drmModeConnector *connector, {char *path;int debugfs_fd, ret; +drmModeConnector *temp;igt_assert_neq (asprintf (&path,"%s-%d/edid_override" ,kmstest_connector_type_str (connector->connector_type), connector->connector_type_id),-1 );
@@ -494,6 +501,11 @@ void kmstest_force_edid(int drm_fd, drmModeConnector *connector, ret =write (debugfs_fd, edid, length);close (debugfs_fd); +/* To allow callers to always use GetConnectorCurrent we need to force a +* redetection here. */ + temp =drmModeGetConnector (drm_fd, connector->connector_id); +drmModeFreeConnector (temp); +igt_assert (ret !=-1 ); }
@@ -556,7 +568,7 @@ bool kmstest_get_connector_config(int drm_fd, uint32_t connector_id, }/* First, find the connector & mode */ - connector =drmModeGetConnector (drm_fd, connector_id); + connector =drmModeGetConnectorCurrent (drm_fd, connector_id);if (!connector) goto err2;
@@ -1979,7 +1991,7 @@ void igt_enable_connectors(void)for (int i =0 ; i < res->count_connectors; i++) { - c =drmModeGetConnector (drm_fd, res->connectors[i]); + c =drmModeGetConnectorCurrent (drm_fd, res->connectors[i]);/* don't attempt to force connectors that are already connected */
tests/kms_3d.c +2 -2
@@ -43,7 +43,7 @@ igt_simple_main/* find an hdmi connector */ for (int i =0 ; i < res->count_connectors; i++) { - connector =drmModeGetConnector (drm_fd, res->connectors[i]); + connector =drmModeGetConnectorCurrent (drm_fd, res->connectors[i]);if (connector->connector_type ==DRM_MODE_CONNECTOR_HDMIA && connector->connection ==DRM_MODE_DISCONNECTED )
@@ -66,7 +66,7 @@ igt_simple_main/* check for 3D modes */ mode_count =0 ; - connector =drmModeGetConnector (drm_fd, connector_id); + connector =drmModeGetConnectorCurrent (drm_fd, connector_id);for (int i =0 ; i < connector->count_modes; i++) {if (connector->modes[i].flags &DRM_MODE_FLAG_3D_MASK ) mode_count++;
tests/kms_draw_crc.c +2 -2
@@ -232,8 +232,8 @@ static void setup_environment(void)igt_assert (drm_res->count_connectors <=MAX_CONNECTORS );for (i =0 ; i < drm_res->count_connectors; i++) - drm_connectors[i] =drmModeGetConnector (drm_fd, - drm_res->connectors[i]); + drm_connectors[i] =drmModeGetConnectorCurrent (drm_fd, + drm_res->connectors[i]);kmstest_set_vt_graphics_mode ();
tests/kms_fbcon_fbt.c +1 -1
@@ -63,7 +63,7 @@ static void setup_drm(struct drm_info *drm)igt_assert (drm->res->count_connectors <=MAX_CONNECTORS );for (i =0 ; i < drm->res->count_connectors; i++) - drm->connectors[i] =drmModeGetConnector (drm->fd, + drm->connectors[i] =drmModeGetConnectorCurrent (drm->fd, drm->res->connectors[i]);kmstest_set_vt_graphics_mode ();
tests/kms_flip.c +1 -1
@@ -418,7 +418,7 @@ static void dpms_off_other_outputs(struct test_output *o) goto next; } - connector =drmModeGetConnector (drm_fd, connector_id); + connector =drmModeGetConnectorCurrent (drm_fd, connector_id);kmstest_set_connector_dpms (drm_fd, connector,DRM_MODE_DPMS_ON );kmstest_set_connector_dpms (drm_fd, connector,DRM_MODE_DPMS_OFF );
tests/kms_force_connector.c +24 -13
@@ -42,7 +42,8 @@ static void reset_connectors(void)for (int i =0 ; i < res->count_connectors; i++) { - connector =drmModeGetConnector (drm_fd, res->connectors[i]); + connector =drmModeGetConnectorCurrent (drm_fd, + res->connectors[i]);kmstest_force_connector (drm_fd, connector,FORCE_CONNECTOR_UNSPECIFIED );
@@ -71,7 +72,7 @@ int main(int argc, char **argv)int drm_fd =0 ;drmModeRes *res;drmModeConnector *vga_connector =NULL , *temp; -int start_n_modes; +int start_n_modes, start_connection;struct option long_opts[] = { {"reset" ,0 ,0 ,'r' }, {0 ,0 ,0 ,0 }
@@ -89,10 +90,14 @@ int main(int argc, char **argv)/* find the vga connector */ for (int i =0 ; i < res->count_connectors; i++) { - vga_connector =drmModeGetConnector (drm_fd, res->connectors[i]); + vga_connector =drmModeGetConnectorCurrent (drm_fd, + res->connectors[i]); -if (vga_connector->connector_type ==DRM_MODE_CONNECTOR_VGA ) +if (vga_connector->connector_type ==DRM_MODE_CONNECTOR_VGA ) { + start_n_modes = vga_connector->count_modes; + start_connection = vga_connector->connection;break ; + }drmModeFreeConnector (vga_connector);
@@ -108,7 +113,8 @@ int main(int argc, char **argv)/* force the connector on and check the reported values */ kmstest_force_connector (drm_fd, vga_connector,FORCE_CONNECTOR_ON ); - temp =drmModeGetConnector (drm_fd, vga_connector->connector_id); + temp =drmModeGetConnectorCurrent (drm_fd, + vga_connector->connector_id);igt_assert_eq (temp->connection,DRM_MODE_CONNECTED );igt_assert_lt (0 , temp->count_modes);drmModeFreeConnector (temp);
@@ -123,7 +129,8 @@ int main(int argc, char **argv)/* force the connector off */ kmstest_force_connector (drm_fd, vga_connector,FORCE_CONNECTOR_OFF ); - temp =drmModeGetConnector (drm_fd, vga_connector->connector_id); + temp =drmModeGetConnectorCurrent (drm_fd, + vga_connector->connector_id);igt_assert_eq (temp->connection,DRM_MODE_DISCONNECTED );igt_assert_eq (0 , temp->count_modes);drmModeFreeConnector (temp);
@@ -131,23 +138,26 @@ int main(int argc, char **argv)/* check that the previous state is restored */ kmstest_force_connector (drm_fd, vga_connector,FORCE_CONNECTOR_UNSPECIFIED ); - temp =drmModeGetConnector (drm_fd, vga_connector->connector_id); -igt_assert_eq (temp->connection, vga_connector->connection); + temp =drmModeGetConnectorCurrent (drm_fd, + vga_connector->connector_id); +igt_assert_eq (temp->connection, start_connection);drmModeFreeConnector (temp); } igt_subtest("force-edid") {kmstest_force_connector (drm_fd, vga_connector,FORCE_CONNECTOR_ON ); - temp =drmModeGetConnector (drm_fd, vga_connector->connector_id); - start_n_modes = temp->count_modes; + temp =drmModeGetConnectorCurrent (drm_fd, + vga_connector->connector_id);drmModeFreeConnector (temp);/* test edid forcing */ kmstest_force_edid (drm_fd, vga_connector,igt_kms_get_base_edid (),EDID_LENGTH ); - temp =drmModeGetConnector (drm_fd, - vga_connector->connector_id); + temp =drmModeGetConnectorCurrent (drm_fd, + vga_connector->connector_id); + +igt_debug ("num_conn %i\n" , temp->count_modes);CHECK_MODE (temp->modes[0 ],1920 ,1080 ,60 );CHECK_MODE (temp->modes[1 ],1280 ,720 ,60 );
@@ -163,7 +173,8 @@ int main(int argc, char **argv)kmstest_force_edid (drm_fd, vga_connector,NULL ,0 );kmstest_force_connector (drm_fd, vga_connector,FORCE_CONNECTOR_UNSPECIFIED ); - temp =drmModeGetConnector (drm_fd, vga_connector->connector_id); + temp =drmModeGetConnectorCurrent (drm_fd, + vga_connector->connector_id);/* the connector should now have the same number of modes that * it started with */ igt_assert_eq (temp->count_modes, start_n_modes);
tests/kms_frontbuffer_tracking.c +1 -1
@@ -1266,7 +1266,7 @@ static void setup_drm(void)igt_assert (drm.res->count_connectors <=MAX_CONNECTORS );for (i =0 ; i < drm.res->count_connectors; i++) - drm.connectors[i] =drmModeGetConnector (drm.fd, + drm.connectors[i] =drmModeGetConnectorCurrent (drm.fd, drm.res->connectors[i]); rc =drmSetClientCap (drm.fd,DRM_CLIENT_CAP_UNIVERSAL_PLANES ,1 );
tests/kms_setmode.c +1 -1
@@ -504,7 +504,7 @@ static int get_one_connector(drmModeRes *resources, int connector_id,drmModeConnector *connector;drmModeModeInfo mode; - connector =drmModeGetConnector (drm_fd, connector_id); + connector =drmModeGetConnectorCurrent (drm_fd, connector_id);igt_assert (connector); cconf->connector = connector;
tests/pm_lpsp.c +1 -1
@@ -231,7 +231,7 @@ igt_mainigt_assert (drm_res->count_connectors <=MAX_CONNECTORS );for (i =0 ; i < drm_res->count_connectors; i++) - drm_connectors[i] =drmModeGetConnector (drm_fd, + drm_connectors[i] =drmModeGetConnectorCurrent (drm_fd, drm_res->connectors[i]);disable_audio_runtime_pm ();
tests/pm_rpm.c +3 -1
@@ -370,7 +370,7 @@ static void init_mode_set_data(struct mode_set_data *data)igt_assert (data->res->count_connectors <=MAX_CONNECTORS );for (i =0 ; i < data->res->count_connectors; i++) { - data->connectors[i] =drmModeGetConnector (drm_fd, + data->connectors[i] =drmModeGetConnectorCurrent (drm_fd, data->res->connectors[i]); data->edids[i] =get_connector_edid (data->connectors[i], i); }
@@ -405,6 +405,8 @@ static void get_drm_info(struct compare_data *data)igt_assert (data->res->count_crtcs <=MAX_CRTCS );for (i =0 ; i < data->res->count_connectors; i++) { +/* Don't use GetConnectorCurrent, we want to force a reprobe +* here. */ data->connectors[i] =drmModeGetConnector (drm_fd, data->res->connectors[i]); data->edids[i] =get_connector_edid (data->connectors[i], i);
tests/testdisplay.c +2 -1
@@ -132,7 +132,8 @@ static void dump_connectors_fd(int drmfd)for (i =0 ; i < mode_resources->count_connectors; i++) {drmModeConnector *connector; - connector =drmModeGetConnector (drmfd, mode_resources->connectors[i]); + connector =drmModeGetConnectorCurrent (drmfd, + mode_resources->connectors[i]);if (!connector) {igt_warn ("could not get connector %i: %s\n" , mode_resources->connectors[i],strerror (errno));continue ;
Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/3 tests/kms_force_connector: Include in BAT set
In reply to Daniel VetterForcing connector state is a basic piece of our test infrastructure that we use in all the kms_ tests. It allows us to run tests even if no outputs are connected.
They're also really fast, so perfect candidates for inclusion into the BAT set.
--- tests/.gitignore | 2 +- tests/Makefile.sources | 2 +- tests/kms_force_connector.c | 193 -------------------------------------- tests/kms_force_connector_basic.c | 193 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 195 insertions(+), 195 deletions(-) delete mode 100644 tests/kms_force_connector.c create mode 100644 tests/kms_force_connector_basic.c
tests/.gitignore +1 -1
@@ -138,7 +138,7 @@ kms_fence_pin_leak kms_flip kms_flip_event_leak kms_flip_tiling -kms_force_connector +kms_force_connector_basic kms_frontbuffer_tracking kms_legacy_colorkey kms_mmio_vs_cs_flip
tests/Makefile.sources +1 -1
@@ -163,7 +163,7 @@ TESTS_progs = \ gen7_forcewake_mt \ kms_3d \ kms_fence_pin_leak \ - kms_force_connector \ + kms_force_connector_basic \ kms_pwrite_crc \ kms_sink_crc_basic \ prime_udl \
tests/kms_force_connector.c deleted +0 -193
193 lines not on this page · raw message
tests/kms_force_connector_basic.c new file +193 -0
193 lines not on this page · raw message
Signature · 6 lines
2.1.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 5 lines · Daniel Vetter
Two things:
- Somehow the kernel's mode list changed with our EDID. No idea whether that's the right thing here since I'm not really an EDID expert. But then again the testcase wants to check that the injection works, not validate the kernel's parser.
If only checking that the injection worked, perhaps it would be more robust just to check that at least one of the expected modes is present, in any position in the array. Ideally this would be a mode that isn't included in the default modes when a connector is enabled.
Quoted 5 lines
- We need to disable the forcing _before_ we reprobe to check whether everything is back to normal: With the EDID gone but the connection still force to on the kernel will fall back to a default low-res mode list, making the testcase fail.
This should be taken into account with the value of start_n_modes, since this is calculated after the connector is enabled.
Quoted 39 lines
Signed-off-by Daniel Vetter <[email protected]>--- tests/kms_force_connector.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)tests/kms_force_connector.c +5
-4@@ -153,20 +153,22 @@ int main(int argc, char **argv)CHECK_MODE (temp->modes[1 ],1280 ,720 ,60 );CHECK_MODE (temp->modes[2 ],1024 ,768 ,60 );CHECK_MODE (temp->modes[3 ],800 ,600 ,60 ); -CHECK_MODE (temp->modes[4 ],640 ,480 ,60 ); +CHECK_MODE (temp->modes[4 ],800 ,600 ,56 ); +CHECK_MODE (temp->modes[5 ],848 ,480 ,60 ); +CHECK_MODE (temp->modes[6 ],640 ,480 ,60 );drmModeFreeConnector (temp);/* remove edid */ kmstest_force_edid (drm_fd, vga_connector,NULL ,0 ); +kmstest_force_connector (drm_fd, vga_connector, +FORCE_CONNECTOR_UNSPECIFIED ); temp =drmModeGetConnector (drm_fd, vga_connector->connector_id);/* the connector should now have the same number of modes that * it started with */ igt_assert_eq (temp->count_modes, start_n_modes);drmModeFreeConnector (temp); -kmstest_force_connector (drm_fd, vga_connector, -FORCE_CONNECTOR_UNSPECIFIED ); } igt_fixture { --2.1.0
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
Quoted 11 lines · Thomas Wood
Quoted 5 lines · Daniel Vetter
Two things:
- Somehow the kernel's mode list changed with our EDID. No idea whether that's the right thing here since I'm not really an EDID expert. But then again the testcase wants to check that the injection works, not validate the kernel's parser.If only checking that the injection worked, perhaps it would be more robust just to check that at least one of the expected modes is present, in any position in the array. Ideally this would be a mode that isn't included in the default modes when a connector is enabled.
One option would be to check for the 1920x1080 mode only. That's the preferred one, so really must be first. And it's way more high-res than any of the default modes we inject (those top out at 1024x768). Ok with that?
Quoted 7 lines
Quoted 4 lines
- We need to disable the forcing _before_ we reprobe to check whether everything is back to normal: With the EDID gone but the connection still force to on the kernel will fall back to a default low-res mode list, making the testcase fail.
This should be taken into account with the value of
start_n_modes, since this is calculated after the connector is enabled.
Oops, I did accidentally break this in my GetConnectorCurrent patch, since there I consolidated them all to avoid overhead. And didn't notice because of the earlier breakage.
I'll respin these two and shift the 2nd change to the 2nd patch. -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