mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-19 05:46:25 +00:00
igt_kms: Factor out a generic get_property() out of get_drm_plane_type()
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
This commit is contained in:
parent
bebcb582fc
commit
33842d5940
@ -599,6 +599,40 @@ static void igt_output_refresh(igt_output_t *output)
|
|||||||
display->pipes_in_use |= 1 << output->config.pipe;
|
display->pipes_in_use |= 1 << output->config.pipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
get_property(igt_display_t *display,
|
||||||
|
uint32_t object_id, uint32_t object_type, const char *name,
|
||||||
|
uint32_t *prop_id /* out */, uint64_t *value /* out */)
|
||||||
|
{
|
||||||
|
drmModeObjectPropertiesPtr proplist;
|
||||||
|
drmModePropertyPtr prop = NULL;
|
||||||
|
bool found = false;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
proplist = drmModeObjectGetProperties(display->drm_fd,
|
||||||
|
object_id, object_type);
|
||||||
|
for (i = 0; i < proplist->count_props; i++) {
|
||||||
|
drmModeFreeProperty(prop);
|
||||||
|
prop = drmModeGetProperty(display->drm_fd, proplist->props[i]);
|
||||||
|
if (!prop)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (strcmp(prop->name, name) == 0) {
|
||||||
|
found = true;
|
||||||
|
if (prop_id)
|
||||||
|
*prop_id = proplist->props[i];
|
||||||
|
if (value)
|
||||||
|
*value = proplist->prop_values[i];
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
drmModeFreeProperty(prop);
|
||||||
|
drmModeFreeObjectProperties(proplist);
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Walk a plane's property list to determine its type. If we don't
|
* Walk a plane's property list to determine its type. If we don't
|
||||||
* find a type property, then the kernel doesn't support universal
|
* find a type property, then the kernel doesn't support universal
|
||||||
@ -606,30 +640,15 @@ static void igt_output_refresh(igt_output_t *output)
|
|||||||
*/
|
*/
|
||||||
static int get_drm_plane_type(igt_display_t *display, uint32_t plane_id)
|
static int get_drm_plane_type(igt_display_t *display, uint32_t plane_id)
|
||||||
{
|
{
|
||||||
drmModeObjectPropertiesPtr proplist;
|
uint64_t value;
|
||||||
drmModePropertyPtr prop = NULL;
|
bool has_prop;
|
||||||
int type = DRM_PLANE_TYPE_OVERLAY;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
proplist = drmModeObjectGetProperties(display->drm_fd,
|
has_prop = get_property(display, plane_id, DRM_MODE_OBJECT_PLANE,
|
||||||
plane_id,
|
"type", NULL /* prop_id */, &value);
|
||||||
DRM_MODE_OBJECT_PLANE);
|
if (has_prop)
|
||||||
for (i = 0; i < proplist->count_props; i++) {
|
return (int)value;
|
||||||
drmModeFreeProperty(prop);
|
|
||||||
prop = drmModeGetProperty(display->drm_fd, proplist->props[i]);
|
|
||||||
if (!prop)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (strcmp(prop->name, "type") == 0) {
|
return DRM_PLANE_TYPE_OVERLAY;
|
||||||
type = proplist->prop_values[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
drmModeFreeProperty(prop);
|
|
||||||
drmModeFreeObjectProperties(proplist);
|
|
||||||
|
|
||||||
return type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void igt_display_init(igt_display_t *display, int drm_fd)
|
void igt_display_init(igt_display_t *display, int drm_fd)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user