Beispiel #1
0
/* attach crtc properties */
static void xilinx_drm_crtc_attach_property(struct drm_crtc *base_crtc)
{
	struct xilinx_drm_crtc *crtc = to_xilinx_crtc(base_crtc);
	int num_planes;

	num_planes = xilinx_drm_plane_get_num_planes(crtc->plane_manager);
	if (num_planes <= 1)
		return;

	crtc->zpos_prop = drm_property_create_range(base_crtc->dev, 0, "zpos",
						    0, num_planes - 1);
	if (crtc->zpos_prop) {
		crtc->default_zpos =
			xilinx_drm_plane_get_default_zpos(crtc->priv_plane);
		drm_object_attach_property(&base_crtc->base, crtc->zpos_prop,
					   crtc->default_zpos);
		xilinx_drm_plane_set_zpos(crtc->priv_plane, crtc->default_zpos);
	}

	crtc->default_alpha = xilinx_drm_plane_get_max_alpha(crtc->priv_plane);
	crtc->alpha_prop = drm_property_create_range(base_crtc->dev, 0,
						      "alpha", 0,
						      crtc->default_alpha);
	if (crtc->alpha_prop) {
		drm_object_attach_property(&base_crtc->base, crtc->alpha_prop,
					   crtc->default_alpha);
		xilinx_drm_plane_set_alpha(crtc->priv_plane,
					   crtc->default_alpha);
	}
}
Beispiel #2
0
/* set property of a plane */
static int xilinx_drm_crtc_set_property(struct drm_crtc *base_crtc,
					struct drm_property *property,
					uint64_t val)
{
	struct xilinx_drm_crtc *crtc = to_xilinx_crtc(base_crtc);

	if (property == crtc->zpos_prop)
		xilinx_drm_plane_set_zpos(crtc->priv_plane, val);
	else if (property == crtc->alpha_prop)
		xilinx_drm_plane_set_alpha(crtc->priv_plane, val);
	else
		return -EINVAL;

	drm_object_property_set_value(&base_crtc->base, property, val);

	return 0;
}
/* set property of a plane */
static int xilinx_drm_plane_set_property(struct drm_plane *base_plane,
					 struct drm_property *property,
					 uint64_t val)
{
	struct xilinx_drm_plane *plane = to_xilinx_plane(base_plane);
	struct xilinx_drm_plane_manager *manager = plane->manager;

	if (property == manager->zpos_prop)
		xilinx_drm_plane_set_zpos(base_plane, val);
	else if (property == manager->alpha_prop)
		xilinx_drm_plane_set_alpha(base_plane, val);
	else
		return -EINVAL;

	drm_object_property_set_value(&base_plane->base, property, val);

	return 0;
}
Beispiel #4
0
/**
 * xilinx_drm_crtc_restore - Restore the crtc states
 * @base_crtc: base crtc object
 *
 * Restore the crtc states to the default ones. The request is propagated
 * to the plane driver.
 */
void xilinx_drm_crtc_restore(struct drm_crtc *base_crtc)
{
	struct xilinx_drm_crtc *crtc = to_xilinx_crtc(base_crtc);

	/*
	 * Reinitialize the property values, so correct values are read
	 * for these properties.
	 */
	if (crtc->zpos_prop) {
		xilinx_drm_plane_set_zpos(crtc->priv_plane, crtc->default_zpos);
		drm_object_property_set_value(&base_crtc->base, crtc->zpos_prop,
					      crtc->default_zpos);
	}

	if (crtc->alpha_prop) {
		xilinx_drm_plane_set_alpha(crtc->priv_plane,
					   crtc->default_alpha);
		drm_object_property_set_value(&base_crtc->base,
					      crtc->alpha_prop,
					      crtc->default_alpha);
	}

	xilinx_drm_plane_restore(crtc->plane_manager);
}