Commit 425a8b82 authored by Daniel Vetter's avatar Daniel Vetter Committed by Greg Kroah-Hartman

drm/atomic: Wire file_priv through for property changes

commit 36e4523a upstream.

We need this to make sure lessees can only connect their
plane/connectors to crtc objects they own. And note that this is
irrespective of whether the lessor is atomic or not, lessor cannot
prevent lessees from enabling atomic.

Cc: stable@vger.kernel.org
Cc: Keith Packard <keithp@keithp.com>
Reviewed-by: default avatarDave Airlie <airlied@redhat.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190228144910.26488-7-daniel.vetter@ffwll.chSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 86d64820
...@@ -512,8 +512,8 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc, ...@@ -512,8 +512,8 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc,
} }
static int drm_atomic_plane_set_property(struct drm_plane *plane, static int drm_atomic_plane_set_property(struct drm_plane *plane,
struct drm_plane_state *state, struct drm_property *property, struct drm_plane_state *state, struct drm_file *file_priv,
uint64_t val) struct drm_property *property, uint64_t val)
{ {
struct drm_device *dev = plane->dev; struct drm_device *dev = plane->dev;
struct drm_mode_config *config = &dev->mode_config; struct drm_mode_config *config = &dev->mode_config;
...@@ -521,7 +521,8 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, ...@@ -521,7 +521,8 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
int ret; int ret;
if (property == config->prop_fb_id) { if (property == config->prop_fb_id) {
struct drm_framebuffer *fb = drm_framebuffer_lookup(dev, NULL, val); struct drm_framebuffer *fb;
fb = drm_framebuffer_lookup(dev, file_priv, val);
drm_atomic_set_fb_for_plane(state, fb); drm_atomic_set_fb_for_plane(state, fb);
if (fb) if (fb)
drm_framebuffer_put(fb); drm_framebuffer_put(fb);
...@@ -537,7 +538,7 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, ...@@ -537,7 +538,7 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
return -EINVAL; return -EINVAL;
} else if (property == config->prop_crtc_id) { } else if (property == config->prop_crtc_id) {
struct drm_crtc *crtc = drm_crtc_find(dev, NULL, val); struct drm_crtc *crtc = drm_crtc_find(dev, file_priv, val);
return drm_atomic_set_crtc_for_plane(state, crtc); return drm_atomic_set_crtc_for_plane(state, crtc);
} else if (property == config->prop_crtc_x) { } else if (property == config->prop_crtc_x) {
state->crtc_x = U642I64(val); state->crtc_x = U642I64(val);
...@@ -681,14 +682,14 @@ static int drm_atomic_set_writeback_fb_for_connector( ...@@ -681,14 +682,14 @@ static int drm_atomic_set_writeback_fb_for_connector(
} }
static int drm_atomic_connector_set_property(struct drm_connector *connector, static int drm_atomic_connector_set_property(struct drm_connector *connector,
struct drm_connector_state *state, struct drm_property *property, struct drm_connector_state *state, struct drm_file *file_priv,
uint64_t val) struct drm_property *property, uint64_t val)
{ {
struct drm_device *dev = connector->dev; struct drm_device *dev = connector->dev;
struct drm_mode_config *config = &dev->mode_config; struct drm_mode_config *config = &dev->mode_config;
if (property == config->prop_crtc_id) { if (property == config->prop_crtc_id) {
struct drm_crtc *crtc = drm_crtc_find(dev, NULL, val); struct drm_crtc *crtc = drm_crtc_find(dev, file_priv, val);
return drm_atomic_set_crtc_for_connector(state, crtc); return drm_atomic_set_crtc_for_connector(state, crtc);
} else if (property == config->dpms_property) { } else if (property == config->dpms_property) {
/* setting DPMS property requires special handling, which /* setting DPMS property requires special handling, which
...@@ -747,8 +748,10 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector, ...@@ -747,8 +748,10 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
} }
state->content_protection = val; state->content_protection = val;
} else if (property == config->writeback_fb_id_property) { } else if (property == config->writeback_fb_id_property) {
struct drm_framebuffer *fb = drm_framebuffer_lookup(dev, NULL, val); struct drm_framebuffer *fb;
int ret = drm_atomic_set_writeback_fb_for_connector(state, fb); int ret;
fb = drm_framebuffer_lookup(dev, file_priv, val);
ret = drm_atomic_set_writeback_fb_for_connector(state, fb);
if (fb) if (fb)
drm_framebuffer_put(fb); drm_framebuffer_put(fb);
return ret; return ret;
...@@ -943,6 +946,7 @@ int drm_atomic_connector_commit_dpms(struct drm_atomic_state *state, ...@@ -943,6 +946,7 @@ int drm_atomic_connector_commit_dpms(struct drm_atomic_state *state,
} }
int drm_atomic_set_property(struct drm_atomic_state *state, int drm_atomic_set_property(struct drm_atomic_state *state,
struct drm_file *file_priv,
struct drm_mode_object *obj, struct drm_mode_object *obj,
struct drm_property *prop, struct drm_property *prop,
uint64_t prop_value) uint64_t prop_value)
...@@ -965,7 +969,8 @@ int drm_atomic_set_property(struct drm_atomic_state *state, ...@@ -965,7 +969,8 @@ int drm_atomic_set_property(struct drm_atomic_state *state,
} }
ret = drm_atomic_connector_set_property(connector, ret = drm_atomic_connector_set_property(connector,
connector_state, prop, prop_value); connector_state, file_priv,
prop, prop_value);
break; break;
} }
case DRM_MODE_OBJECT_CRTC: { case DRM_MODE_OBJECT_CRTC: {
...@@ -993,7 +998,8 @@ int drm_atomic_set_property(struct drm_atomic_state *state, ...@@ -993,7 +998,8 @@ int drm_atomic_set_property(struct drm_atomic_state *state,
} }
ret = drm_atomic_plane_set_property(plane, ret = drm_atomic_plane_set_property(plane,
plane_state, prop, prop_value); plane_state, file_priv,
prop, prop_value);
break; break;
} }
default: default:
...@@ -1365,8 +1371,8 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, ...@@ -1365,8 +1371,8 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
goto out; goto out;
} }
ret = drm_atomic_set_property(state, obj, prop, ret = drm_atomic_set_property(state, file_priv,
prop_value); obj, prop, prop_value);
if (ret) { if (ret) {
drm_mode_object_put(obj); drm_mode_object_put(obj);
goto out; goto out;
......
...@@ -214,6 +214,7 @@ int drm_atomic_connector_commit_dpms(struct drm_atomic_state *state, ...@@ -214,6 +214,7 @@ int drm_atomic_connector_commit_dpms(struct drm_atomic_state *state,
struct drm_connector *connector, struct drm_connector *connector,
int mode); int mode);
int drm_atomic_set_property(struct drm_atomic_state *state, int drm_atomic_set_property(struct drm_atomic_state *state,
struct drm_file *file_priv,
struct drm_mode_object *obj, struct drm_mode_object *obj,
struct drm_property *prop, struct drm_property *prop,
uint64_t prop_value); uint64_t prop_value);
......
...@@ -451,6 +451,7 @@ static int set_property_legacy(struct drm_mode_object *obj, ...@@ -451,6 +451,7 @@ static int set_property_legacy(struct drm_mode_object *obj,
} }
static int set_property_atomic(struct drm_mode_object *obj, static int set_property_atomic(struct drm_mode_object *obj,
struct drm_file *file_priv,
struct drm_property *prop, struct drm_property *prop,
uint64_t prop_value) uint64_t prop_value)
{ {
...@@ -477,7 +478,7 @@ static int set_property_atomic(struct drm_mode_object *obj, ...@@ -477,7 +478,7 @@ static int set_property_atomic(struct drm_mode_object *obj,
obj_to_connector(obj), obj_to_connector(obj),
prop_value); prop_value);
} else { } else {
ret = drm_atomic_set_property(state, obj, prop, prop_value); ret = drm_atomic_set_property(state, file_priv, obj, prop, prop_value);
if (ret) if (ret)
goto out; goto out;
ret = drm_atomic_commit(state); ret = drm_atomic_commit(state);
...@@ -520,7 +521,7 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data, ...@@ -520,7 +521,7 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
goto out_unref; goto out_unref;
if (drm_drv_uses_atomic_modeset(property->dev)) if (drm_drv_uses_atomic_modeset(property->dev))
ret = set_property_atomic(arg_obj, property, arg->value); ret = set_property_atomic(arg_obj, file_priv, property, arg->value);
else else
ret = set_property_legacy(arg_obj, property, arg->value); ret = set_property_legacy(arg_obj, property, arg->value);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment