mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-28 02:06:23 +00:00
lib: don't abort if forcing the connector state fails
Ensure tests using igt_enable_connectors can still run even if the relevant debugfs files are not available. Signed-off-by: Thomas Wood <thomas.wood@intel.com>
This commit is contained in:
parent
c3ba7740c1
commit
bb48429a6c
@ -429,9 +429,11 @@ static char* get_debugfs_connector_path(int drm_fd, drmModeConnector *connector,
|
|||||||
* @state: state to force on @connector
|
* @state: state to force on @connector
|
||||||
*
|
*
|
||||||
* Force the specified state on the specified connector.
|
* Force the specified state on the specified connector.
|
||||||
|
*
|
||||||
|
* Returns: true on success
|
||||||
*/
|
*/
|
||||||
void kmstest_force_connector(int drm_fd, drmModeConnector *connector, enum
|
bool kmstest_force_connector(int drm_fd, drmModeConnector *connector,
|
||||||
kmstest_force_connector_state state)
|
enum kmstest_force_connector_state state)
|
||||||
{
|
{
|
||||||
char *path;
|
char *path;
|
||||||
const char *value;
|
const char *value;
|
||||||
@ -458,12 +460,15 @@ void kmstest_force_connector(int drm_fd, drmModeConnector *connector, enum
|
|||||||
debugfs_fd = open(path, O_WRONLY | O_TRUNC);
|
debugfs_fd = open(path, O_WRONLY | O_TRUNC);
|
||||||
free(path);
|
free(path);
|
||||||
|
|
||||||
igt_assert(debugfs_fd != -1);
|
if (debugfs_fd == -1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
ret = write(debugfs_fd, value, strlen(value));
|
ret = write(debugfs_fd, value, strlen(value));
|
||||||
close(debugfs_fd);
|
close(debugfs_fd);
|
||||||
|
|
||||||
igt_assert(ret != -1);
|
igt_assert(ret != -1);
|
||||||
|
return (ret == -1) ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1509,8 +1514,12 @@ void igt_enable_connectors(void)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* just enable VGA for now */
|
/* just enable VGA for now */
|
||||||
if (c->connector_type == DRM_MODE_CONNECTOR_VGA)
|
if (c->connector_type == DRM_MODE_CONNECTOR_VGA) {
|
||||||
kmstest_force_connector(drm_fd, c, FORCE_CONNECTOR_ON);
|
if (!kmstest_force_connector(drm_fd, c, FORCE_CONNECTOR_ON))
|
||||||
|
igt_info("Unable to force state on %s-%d\n",
|
||||||
|
kmstest_connector_type_str(c->connector_type),
|
||||||
|
c->connector_type_id);
|
||||||
|
}
|
||||||
|
|
||||||
drmModeFreeConnector(c);
|
drmModeFreeConnector(c);
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ int kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector,
|
|||||||
int kmstest_get_connector_config(int drm_fd, uint32_t connector_id,
|
int kmstest_get_connector_config(int drm_fd, uint32_t connector_id,
|
||||||
unsigned long crtc_idx_mask,
|
unsigned long crtc_idx_mask,
|
||||||
struct kmstest_connector_config *config);
|
struct kmstest_connector_config *config);
|
||||||
void kmstest_force_connector(int fd, drmModeConnector *connector,
|
bool kmstest_force_connector(int fd, drmModeConnector *connector,
|
||||||
enum kmstest_force_connector_state state);
|
enum kmstest_force_connector_state state);
|
||||||
void kmstest_force_edid(int drm_fd, drmModeConnector *connector,
|
void kmstest_force_edid(int drm_fd, drmModeConnector *connector,
|
||||||
const unsigned char *edid, size_t length);
|
const unsigned char *edid, size_t length);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user