mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-20 14:26:17 +00:00
tests/pm_rpm: find an appropriate CRTC instead of hardcoding CRTC 0
BSW does not allow CRTC 0 to be used on every connector, so we need to write code to actually find a suitable CRTC. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93124 Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
This commit is contained in:
parent
84157ad1b4
commit
ec5deb218d
@ -224,12 +224,33 @@ static void disable_or_dpms_all_screens(struct mode_set_data *data, bool dpms)
|
|||||||
igt_assert(wait_for_suspended()); \
|
igt_assert(wait_for_suspended()); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
static uint32_t find_crtc_for_connector(drmModeResPtr res,
|
||||||
|
drmModeConnectorPtr connector)
|
||||||
|
{
|
||||||
|
drmModeEncoderPtr e;
|
||||||
|
uint32_t crtc_id = 0;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
for (i = 0; i < connector->count_encoders && !crtc_id; i++) {
|
||||||
|
e = drmModeGetEncoder(drm_fd, connector->encoders[i]);
|
||||||
|
|
||||||
|
for (j = 0; (e->possible_crtcs >> j) && !crtc_id; j++)
|
||||||
|
if (e->possible_crtcs & (1 << j))
|
||||||
|
crtc_id = res->crtcs[j];
|
||||||
|
|
||||||
|
drmModeFreeEncoder(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
igt_assert(crtc_id);
|
||||||
|
return crtc_id;
|
||||||
|
}
|
||||||
|
|
||||||
static bool init_modeset_params_for_type(struct mode_set_data *data,
|
static bool init_modeset_params_for_type(struct mode_set_data *data,
|
||||||
struct modeset_params *params,
|
struct modeset_params *params,
|
||||||
enum screen_type type)
|
enum screen_type type)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
uint32_t connector_id = 0;
|
drmModeConnectorPtr connector = NULL;
|
||||||
drmModeModeInfoPtr mode = NULL;
|
drmModeModeInfoPtr mode = NULL;
|
||||||
|
|
||||||
for (i = 0; i < data->res->count_connectors; i++) {
|
for (i = 0; i < data->res->count_connectors; i++) {
|
||||||
@ -244,21 +265,21 @@ static bool init_modeset_params_for_type(struct mode_set_data *data,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (c->connection == DRM_MODE_CONNECTED && c->count_modes) {
|
if (c->connection == DRM_MODE_CONNECTED && c->count_modes) {
|
||||||
connector_id = c->connector_id;
|
connector = c;
|
||||||
mode = &c->modes[0];
|
mode = &c->modes[0];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!connector_id)
|
if (!connector)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
igt_create_pattern_fb(drm_fd, mode->hdisplay, mode->vdisplay,
|
igt_create_pattern_fb(drm_fd, mode->hdisplay, mode->vdisplay,
|
||||||
DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
|
DRM_FORMAT_XRGB8888, LOCAL_DRM_FORMAT_MOD_NONE,
|
||||||
¶ms->fb);
|
¶ms->fb);
|
||||||
|
|
||||||
params->crtc_id = data->res->crtcs[0];
|
params->crtc_id = find_crtc_for_connector(data->res, connector);
|
||||||
params->connector_id = connector_id;
|
params->connector_id = connector->connector_id;
|
||||||
params->mode = mode;
|
params->mode = mode;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1599,7 +1620,6 @@ static void test_one_plane(bool dpms, uint32_t plane_id,
|
|||||||
|
|
||||||
disable_all_screens_and_wait(&ms_data);
|
disable_all_screens_and_wait(&ms_data);
|
||||||
|
|
||||||
igt_require(default_mode_params);
|
|
||||||
crtc_id = default_mode_params->crtc_id;
|
crtc_id = default_mode_params->crtc_id;
|
||||||
|
|
||||||
switch (plane_type) {
|
switch (plane_type) {
|
||||||
@ -1681,12 +1701,26 @@ static void test_one_plane(bool dpms, uint32_t plane_id,
|
|||||||
igt_assert(wait_for_suspended());
|
igt_assert(wait_for_suspended());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int get_crtc_idx(drmModeResPtr res, uint32_t crtc_id)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < res->count_crtcs; i++)
|
||||||
|
if (res->crtcs[i] == crtc_id)
|
||||||
|
return i;
|
||||||
|
|
||||||
|
igt_assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
/* This one also triggered WARNs on our driver at some point in time. */
|
/* This one also triggered WARNs on our driver at some point in time. */
|
||||||
static void planes_subtest(bool universal, bool dpms)
|
static void planes_subtest(bool universal, bool dpms)
|
||||||
{
|
{
|
||||||
int i, rc, planes_tested = 0;
|
int i, rc, planes_tested = 0, crtc_idx;
|
||||||
drmModePlaneResPtr planes;
|
drmModePlaneResPtr planes;
|
||||||
|
|
||||||
|
igt_require(default_mode_params);
|
||||||
|
crtc_idx = get_crtc_idx(ms_data.res, default_mode_params->crtc_id);
|
||||||
|
|
||||||
if (universal) {
|
if (universal) {
|
||||||
rc = drmSetClientCap(drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES,
|
rc = drmSetClientCap(drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES,
|
||||||
1);
|
1);
|
||||||
@ -1700,9 +1734,7 @@ static void planes_subtest(bool universal, bool dpms)
|
|||||||
plane = drmModeGetPlane(drm_fd, planes->planes[i]);
|
plane = drmModeGetPlane(drm_fd, planes->planes[i]);
|
||||||
igt_assert(plane);
|
igt_assert(plane);
|
||||||
|
|
||||||
/* We just pick the first CRTC on the list, so we can test for
|
if (plane->possible_crtcs & (1 << crtc_idx)) {
|
||||||
* 0x1 as the index. */
|
|
||||||
if (plane->possible_crtcs & 0x1) {
|
|
||||||
enum plane_type type;
|
enum plane_type type;
|
||||||
|
|
||||||
type = universal ? get_plane_type(plane->plane_id) :
|
type = universal ? get_plane_type(plane->plane_id) :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user