mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-12 10:26:12 +00:00
lib: extract kmstest_set_connector_dpms
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
066ad35ee7
commit
29ee36f259
@ -180,6 +180,34 @@ int kmstest_get_pipe_from_crtc_id(int fd, int crtc_id)
|
|||||||
return pfci.pipe;
|
return pfci.pipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void kmstest_set_connector_dpms(int fd, drmModeConnector *connector, int mode)
|
||||||
|
{
|
||||||
|
int i, dpms = 0;
|
||||||
|
bool found_it = false;
|
||||||
|
|
||||||
|
for (i = 0; i < connector->count_props; i++) {
|
||||||
|
struct drm_mode_get_property prop;
|
||||||
|
|
||||||
|
prop.prop_id = connector->props[i];
|
||||||
|
prop.count_values = 0;
|
||||||
|
prop.count_enum_blobs = 0;
|
||||||
|
if (drmIoctl(fd, DRM_IOCTL_MODE_GETPROPERTY, &prop))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (strcmp(prop.name, "DPMS"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
dpms = prop.prop_id;
|
||||||
|
found_it = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
igt_assert_f(found_it, "DPMS property not found on %d\n",
|
||||||
|
connector->connector_id);
|
||||||
|
|
||||||
|
igt_assert(drmModeConnectorSetProperty(fd, connector->connector_id,
|
||||||
|
dpms, mode) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
static signed long set_vt_mode(unsigned long mode)
|
static signed long set_vt_mode(unsigned long mode)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
@ -88,6 +88,7 @@ const char *kmstest_pipe_str(int pipe);
|
|||||||
const char *kmstest_encoder_type_str(int type);
|
const char *kmstest_encoder_type_str(int type);
|
||||||
const char *kmstest_connector_status_str(int type);
|
const char *kmstest_connector_status_str(int type);
|
||||||
const char *kmstest_connector_type_str(int type);
|
const char *kmstest_connector_type_str(int type);
|
||||||
|
void kmstest_set_connector_dpms(int fd, drmModeConnector *connector, int mode);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A small modeset API
|
* A small modeset API
|
||||||
|
@ -298,34 +298,6 @@ 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 void set_connector_dpms(drmModeConnector *connector, int mode)
|
|
||||||
{
|
|
||||||
int i, dpms = 0;
|
|
||||||
bool found_it = false;
|
|
||||||
|
|
||||||
for (i = 0; i < connector->count_props; i++) {
|
|
||||||
struct drm_mode_get_property prop;
|
|
||||||
|
|
||||||
prop.prop_id = connector->props[i];
|
|
||||||
prop.count_values = 0;
|
|
||||||
prop.count_enum_blobs = 0;
|
|
||||||
if (drmIoctl(drm_fd, DRM_IOCTL_MODE_GETPROPERTY, &prop))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (strcmp(prop.name, "DPMS"))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
dpms = prop.prop_id;
|
|
||||||
found_it = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
igt_assert_f(found_it, "DPMS property not found on %d\n",
|
|
||||||
connector->connector_id);
|
|
||||||
|
|
||||||
igt_assert(drmModeConnectorSetProperty(drm_fd, connector->connector_id,
|
|
||||||
dpms, mode) == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dpms_off_other_outputs(struct test_output *o)
|
static void dpms_off_other_outputs(struct test_output *o)
|
||||||
{
|
{
|
||||||
int i, n;
|
int i, n;
|
||||||
@ -342,8 +314,8 @@ static void dpms_off_other_outputs(struct test_output *o)
|
|||||||
|
|
||||||
connector = drmModeGetConnector(drm_fd, connector_id);
|
connector = drmModeGetConnector(drm_fd, connector_id);
|
||||||
|
|
||||||
set_connector_dpms(connector, DRM_MODE_DPMS_ON);
|
kmstest_set_connector_dpms(drm_fd, connector, DRM_MODE_DPMS_ON);
|
||||||
set_connector_dpms(connector, DRM_MODE_DPMS_OFF);
|
kmstest_set_connector_dpms(drm_fd, connector, DRM_MODE_DPMS_OFF);
|
||||||
|
|
||||||
drmModeFreeConnector(connector);
|
drmModeFreeConnector(connector);
|
||||||
next:
|
next:
|
||||||
@ -354,7 +326,7 @@ next:
|
|||||||
static void set_dpms(struct test_output *o, int mode)
|
static void set_dpms(struct test_output *o, int mode)
|
||||||
{
|
{
|
||||||
for (int n = 0; n < o->count; n++)
|
for (int n = 0; n < o->count; n++)
|
||||||
set_connector_dpms(o->kconnector[n], mode);
|
kmstest_set_connector_dpms(drm_fd, o->kconnector[n], mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_flag(unsigned int *v, unsigned int flag)
|
static void set_flag(unsigned int *v, unsigned int flag)
|
||||||
@ -1486,7 +1458,7 @@ static void kms_flip_exit_handler(int sig)
|
|||||||
{
|
{
|
||||||
igt_fixture {
|
igt_fixture {
|
||||||
if (last_connector)
|
if (last_connector)
|
||||||
set_connector_dpms(last_connector, DRM_MODE_DPMS_ON);
|
kmstest_set_connector_dpms(drm_fd, last_connector, DRM_MODE_DPMS_ON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,34 +346,6 @@ static void set_single(void)
|
|||||||
perror("Could not set signal handler");
|
perror("Could not set signal handler");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_connector_dpms(drmModeConnector *connector, int mode)
|
|
||||||
{
|
|
||||||
int i, dpms = 0;
|
|
||||||
bool found_it = false;
|
|
||||||
|
|
||||||
for (i = 0; i < connector->count_props; i++) {
|
|
||||||
struct drm_mode_get_property prop;
|
|
||||||
|
|
||||||
prop.prop_id = connector->props[i];
|
|
||||||
prop.count_values = 0;
|
|
||||||
prop.count_enum_blobs = 0;
|
|
||||||
if (drmIoctl(drm_fd, DRM_IOCTL_MODE_GETPROPERTY, &prop))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (strcmp(prop.name, "DPMS"))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
dpms = prop.prop_id;
|
|
||||||
found_it = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
igt_assert_f(found_it, "DPMS property not found on %d\n",
|
|
||||||
connector->connector_id);
|
|
||||||
|
|
||||||
igt_assert(drmModeConnectorSetProperty(drm_fd, connector->connector_id,
|
|
||||||
dpms, mode) == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_mode(struct connector *c)
|
set_mode(struct connector *c)
|
||||||
{
|
{
|
||||||
@ -430,9 +402,9 @@ set_mode(struct connector *c)
|
|||||||
sleep(sleep_between_modes);
|
sleep(sleep_between_modes);
|
||||||
|
|
||||||
if (do_dpms) {
|
if (do_dpms) {
|
||||||
set_connector_dpms(c->connector, do_dpms);
|
kmstest_set_connector_dpms(drm_fd, c->connector, do_dpms);
|
||||||
sleep(sleep_between_modes);
|
sleep(sleep_between_modes);
|
||||||
set_connector_dpms(c->connector, DRM_MODE_DPMS_ON);
|
kmstest_set_connector_dpms(drm_fd, c->connector, DRM_MODE_DPMS_ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qr_code){
|
if (qr_code){
|
||||||
@ -608,9 +580,9 @@ set_stereo_mode(struct connector *c)
|
|||||||
sleep(sleep_between_modes);
|
sleep(sleep_between_modes);
|
||||||
|
|
||||||
if (do_dpms) {
|
if (do_dpms) {
|
||||||
set_connector_dpms(c->connector, DRM_MODE_DPMS_OFF);
|
kmstest_set_connector_dpms(drm_fd, c->connector, DRM_MODE_DPMS_OFF);
|
||||||
sleep(sleep_between_modes);
|
sleep(sleep_between_modes);
|
||||||
set_connector_dpms(c->connector, DRM_MODE_DPMS_ON);
|
kmstest_set_connector_dpms(drm_fd, c->connector, DRM_MODE_DPMS_ON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user