mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-12 02:16:17 +00:00
tests/kms_flip: use igt_assert in the dpms helpers
No need to route the error code around really. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
0b19cb5dc2
commit
16b61932bb
@ -244,9 +244,10 @@ static void emit_dummy_load__rcs(struct test_output *o)
|
|||||||
drm_intel_bo_unreference(sb[1].bo);
|
drm_intel_bo_unreference(sb[1].bo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_connector_dpms(drmModeConnector *connector, int mode)
|
static void set_connector_dpms(drmModeConnector *connector, int mode)
|
||||||
{
|
{
|
||||||
int i, dpms = 0;
|
int i, dpms = 0;
|
||||||
|
bool found_it = false;
|
||||||
|
|
||||||
for (i = 0; i < connector->count_props; i++) {
|
for (i = 0; i < connector->count_props; i++) {
|
||||||
struct drm_mode_get_property prop;
|
struct drm_mode_get_property prop;
|
||||||
@ -261,17 +262,14 @@ static int set_connector_dpms(drmModeConnector *connector, int mode)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
dpms = prop.prop_id;
|
dpms = prop.prop_id;
|
||||||
|
found_it = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!dpms) {
|
igt_assert_f(found_it, "DPMS property not found on %d\n",
|
||||||
fprintf(stderr, "DPMS property not found on %d\n",
|
connector->connector_id);
|
||||||
connector->connector_id);
|
|
||||||
errno = ENOENT;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return drmModeConnectorSetProperty(drm_fd, connector->connector_id,
|
igt_assert(drmModeConnectorSetProperty(drm_fd, connector->connector_id,
|
||||||
dpms, mode);
|
dpms, mode) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dpms_off_other_outputs(struct test_output *o)
|
static void dpms_off_other_outputs(struct test_output *o)
|
||||||
@ -290,24 +288,17 @@ static void dpms_off_other_outputs(struct test_output *o)
|
|||||||
|
|
||||||
connector = drmModeGetConnector(drm_fd, connector_id);
|
connector = drmModeGetConnector(drm_fd, connector_id);
|
||||||
|
|
||||||
do_or_die(set_connector_dpms(connector, DRM_MODE_DPMS_ON));
|
set_connector_dpms(connector, DRM_MODE_DPMS_ON);
|
||||||
do_or_die(set_connector_dpms(connector, DRM_MODE_DPMS_OFF));
|
set_connector_dpms(connector, DRM_MODE_DPMS_OFF);
|
||||||
next:
|
next:
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_dpms(struct test_output *o, int mode)
|
static void set_dpms(struct test_output *o, int mode)
|
||||||
{
|
{
|
||||||
int n;
|
for (int n = 0; n < o->count; n++)
|
||||||
|
set_connector_dpms(o->kconnector[n], mode);
|
||||||
for (n = 0; n < o->count; n++) {
|
|
||||||
int ret = set_connector_dpms(o->kconnector[n], mode);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_flag(unsigned int *v, unsigned int flag)
|
static void set_flag(unsigned int *v, unsigned int flag)
|
||||||
@ -830,7 +821,7 @@ static unsigned int run_test_step(struct test_output *o)
|
|||||||
== -EINVAL);
|
== -EINVAL);
|
||||||
|
|
||||||
if (o->flags & TEST_DPMS_OFF)
|
if (o->flags & TEST_DPMS_OFF)
|
||||||
do_or_die(set_dpms(o, DRM_MODE_DPMS_OFF));
|
set_dpms(o, DRM_MODE_DPMS_OFF);
|
||||||
|
|
||||||
if (o->flags & TEST_MODESET) {
|
if (o->flags & TEST_MODESET) {
|
||||||
if (set_mode(o, o->fb_ids[o->current_fb_id], 0, 0)) {
|
if (set_mode(o, o->fb_ids[o->current_fb_id], 0, 0)) {
|
||||||
@ -841,7 +832,7 @@ static unsigned int run_test_step(struct test_output *o)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (o->flags & TEST_DPMS)
|
if (o->flags & TEST_DPMS)
|
||||||
do_or_die(set_dpms(o, DRM_MODE_DPMS_ON));
|
set_dpms(o, DRM_MODE_DPMS_ON);
|
||||||
|
|
||||||
printf("."); fflush(stdout);
|
printf("."); fflush(stdout);
|
||||||
|
|
||||||
@ -886,7 +877,7 @@ static unsigned int run_test_step(struct test_output *o)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (o->flags & TEST_DPMS)
|
if (o->flags & TEST_DPMS)
|
||||||
do_or_die(set_dpms(o, DRM_MODE_DPMS_OFF));
|
set_dpms(o, DRM_MODE_DPMS_OFF);
|
||||||
|
|
||||||
if (o->flags & TEST_MODESET && !(o->flags & TEST_RMFB)) {
|
if (o->flags & TEST_MODESET && !(o->flags & TEST_RMFB)) {
|
||||||
if (set_mode(o, 0 /* no fb */, 0, 0)) {
|
if (set_mode(o, 0 /* no fb */, 0, 0)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user