mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-21 14:56:18 +00:00
lib/igt_kms: Simplify return value of kmstest_get_connector_config
A plain bool is enough. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
81dfcaba88
commit
1cad834261
@ -414,7 +414,7 @@ bool kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector,
|
||||
return true;
|
||||
}
|
||||
|
||||
int kmstest_get_connector_config(int drm_fd, uint32_t connector_id,
|
||||
bool kmstest_get_connector_config(int drm_fd, uint32_t connector_id,
|
||||
unsigned long crtc_idx_mask,
|
||||
struct kmstest_connector_config *config)
|
||||
{
|
||||
@ -493,7 +493,7 @@ found:
|
||||
|
||||
drmModeFreeResources(resources);
|
||||
|
||||
return 0;
|
||||
return true;
|
||||
err4:
|
||||
drmModeFreeEncoder(encoder);
|
||||
err3:
|
||||
@ -501,7 +501,7 @@ err3:
|
||||
err2:
|
||||
drmModeFreeResources(resources);
|
||||
err1:
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
void kmstest_free_connector_config(struct kmstest_connector_config *config)
|
||||
@ -651,7 +651,7 @@ static void igt_display_log_shift(igt_display_t *display, int shift)
|
||||
static void igt_output_refresh(igt_output_t *output)
|
||||
{
|
||||
igt_display_t *display = output->display;
|
||||
int ret;
|
||||
bool ret;
|
||||
unsigned long crtc_idx_mask;
|
||||
|
||||
/* we mask out the pipes already in use */
|
||||
@ -659,11 +659,12 @@ static void igt_output_refresh(igt_output_t *output)
|
||||
|
||||
if (output->valid)
|
||||
kmstest_free_connector_config(&output->config);
|
||||
|
||||
ret = kmstest_get_connector_config(display->drm_fd,
|
||||
output->id,
|
||||
crtc_idx_mask,
|
||||
&output->config);
|
||||
if (ret == 0)
|
||||
if (ret)
|
||||
output->valid = true;
|
||||
else
|
||||
output->valid = false;
|
||||
|
@ -103,7 +103,6 @@ void kmstest_dump_mode(drmModeModeInfo *mode);
|
||||
int kmstest_get_pipe_from_crtc_id(int fd, int crtc_id);
|
||||
void kmstest_set_vt_graphics_mode(void);
|
||||
|
||||
|
||||
struct kmstest_connector_config {
|
||||
drmModeCrtc *crtc;
|
||||
drmModeConnector *connector;
|
||||
@ -154,7 +153,7 @@ void kmstest_force_edid(int drm_fd, drmModeConnector *connector,
|
||||
|
||||
bool kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector,
|
||||
drmModeModeInfo *mode);
|
||||
int kmstest_get_connector_config(int drm_fd, uint32_t connector_id,
|
||||
bool kmstest_get_connector_config(int drm_fd, uint32_t connector_id,
|
||||
unsigned long crtc_idx_mask,
|
||||
struct kmstest_connector_config *config);
|
||||
void kmstest_free_connector_config(struct kmstest_connector_config *config);
|
||||
|
@ -989,8 +989,8 @@ static void connector_find_preferred_mode(uint32_t connector_id, int crtc_idx,
|
||||
{
|
||||
struct kmstest_connector_config config;
|
||||
|
||||
if (kmstest_get_connector_config(drm_fd, connector_id, 1 << crtc_idx,
|
||||
&config) < 0) {
|
||||
if (!kmstest_get_connector_config(drm_fd, connector_id, 1 << crtc_idx,
|
||||
&config)) {
|
||||
o->mode_valid = 0;
|
||||
return;
|
||||
}
|
||||
@ -1032,12 +1032,12 @@ static void connector_find_compatible_mode(int crtc_idx0, int crtc_idx1,
|
||||
drmModeModeInfo *mode[2];
|
||||
int n, m;
|
||||
|
||||
if (kmstest_get_connector_config(drm_fd, o->_connector[0],
|
||||
1 << crtc_idx0, &config[0]) < 0)
|
||||
if (!kmstest_get_connector_config(drm_fd, o->_connector[0],
|
||||
1 << crtc_idx0, &config[0]))
|
||||
return;
|
||||
|
||||
if (kmstest_get_connector_config(drm_fd, o->_connector[1],
|
||||
1 << crtc_idx1, &config[1]) < 0) {
|
||||
if (!kmstest_get_connector_config(drm_fd, o->_connector[1],
|
||||
1 << crtc_idx1, &config[1])) {
|
||||
kmstest_free_connector_config(&config[0]);
|
||||
return;
|
||||
}
|
||||
|
@ -443,13 +443,10 @@ static void test_crc(data_t *data)
|
||||
|
||||
static bool prepare_crtc(data_t *data, uint32_t connector_id)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = kmstest_get_connector_config(data->drm_fd,
|
||||
if (!kmstest_get_connector_config(data->drm_fd,
|
||||
connector_id,
|
||||
1 << data->crtc_idx,
|
||||
&data->config);
|
||||
if (ret)
|
||||
&data->config))
|
||||
return false;
|
||||
|
||||
data->fb_id[0] = create_fb(data,
|
||||
|
@ -198,11 +198,9 @@ static int run_test(const char *test_name, enum test_flags flags)
|
||||
connector_id = resources->connectors[i];
|
||||
for (j = 0; j < resources->count_crtcs; j++) {
|
||||
struct kmstest_connector_config cconf;
|
||||
int ret;
|
||||
|
||||
ret = kmstest_get_connector_config(drm_fd, connector_id,
|
||||
1 << j, &cconf);
|
||||
if (ret < 0)
|
||||
if (!kmstest_get_connector_config(drm_fd, connector_id,
|
||||
1 << j, &cconf))
|
||||
continue;
|
||||
|
||||
test_connector(test_name, &cconf, flags);
|
||||
|
@ -111,16 +111,14 @@ connector_set_mode(data_t *data, connector_t *connector, drmModeModeInfo *mode,
|
||||
static void basic_sink_crc_check(data_t *data, uint32_t connector_id)
|
||||
{
|
||||
connector_t connector;
|
||||
int ret;
|
||||
char ref_crc_white[12];
|
||||
char ref_crc_black[12];
|
||||
char crc_check[12];
|
||||
|
||||
ret = kmstest_get_connector_config(data->drm_fd,
|
||||
igt_require(kmstest_get_connector_config(data->drm_fd,
|
||||
connector_id,
|
||||
1 << 0,
|
||||
&connector.config);
|
||||
igt_require(ret == 0);
|
||||
&connector.config));
|
||||
|
||||
/*Go White*/
|
||||
connector_set_mode(data, &connector, &connector.config.default_mode, WHITE);
|
||||
|
@ -191,8 +191,8 @@ static void connector_find_preferred_mode(uint32_t connector_id,
|
||||
{
|
||||
struct kmstest_connector_config config;
|
||||
|
||||
if (kmstest_get_connector_config(drm_fd, connector_id, crtc_idx_mask,
|
||||
&config) < 0) {
|
||||
if (!kmstest_get_connector_config(drm_fd, connector_id, crtc_idx_mask,
|
||||
&config)) {
|
||||
c->mode_valid = 0;
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user