mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-28 07:04:00 +08:00
drm/omap: fix crtc->plane property delegation
Before universal planes we had to have plane specific properties for the crtc too, as on the hardware level a crtc uses a plane. In other words, e.g. 'zorder' property was added to both planes and crtcs, and omap_crtc.c would delegate the property set/get to the primary plane. However, the delegation was a bit too generic, delegating all property set/get calls to planes. Thus it's possible to set, say, FB_ID, on a crtc, which gets redirected to the primary plane. This is not standard, and shouldn't be allowed. To keep backward compatibility, we still need to redirect the properties we supported earlier for crtcs, namely 'zorder' and 'rotation'. This patch redirects only the allowed properties from crtcs to planes. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
e1d4ee0f2b
commit
6bdad6cf98
@ -423,24 +423,40 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool omap_crtc_is_plane_prop(struct drm_device *dev,
|
||||||
|
struct drm_property *property)
|
||||||
|
{
|
||||||
|
struct omap_drm_private *priv = dev->dev_private;
|
||||||
|
|
||||||
|
return property == priv->zorder_prop ||
|
||||||
|
property == dev->mode_config.rotation_property;
|
||||||
|
}
|
||||||
|
|
||||||
static int omap_crtc_atomic_set_property(struct drm_crtc *crtc,
|
static int omap_crtc_atomic_set_property(struct drm_crtc *crtc,
|
||||||
struct drm_crtc_state *state,
|
struct drm_crtc_state *state,
|
||||||
struct drm_property *property,
|
struct drm_property *property,
|
||||||
uint64_t val)
|
uint64_t val)
|
||||||
{
|
{
|
||||||
struct drm_plane_state *plane_state;
|
struct drm_device *dev = crtc->dev;
|
||||||
struct drm_plane *plane = crtc->primary;
|
|
||||||
|
|
||||||
/*
|
if (omap_crtc_is_plane_prop(dev, property)) {
|
||||||
* Delegate property set to the primary plane. Get the plane state and
|
struct drm_plane_state *plane_state;
|
||||||
* set the property directly.
|
struct drm_plane *plane = crtc->primary;
|
||||||
*/
|
|
||||||
|
|
||||||
plane_state = drm_atomic_get_plane_state(state->state, plane);
|
/*
|
||||||
if (IS_ERR(plane_state))
|
* Delegate property set to the primary plane. Get the plane
|
||||||
return PTR_ERR(plane_state);
|
* state and set the property directly.
|
||||||
|
*/
|
||||||
|
|
||||||
return drm_atomic_plane_set_property(plane, plane_state, property, val);
|
plane_state = drm_atomic_get_plane_state(state->state, plane);
|
||||||
|
if (IS_ERR(plane_state))
|
||||||
|
return PTR_ERR(plane_state);
|
||||||
|
|
||||||
|
return drm_atomic_plane_set_property(plane, plane_state,
|
||||||
|
property, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int omap_crtc_atomic_get_property(struct drm_crtc *crtc,
|
static int omap_crtc_atomic_get_property(struct drm_crtc *crtc,
|
||||||
@ -448,14 +464,20 @@ static int omap_crtc_atomic_get_property(struct drm_crtc *crtc,
|
|||||||
struct drm_property *property,
|
struct drm_property *property,
|
||||||
uint64_t *val)
|
uint64_t *val)
|
||||||
{
|
{
|
||||||
/*
|
struct drm_device *dev = crtc->dev;
|
||||||
* Delegate property get to the primary plane. The
|
|
||||||
* drm_atomic_plane_get_property() function isn't exported, but can be
|
if (omap_crtc_is_plane_prop(dev, property)) {
|
||||||
* called through drm_object_property_get_value() as that will call
|
/*
|
||||||
* drm_atomic_get_property() for atomic drivers.
|
* Delegate property get to the primary plane. The
|
||||||
*/
|
* drm_atomic_plane_get_property() function isn't exported, but
|
||||||
return drm_object_property_get_value(&crtc->primary->base, property,
|
* can be called through drm_object_property_get_value() as that
|
||||||
val);
|
* will call drm_atomic_get_property() for atomic drivers.
|
||||||
|
*/
|
||||||
|
return drm_object_property_get_value(&crtc->primary->base,
|
||||||
|
property, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct drm_crtc_funcs omap_crtc_funcs = {
|
static const struct drm_crtc_funcs omap_crtc_funcs = {
|
||||||
|
Loading…
Reference in New Issue
Block a user