mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2026-08-12 00:43:04 +00:00
lib/igt_kms: add kmstest_get_crtc_idx
Move it from pm_rpm.c to lib/igt_kms and remove the hardcoded version from kms_frontbuffer_tracking. I'm also planning to add other callers. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
This commit is contained in:
@@ -875,6 +875,24 @@ void kmstest_unset_all_crtcs(int drm_fd, drmModeResPtr resources)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* kmstest_get_crtc_idx: get the CRTC index based on its ID
|
||||
* @res: the libdrm resources
|
||||
* @crtc_id: the CRTC id
|
||||
*
|
||||
* This is useful since a few places of libdrm deal with CRTC masks.
|
||||
*/
|
||||
int kmstest_get_crtc_idx(drmModeRes *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);
|
||||
}
|
||||
|
||||
/*
|
||||
* A small modeset API
|
||||
*/
|
||||
|
||||
@@ -150,6 +150,7 @@ bool kmstest_get_property(int drm_fd, uint32_t object_id, uint32_t object_type,
|
||||
const char *name, uint32_t *prop_id, uint64_t *value,
|
||||
drmModePropertyPtr *prop);
|
||||
void kmstest_unset_all_crtcs(int drm_fd, drmModeResPtr resources);
|
||||
int kmstest_get_crtc_idx(drmModeRes *res, uint32_t crtc_id);
|
||||
|
||||
/*
|
||||
* A small modeset API
|
||||
|
||||
Reference in New Issue
Block a user