return TDM_ERROR_NONE;
}
-static int _tdm_vc4_display_get_properties(int drm_fd, uint32_t connector_id, uint32_t crtc_id,
+static tdm_error
+_tdm_vc4_display_get_properties(int drm_fd, uint32_t connector_id, uint32_t crtc_id,
uint32_t plane_id, struct display_properties_ids *ids)
{
drmModeObjectPropertiesPtr properties = NULL;
return ret;
}
-static int _tdm_vc4_display_get_plane_id(int drm_fd, uint32_t crtc_id)
+static tdm_error
+_tdm_vc4_display_get_plane_id(int drm_fd, uint32_t crtc_id, uint32_t *id)
{
drmModeResPtr ressources = NULL;
drmModePlaneResPtr plane_resources;
uint32_t plane_id = 0;
uint32_t found_primary = 0;
int i, j;
+ tdm_error ret = TDM_ERROR_NONE;
+
+ if (id) *id = 0;
ressources = drmModeGetResources(drm_fd);
if (ressources == NULL) {
+ ret = TDM_ERROR_OPERATION_FAILED;
goto finish;
}
}
if (i == ressources->count_crtcs) {
+ ret = TDM_ERROR_OPERATION_FAILED;
goto free_resource;
}
plane_resources = drmModeGetPlaneResources(drm_fd);
if (!plane_resources) {
+ ret = TDM_ERROR_OPERATION_FAILED;
goto free_resource;
}
if (plane->possible_crtcs & (1 << crtc_index)) {
drmModeObjectPropertiesPtr props =
drmModeObjectGetProperties(drm_fd, plane_id, DRM_MODE_OBJECT_PLANE);
+ if (!props) {
+ ret = TDM_ERROR_OPERATION_FAILED;
+ goto free_resource;
+ }
for (j = 0; j < props->count_props; j++) {
drmModePropertyPtr p = drmModeGetProperty(drm_fd, props->props[j]);
+ if (!p)
+ continue;
+
if ((strcmp(p->name, "type") == 0) &&
(props->prop_values[j] == DRM_PLANE_TYPE_PRIMARY)) {
found_primary = 1;
drmModeFreePlane(plane);
}
+ if (found_primary) {
+ if (id)
+ *id = plane_id;
+ } else {
+ ret = TDM_ERROR_OPERATION_FAILED;
+ }
+
drmModeFreePlaneResources(plane_resources);
free_resource:
drmModeFreeResources(ressources);
finish:
- return plane_id;
+ return ret;
}
static tdm_error
uint32_t fx, fy, fw, fh;
drmModeAtomicReqPtr request;
uint32_t flags = 0;
+ tdm_error ret = TDM_ERROR_NONE;
if (!layer_data->display_buffer_changed && !layer_data->info_changed)
return TDM_ERROR_NONE;
drmSetClientCap(vc4_data->drm_fd, DRM_CLIENT_CAP_ATOMIC, 1);
drmSetClientCap(vc4_data->drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
- output_data->output_plane = _tdm_vc4_display_get_plane_id(vc4_data->drm_fd, output_data->crtc_id);
+ ret = _tdm_vc4_display_get_plane_id(vc4_data->drm_fd, output_data->crtc_id, &output_data->output_plane);
+ if (ret != TDM_ERROR_NONE) return ret;
- _tdm_vc4_display_get_properties(vc4_data->drm_fd, output_data->connector_id,
+ ret = _tdm_vc4_display_get_properties(vc4_data->drm_fd, output_data->connector_id,
output_data->crtc_id, output_data->output_plane, &output_data->props);
+ if (ret != TDM_ERROR_NONE) return ret;
output_data->crtc_enabled = 1;
}