/** * drm_atomic_plane_set_property - set property on plane * @plane: the drm plane to set a property on * @state: the state object to update with the new property value * @property: the property to set * @val: the new property value * * Use this instead of calling plane->atomic_set_property directly. * This function handles generic/core properties and calls out to * driver's ->atomic_set_property() for driver properties. To ensure * consistent behavior you must call this function rather than the * driver hook directly. * * RETURNS: * Zero on success, error code on failure */ int drm_atomic_plane_set_property(struct drm_plane *plane, struct drm_plane_state *state, struct drm_property *property, uint64_t val) { struct drm_device *dev = plane->dev; struct drm_mode_config *config = &dev->mode_config; if (property == config->prop_fb_id) { struct drm_framebuffer *fb = drm_framebuffer_lookup(dev, val); drm_atomic_set_fb_for_plane(state, fb); if (fb) drm_framebuffer_unreference(fb); } else if (property == config->prop_crtc_id) { struct drm_crtc *crtc = drm_crtc_find(dev, val); return drm_atomic_set_crtc_for_plane(state, crtc); } else if (property == config->prop_crtc_x) { state->crtc_x = U642I64(val); } else if (property == config->prop_crtc_y) { state->crtc_y = U642I64(val); } else if (property == config->prop_crtc_w) { state->crtc_w = val; } else if (property == config->prop_crtc_h) { state->crtc_h = val; } else if (property == config->prop_src_x) { state->src_x = val; } else if (property == config->prop_src_y) { state->src_y = val; } else if (property == config->prop_src_w) { state->src_w = val; } else if (property == config->prop_src_h) { state->src_h = val; } else if (property == config->rotation_property) { state->rotation = val; } else if (plane->funcs->atomic_set_property) { return plane->funcs->atomic_set_property(plane, state, property, val); } else { return -EINVAL; } return 0; }
static void dump_prop(uint32_t prop_id, uint64_t value) { int i; drmModePropertyPtr prop; prop = drmModeGetProperty(fd, prop_id); printf("\t%d", prop_id); if (!prop) { printf("\n"); return; } printf(" %s:\n", prop->name); printf("\t\tflags:"); if (prop->flags & DRM_MODE_PROP_PENDING) printf(" pending"); if (prop->flags & DRM_MODE_PROP_IMMUTABLE) printf(" immutable"); if (drm_property_type_is(prop, DRM_MODE_PROP_SIGNED_RANGE)) printf(" signed range"); if (drm_property_type_is(prop, DRM_MODE_PROP_RANGE)) printf(" range"); if (drm_property_type_is(prop, DRM_MODE_PROP_ENUM)) printf(" enum"); if (drm_property_type_is(prop, DRM_MODE_PROP_BITMASK)) printf(" bitmask"); if (drm_property_type_is(prop, DRM_MODE_PROP_BLOB)) printf(" blob"); if (drm_property_type_is(prop, DRM_MODE_PROP_OBJECT)) printf(" object"); printf("\n"); if (drm_property_type_is(prop, DRM_MODE_PROP_SIGNED_RANGE)) { printf("\t\tvalues:"); for (i = 0; i < prop->count_values; i++) printf(" %"PRId64, U642I64(prop->values[i])); printf("\n"); } if (drm_property_type_is(prop, DRM_MODE_PROP_RANGE)) { printf("\t\tvalues:"); for (i = 0; i < prop->count_values; i++) printf(" %"PRIu64, prop->values[i]); printf("\n"); } if (drm_property_type_is(prop, DRM_MODE_PROP_ENUM)) { printf("\t\tenums:"); for (i = 0; i < prop->count_enums; i++) printf(" %s=%llu", prop->enums[i].name, prop->enums[i].value); printf("\n"); } else if (drm_property_type_is(prop, DRM_MODE_PROP_BITMASK)) { printf("\t\tvalues:"); for (i = 0; i < prop->count_enums; i++) printf(" %s=0x%llx", prop->enums[i].name, (1LL << prop->enums[i].value)); printf("\n"); } else { assert(prop->count_enums == 0); } if (drm_property_type_is(prop, DRM_MODE_PROP_BLOB)) { printf("\t\tblobs:\n"); for (i = 0; i < prop->count_blobs; i++) dump_blob(prop->blob_ids[i]); printf("\n"); } else { assert(prop->count_blobs == 0); } printf("\t\tvalue:"); if (drm_property_type_is(prop, DRM_MODE_PROP_BLOB)) dump_blob(value); else if (drm_property_type_is(prop, DRM_MODE_PROP_SIGNED_RANGE)) printf(" %"PRId64"\n", value); else printf(" %"PRIu64"\n", value); drmModeFreeProperty(prop); }