diff options
author | Keith Packard <keithp@keithp.com> | 2017-03-15 02:25:07 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2017-10-11 20:03:04 -0400 |
commit | 418da17214aca5ef5f0b6f7588905ee7df92f98f (patch) | |
tree | 8deaeb99bc4f16428c31355fb2e723515925cdc5 | |
parent | bb7a9c8d712f37385a706a594d6edf6e6d2669d0 (diff) |
drm: Pass struct drm_file * to __drm_mode_object_find [v2]
This will allow __drm_mode_object_file to be extended to perform
access control checks based on the file in use.
v2: Also fix up vboxvideo driver in staging
[airlied: merging early as this is an API change]
Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
37 files changed, 85 insertions, 73 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c index f51b41f094ef..df9cbc78e168 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | |||
@@ -231,7 +231,7 @@ amdgpu_connector_update_scratch_regs(struct drm_connector *connector, | |||
231 | if (connector->encoder_ids[i] == 0) | 231 | if (connector->encoder_ids[i] == 0) |
232 | break; | 232 | break; |
233 | 233 | ||
234 | encoder = drm_encoder_find(connector->dev, | 234 | encoder = drm_encoder_find(connector->dev, NULL, |
235 | connector->encoder_ids[i]); | 235 | connector->encoder_ids[i]); |
236 | if (!encoder) | 236 | if (!encoder) |
237 | continue; | 237 | continue; |
@@ -256,7 +256,7 @@ amdgpu_connector_find_encoder(struct drm_connector *connector, | |||
256 | for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { | 256 | for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { |
257 | if (connector->encoder_ids[i] == 0) | 257 | if (connector->encoder_ids[i] == 0) |
258 | break; | 258 | break; |
259 | encoder = drm_encoder_find(connector->dev, | 259 | encoder = drm_encoder_find(connector->dev, NULL, |
260 | connector->encoder_ids[i]); | 260 | connector->encoder_ids[i]); |
261 | if (!encoder) | 261 | if (!encoder) |
262 | continue; | 262 | continue; |
@@ -372,7 +372,7 @@ amdgpu_connector_best_single_encoder(struct drm_connector *connector) | |||
372 | 372 | ||
373 | /* pick the encoder ids */ | 373 | /* pick the encoder ids */ |
374 | if (enc_id) | 374 | if (enc_id) |
375 | return drm_encoder_find(connector->dev, enc_id); | 375 | return drm_encoder_find(connector->dev, NULL, enc_id); |
376 | return NULL; | 376 | return NULL; |
377 | } | 377 | } |
378 | 378 | ||
@@ -1077,7 +1077,7 @@ amdgpu_connector_dvi_detect(struct drm_connector *connector, bool force) | |||
1077 | if (connector->encoder_ids[i] == 0) | 1077 | if (connector->encoder_ids[i] == 0) |
1078 | break; | 1078 | break; |
1079 | 1079 | ||
1080 | encoder = drm_encoder_find(connector->dev, connector->encoder_ids[i]); | 1080 | encoder = drm_encoder_find(connector->dev, NULL, connector->encoder_ids[i]); |
1081 | if (!encoder) | 1081 | if (!encoder) |
1082 | continue; | 1082 | continue; |
1083 | 1083 | ||
@@ -1134,7 +1134,7 @@ amdgpu_connector_dvi_encoder(struct drm_connector *connector) | |||
1134 | if (connector->encoder_ids[i] == 0) | 1134 | if (connector->encoder_ids[i] == 0) |
1135 | break; | 1135 | break; |
1136 | 1136 | ||
1137 | encoder = drm_encoder_find(connector->dev, connector->encoder_ids[i]); | 1137 | encoder = drm_encoder_find(connector->dev, NULL, connector->encoder_ids[i]); |
1138 | if (!encoder) | 1138 | if (!encoder) |
1139 | continue; | 1139 | continue; |
1140 | 1140 | ||
@@ -1153,7 +1153,7 @@ amdgpu_connector_dvi_encoder(struct drm_connector *connector) | |||
1153 | /* then check use digitial */ | 1153 | /* then check use digitial */ |
1154 | /* pick the first one */ | 1154 | /* pick the first one */ |
1155 | if (enc_id) | 1155 | if (enc_id) |
1156 | return drm_encoder_find(connector->dev, enc_id); | 1156 | return drm_encoder_find(connector->dev, NULL, enc_id); |
1157 | return NULL; | 1157 | return NULL; |
1158 | } | 1158 | } |
1159 | 1159 | ||
@@ -1294,7 +1294,7 @@ u16 amdgpu_connector_encoder_get_dp_bridge_encoder_id(struct drm_connector *conn | |||
1294 | if (connector->encoder_ids[i] == 0) | 1294 | if (connector->encoder_ids[i] == 0) |
1295 | break; | 1295 | break; |
1296 | 1296 | ||
1297 | encoder = drm_encoder_find(connector->dev, | 1297 | encoder = drm_encoder_find(connector->dev, NULL, |
1298 | connector->encoder_ids[i]); | 1298 | connector->encoder_ids[i]); |
1299 | if (!encoder) | 1299 | if (!encoder) |
1300 | continue; | 1300 | continue; |
@@ -1323,7 +1323,7 @@ static bool amdgpu_connector_encoder_is_hbr2(struct drm_connector *connector) | |||
1323 | for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { | 1323 | for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { |
1324 | if (connector->encoder_ids[i] == 0) | 1324 | if (connector->encoder_ids[i] == 0) |
1325 | break; | 1325 | break; |
1326 | encoder = drm_encoder_find(connector->dev, | 1326 | encoder = drm_encoder_find(connector->dev, NULL, |
1327 | connector->encoder_ids[i]); | 1327 | connector->encoder_ids[i]); |
1328 | if (!encoder) | 1328 | if (!encoder) |
1329 | continue; | 1329 | continue; |
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c index b9ee9073cb0d..a8829af120c1 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c | |||
@@ -288,7 +288,7 @@ dce_virtual_encoder(struct drm_connector *connector) | |||
288 | if (connector->encoder_ids[i] == 0) | 288 | if (connector->encoder_ids[i] == 0) |
289 | break; | 289 | break; |
290 | 290 | ||
291 | encoder = drm_encoder_find(connector->dev, connector->encoder_ids[i]); | 291 | encoder = drm_encoder_find(connector->dev, NULL, connector->encoder_ids[i]); |
292 | if (!encoder) | 292 | if (!encoder) |
293 | continue; | 293 | continue; |
294 | 294 | ||
@@ -298,7 +298,7 @@ dce_virtual_encoder(struct drm_connector *connector) | |||
298 | 298 | ||
299 | /* pick the first one */ | 299 | /* pick the first one */ |
300 | if (enc_id) | 300 | if (enc_id) |
301 | return drm_encoder_find(connector->dev, enc_id); | 301 | return drm_encoder_find(connector->dev, NULL, enc_id); |
302 | return NULL; | 302 | return NULL; |
303 | } | 303 | } |
304 | 304 | ||
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index 6f3849ec0c1d..9555a3542022 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c | |||
@@ -713,7 +713,7 @@ static struct drm_encoder *ast_best_single_encoder(struct drm_connector *connect | |||
713 | int enc_id = connector->encoder_ids[0]; | 713 | int enc_id = connector->encoder_ids[0]; |
714 | /* pick the encoder ids */ | 714 | /* pick the encoder ids */ |
715 | if (enc_id) | 715 | if (enc_id) |
716 | return drm_encoder_find(connector->dev, enc_id); | 716 | return drm_encoder_find(connector->dev, NULL, enc_id); |
717 | return NULL; | 717 | return NULL; |
718 | } | 718 | } |
719 | 719 | ||
diff --git a/drivers/gpu/drm/bochs/bochs_kms.c b/drivers/gpu/drm/bochs/bochs_kms.c index 6a91e62da2f4..a24a18fbd65a 100644 --- a/drivers/gpu/drm/bochs/bochs_kms.c +++ b/drivers/gpu/drm/bochs/bochs_kms.c | |||
@@ -213,7 +213,7 @@ bochs_connector_best_encoder(struct drm_connector *connector) | |||
213 | int enc_id = connector->encoder_ids[0]; | 213 | int enc_id = connector->encoder_ids[0]; |
214 | /* pick the encoder ids */ | 214 | /* pick the encoder ids */ |
215 | if (enc_id) | 215 | if (enc_id) |
216 | return drm_encoder_find(connector->dev, enc_id); | 216 | return drm_encoder_find(connector->dev, NULL, enc_id); |
217 | return NULL; | 217 | return NULL; |
218 | } | 218 | } |
219 | 219 | ||
diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c index a4c4a465b385..cd23b1b28259 100644 --- a/drivers/gpu/drm/cirrus/cirrus_mode.c +++ b/drivers/gpu/drm/cirrus/cirrus_mode.c | |||
@@ -457,7 +457,7 @@ static struct drm_encoder *cirrus_connector_best_encoder(struct drm_connector | |||
457 | int enc_id = connector->encoder_ids[0]; | 457 | int enc_id = connector->encoder_ids[0]; |
458 | /* pick the encoder ids */ | 458 | /* pick the encoder ids */ |
459 | if (enc_id) | 459 | if (enc_id) |
460 | return drm_encoder_find(connector->dev, enc_id); | 460 | return drm_encoder_find(connector->dev, NULL, enc_id); |
461 | return NULL; | 461 | return NULL; |
462 | } | 462 | } |
463 | 463 | ||
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 366c56fe5f58..268969fecee7 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c | |||
@@ -718,7 +718,7 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, | |||
718 | struct drm_mode_config *config = &dev->mode_config; | 718 | struct drm_mode_config *config = &dev->mode_config; |
719 | 719 | ||
720 | if (property == config->prop_fb_id) { | 720 | if (property == config->prop_fb_id) { |
721 | struct drm_framebuffer *fb = drm_framebuffer_lookup(dev, val); | 721 | struct drm_framebuffer *fb = drm_framebuffer_lookup(dev, NULL, val); |
722 | drm_atomic_set_fb_for_plane(state, fb); | 722 | drm_atomic_set_fb_for_plane(state, fb); |
723 | if (fb) | 723 | if (fb) |
724 | drm_framebuffer_put(fb); | 724 | drm_framebuffer_put(fb); |
@@ -734,7 +734,7 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane, | |||
734 | return -EINVAL; | 734 | return -EINVAL; |
735 | 735 | ||
736 | } else if (property == config->prop_crtc_id) { | 736 | } else if (property == config->prop_crtc_id) { |
737 | struct drm_crtc *crtc = drm_crtc_find(dev, val); | 737 | struct drm_crtc *crtc = drm_crtc_find(dev, NULL, val); |
738 | return drm_atomic_set_crtc_for_plane(state, crtc); | 738 | return drm_atomic_set_crtc_for_plane(state, crtc); |
739 | } else if (property == config->prop_crtc_x) { | 739 | } else if (property == config->prop_crtc_x) { |
740 | state->crtc_x = U642I64(val); | 740 | state->crtc_x = U642I64(val); |
@@ -1149,7 +1149,7 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector, | |||
1149 | struct drm_mode_config *config = &dev->mode_config; | 1149 | struct drm_mode_config *config = &dev->mode_config; |
1150 | 1150 | ||
1151 | if (property == config->prop_crtc_id) { | 1151 | if (property == config->prop_crtc_id) { |
1152 | struct drm_crtc *crtc = drm_crtc_find(dev, val); | 1152 | struct drm_crtc *crtc = drm_crtc_find(dev, NULL, val); |
1153 | return drm_atomic_set_crtc_for_connector(state, crtc); | 1153 | return drm_atomic_set_crtc_for_connector(state, crtc); |
1154 | } else if (property == config->dpms_property) { | 1154 | } else if (property == config->dpms_property) { |
1155 | /* setting DPMS property requires special handling, which | 1155 | /* setting DPMS property requires special handling, which |
@@ -2259,7 +2259,7 @@ retry: | |||
2259 | goto out; | 2259 | goto out; |
2260 | } | 2260 | } |
2261 | 2261 | ||
2262 | obj = drm_mode_object_find(dev, obj_id, DRM_MODE_OBJECT_ANY); | 2262 | obj = drm_mode_object_find(dev, file_priv, obj_id, DRM_MODE_OBJECT_ANY); |
2263 | if (!obj) { | 2263 | if (!obj) { |
2264 | ret = -ENOENT; | 2264 | ret = -ENOENT; |
2265 | goto out; | 2265 | goto out; |
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 01c34bc5b5b0..c49fbc4db3b5 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c | |||
@@ -3206,7 +3206,7 @@ struct drm_encoder * | |||
3206 | drm_atomic_helper_best_encoder(struct drm_connector *connector) | 3206 | drm_atomic_helper_best_encoder(struct drm_connector *connector) |
3207 | { | 3207 | { |
3208 | WARN_ON(connector->encoder_ids[1]); | 3208 | WARN_ON(connector->encoder_ids[1]); |
3209 | return drm_encoder_find(connector->dev, connector->encoder_ids[0]); | 3209 | return drm_encoder_find(connector->dev, NULL, connector->encoder_ids[0]); |
3210 | } | 3210 | } |
3211 | EXPORT_SYMBOL(drm_atomic_helper_best_encoder); | 3211 | EXPORT_SYMBOL(drm_atomic_helper_best_encoder); |
3212 | 3212 | ||
diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c index fe0982708e95..0d002b045bd2 100644 --- a/drivers/gpu/drm/drm_color_mgmt.c +++ b/drivers/gpu/drm/drm_color_mgmt.c | |||
@@ -230,7 +230,7 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev, | |||
230 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 230 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
231 | return -EINVAL; | 231 | return -EINVAL; |
232 | 232 | ||
233 | crtc = drm_crtc_find(dev, crtc_lut->crtc_id); | 233 | crtc = drm_crtc_find(dev, file_priv, crtc_lut->crtc_id); |
234 | if (!crtc) | 234 | if (!crtc) |
235 | return -ENOENT; | 235 | return -ENOENT; |
236 | 236 | ||
@@ -308,7 +308,7 @@ int drm_mode_gamma_get_ioctl(struct drm_device *dev, | |||
308 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 308 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
309 | return -EINVAL; | 309 | return -EINVAL; |
310 | 310 | ||
311 | crtc = drm_crtc_find(dev, crtc_lut->crtc_id); | 311 | crtc = drm_crtc_find(dev, file_priv, crtc_lut->crtc_id); |
312 | if (!crtc) | 312 | if (!crtc) |
313 | return -ENOENT; | 313 | return -ENOENT; |
314 | 314 | ||
diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index d8ca526ca4ee..704fc8934616 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c | |||
@@ -1310,7 +1310,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, | |||
1310 | 1310 | ||
1311 | memset(&u_mode, 0, sizeof(struct drm_mode_modeinfo)); | 1311 | memset(&u_mode, 0, sizeof(struct drm_mode_modeinfo)); |
1312 | 1312 | ||
1313 | connector = drm_connector_lookup(dev, out_resp->connector_id); | 1313 | connector = drm_connector_lookup(dev, file_priv, out_resp->connector_id); |
1314 | if (!connector) | 1314 | if (!connector) |
1315 | return -ENOENT; | 1315 | return -ENOENT; |
1316 | 1316 | ||
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 68b4e976d5e0..f0556e654116 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -402,7 +402,7 @@ int drm_mode_getcrtc(struct drm_device *dev, | |||
402 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 402 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
403 | return -EINVAL; | 403 | return -EINVAL; |
404 | 404 | ||
405 | crtc = drm_crtc_find(dev, crtc_resp->crtc_id); | 405 | crtc = drm_crtc_find(dev, file_priv, crtc_resp->crtc_id); |
406 | if (!crtc) | 406 | if (!crtc) |
407 | return -ENOENT; | 407 | return -ENOENT; |
408 | 408 | ||
@@ -569,7 +569,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data, | |||
569 | if (crtc_req->x & 0xffff0000 || crtc_req->y & 0xffff0000) | 569 | if (crtc_req->x & 0xffff0000 || crtc_req->y & 0xffff0000) |
570 | return -ERANGE; | 570 | return -ERANGE; |
571 | 571 | ||
572 | crtc = drm_crtc_find(dev, crtc_req->crtc_id); | 572 | crtc = drm_crtc_find(dev, file_priv, crtc_req->crtc_id); |
573 | if (!crtc) { | 573 | if (!crtc) { |
574 | DRM_DEBUG_KMS("Unknown CRTC ID %d\n", crtc_req->crtc_id); | 574 | DRM_DEBUG_KMS("Unknown CRTC ID %d\n", crtc_req->crtc_id); |
575 | return -ENOENT; | 575 | return -ENOENT; |
@@ -595,7 +595,7 @@ retry: | |||
595 | /* Make refcounting symmetric with the lookup path. */ | 595 | /* Make refcounting symmetric with the lookup path. */ |
596 | drm_framebuffer_get(fb); | 596 | drm_framebuffer_get(fb); |
597 | } else { | 597 | } else { |
598 | fb = drm_framebuffer_lookup(dev, crtc_req->fb_id); | 598 | fb = drm_framebuffer_lookup(dev, file_priv, crtc_req->fb_id); |
599 | if (!fb) { | 599 | if (!fb) { |
600 | DRM_DEBUG_KMS("Unknown FB ID%d\n", | 600 | DRM_DEBUG_KMS("Unknown FB ID%d\n", |
601 | crtc_req->fb_id); | 601 | crtc_req->fb_id); |
@@ -680,7 +680,7 @@ retry: | |||
680 | goto out; | 680 | goto out; |
681 | } | 681 | } |
682 | 682 | ||
683 | connector = drm_connector_lookup(dev, out_id); | 683 | connector = drm_connector_lookup(dev, file_priv, out_id); |
684 | if (!connector) { | 684 | if (!connector) { |
685 | DRM_DEBUG_KMS("Connector id %d unknown\n", | 685 | DRM_DEBUG_KMS("Connector id %d unknown\n", |
686 | out_id); | 686 | out_id); |
diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h index a43582076b20..9ebb8841778c 100644 --- a/drivers/gpu/drm/drm_crtc_internal.h +++ b/drivers/gpu/drm/drm_crtc_internal.h | |||
@@ -106,6 +106,7 @@ int drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj, | |||
106 | void drm_mode_object_register(struct drm_device *dev, | 106 | void drm_mode_object_register(struct drm_device *dev, |
107 | struct drm_mode_object *obj); | 107 | struct drm_mode_object *obj); |
108 | struct drm_mode_object *__drm_mode_object_find(struct drm_device *dev, | 108 | struct drm_mode_object *__drm_mode_object_find(struct drm_device *dev, |
109 | struct drm_file *file_priv, | ||
109 | uint32_t id, uint32_t type); | 110 | uint32_t id, uint32_t type); |
110 | void drm_mode_object_unregister(struct drm_device *dev, | 111 | void drm_mode_object_unregister(struct drm_device *dev, |
111 | struct drm_mode_object *object); | 112 | struct drm_mode_object *object); |
diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c index 0708779840d2..43f644844b83 100644 --- a/drivers/gpu/drm/drm_encoder.c +++ b/drivers/gpu/drm/drm_encoder.c | |||
@@ -220,7 +220,7 @@ int drm_mode_getencoder(struct drm_device *dev, void *data, | |||
220 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 220 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
221 | return -EINVAL; | 221 | return -EINVAL; |
222 | 222 | ||
223 | encoder = drm_encoder_find(dev, enc_resp->encoder_id); | 223 | encoder = drm_encoder_find(dev, file_priv, enc_resp->encoder_id); |
224 | if (!encoder) | 224 | if (!encoder) |
225 | return -ENOENT; | 225 | return -ENOENT; |
226 | 226 | ||
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index af279844d7ce..2affe53f3fda 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c | |||
@@ -381,7 +381,7 @@ int drm_mode_rmfb(struct drm_device *dev, | |||
381 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 381 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
382 | return -EINVAL; | 382 | return -EINVAL; |
383 | 383 | ||
384 | fb = drm_framebuffer_lookup(dev, *id); | 384 | fb = drm_framebuffer_lookup(dev, file_priv, *id); |
385 | if (!fb) | 385 | if (!fb) |
386 | return -ENOENT; | 386 | return -ENOENT; |
387 | 387 | ||
@@ -450,7 +450,7 @@ int drm_mode_getfb(struct drm_device *dev, | |||
450 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 450 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
451 | return -EINVAL; | 451 | return -EINVAL; |
452 | 452 | ||
453 | fb = drm_framebuffer_lookup(dev, r->fb_id); | 453 | fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id); |
454 | if (!fb) | 454 | if (!fb) |
455 | return -ENOENT; | 455 | return -ENOENT; |
456 | 456 | ||
@@ -515,7 +515,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev, | |||
515 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 515 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
516 | return -EINVAL; | 516 | return -EINVAL; |
517 | 517 | ||
518 | fb = drm_framebuffer_lookup(dev, r->fb_id); | 518 | fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id); |
519 | if (!fb) | 519 | if (!fb) |
520 | return -ENOENT; | 520 | return -ENOENT; |
521 | 521 | ||
@@ -688,12 +688,13 @@ EXPORT_SYMBOL(drm_framebuffer_init); | |||
688 | * again, using drm_framebuffer_put(). | 688 | * again, using drm_framebuffer_put(). |
689 | */ | 689 | */ |
690 | struct drm_framebuffer *drm_framebuffer_lookup(struct drm_device *dev, | 690 | struct drm_framebuffer *drm_framebuffer_lookup(struct drm_device *dev, |
691 | struct drm_file *file_priv, | ||
691 | uint32_t id) | 692 | uint32_t id) |
692 | { | 693 | { |
693 | struct drm_mode_object *obj; | 694 | struct drm_mode_object *obj; |
694 | struct drm_framebuffer *fb = NULL; | 695 | struct drm_framebuffer *fb = NULL; |
695 | 696 | ||
696 | obj = __drm_mode_object_find(dev, id, DRM_MODE_OBJECT_FB); | 697 | obj = __drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_FB); |
697 | if (obj) | 698 | if (obj) |
698 | fb = obj_to_fb(obj); | 699 | fb = obj_to_fb(obj); |
699 | return fb; | 700 | return fb; |
diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c index 7a1ea91d3343..240a05d91a53 100644 --- a/drivers/gpu/drm/drm_mode_object.c +++ b/drivers/gpu/drm/drm_mode_object.c | |||
@@ -105,6 +105,7 @@ void drm_mode_object_unregister(struct drm_device *dev, | |||
105 | } | 105 | } |
106 | 106 | ||
107 | struct drm_mode_object *__drm_mode_object_find(struct drm_device *dev, | 107 | struct drm_mode_object *__drm_mode_object_find(struct drm_device *dev, |
108 | struct drm_file *file_priv, | ||
108 | uint32_t id, uint32_t type) | 109 | uint32_t id, uint32_t type) |
109 | { | 110 | { |
110 | struct drm_mode_object *obj = NULL; | 111 | struct drm_mode_object *obj = NULL; |
@@ -127,7 +128,7 @@ struct drm_mode_object *__drm_mode_object_find(struct drm_device *dev, | |||
127 | 128 | ||
128 | /** | 129 | /** |
129 | * drm_mode_object_find - look up a drm object with static lifetime | 130 | * drm_mode_object_find - look up a drm object with static lifetime |
130 | * @dev: drm device | 131 | * @file_priv: drm file |
131 | * @id: id of the mode object | 132 | * @id: id of the mode object |
132 | * @type: type of the mode object | 133 | * @type: type of the mode object |
133 | * | 134 | * |
@@ -136,11 +137,12 @@ struct drm_mode_object *__drm_mode_object_find(struct drm_device *dev, | |||
136 | * by callind drm_mode_object_put(). | 137 | * by callind drm_mode_object_put(). |
137 | */ | 138 | */ |
138 | struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, | 139 | struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, |
140 | struct drm_file *file_priv, | ||
139 | uint32_t id, uint32_t type) | 141 | uint32_t id, uint32_t type) |
140 | { | 142 | { |
141 | struct drm_mode_object *obj = NULL; | 143 | struct drm_mode_object *obj = NULL; |
142 | 144 | ||
143 | obj = __drm_mode_object_find(dev, id, type); | 145 | obj = __drm_mode_object_find(dev, file_priv, id, type); |
144 | return obj; | 146 | return obj; |
145 | } | 147 | } |
146 | EXPORT_SYMBOL(drm_mode_object_find); | 148 | EXPORT_SYMBOL(drm_mode_object_find); |
@@ -359,7 +361,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, | |||
359 | 361 | ||
360 | drm_modeset_lock_all(dev); | 362 | drm_modeset_lock_all(dev); |
361 | 363 | ||
362 | obj = drm_mode_object_find(dev, arg->obj_id, arg->obj_type); | 364 | obj = drm_mode_object_find(dev, file_priv, arg->obj_id, arg->obj_type); |
363 | if (!obj) { | 365 | if (!obj) { |
364 | ret = -ENOENT; | 366 | ret = -ENOENT; |
365 | goto out; | 367 | goto out; |
@@ -481,7 +483,7 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data, | |||
481 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 483 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
482 | return -EINVAL; | 484 | return -EINVAL; |
483 | 485 | ||
484 | arg_obj = drm_mode_object_find(dev, arg->obj_id, arg->obj_type); | 486 | arg_obj = drm_mode_object_find(dev, file_priv, arg->obj_id, arg->obj_type); |
485 | if (!arg_obj) | 487 | if (!arg_obj) |
486 | return -ENOENT; | 488 | return -ENOENT; |
487 | 489 | ||
diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 72cba9805edc..6af02c7b5da3 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c | |||
@@ -513,7 +513,7 @@ int drm_mode_getplane(struct drm_device *dev, void *data, | |||
513 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 513 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
514 | return -EINVAL; | 514 | return -EINVAL; |
515 | 515 | ||
516 | plane = drm_plane_find(dev, plane_resp->plane_id); | 516 | plane = drm_plane_find(dev, file_priv, plane_resp->plane_id); |
517 | if (!plane) | 517 | if (!plane) |
518 | return -ENOENT; | 518 | return -ENOENT; |
519 | 519 | ||
@@ -703,7 +703,7 @@ int drm_mode_setplane(struct drm_device *dev, void *data, | |||
703 | * First, find the plane, crtc, and fb objects. If not available, | 703 | * First, find the plane, crtc, and fb objects. If not available, |
704 | * we don't bother to call the driver. | 704 | * we don't bother to call the driver. |
705 | */ | 705 | */ |
706 | plane = drm_plane_find(dev, plane_req->plane_id); | 706 | plane = drm_plane_find(dev, file_priv, plane_req->plane_id); |
707 | if (!plane) { | 707 | if (!plane) { |
708 | DRM_DEBUG_KMS("Unknown plane ID %d\n", | 708 | DRM_DEBUG_KMS("Unknown plane ID %d\n", |
709 | plane_req->plane_id); | 709 | plane_req->plane_id); |
@@ -711,14 +711,14 @@ int drm_mode_setplane(struct drm_device *dev, void *data, | |||
711 | } | 711 | } |
712 | 712 | ||
713 | if (plane_req->fb_id) { | 713 | if (plane_req->fb_id) { |
714 | fb = drm_framebuffer_lookup(dev, plane_req->fb_id); | 714 | fb = drm_framebuffer_lookup(dev, file_priv, plane_req->fb_id); |
715 | if (!fb) { | 715 | if (!fb) { |
716 | DRM_DEBUG_KMS("Unknown framebuffer ID %d\n", | 716 | DRM_DEBUG_KMS("Unknown framebuffer ID %d\n", |
717 | plane_req->fb_id); | 717 | plane_req->fb_id); |
718 | return -ENOENT; | 718 | return -ENOENT; |
719 | } | 719 | } |
720 | 720 | ||
721 | crtc = drm_crtc_find(dev, plane_req->crtc_id); | 721 | crtc = drm_crtc_find(dev, file_priv, plane_req->crtc_id); |
722 | if (!crtc) { | 722 | if (!crtc) { |
723 | drm_framebuffer_put(fb); | 723 | drm_framebuffer_put(fb); |
724 | DRM_DEBUG_KMS("Unknown crtc ID %d\n", | 724 | DRM_DEBUG_KMS("Unknown crtc ID %d\n", |
@@ -829,7 +829,7 @@ static int drm_mode_cursor_common(struct drm_device *dev, | |||
829 | if (!req->flags || (~DRM_MODE_CURSOR_FLAGS & req->flags)) | 829 | if (!req->flags || (~DRM_MODE_CURSOR_FLAGS & req->flags)) |
830 | return -EINVAL; | 830 | return -EINVAL; |
831 | 831 | ||
832 | crtc = drm_crtc_find(dev, req->crtc_id); | 832 | crtc = drm_crtc_find(dev, file_priv, req->crtc_id); |
833 | if (!crtc) { | 833 | if (!crtc) { |
834 | DRM_DEBUG_KMS("Unknown CRTC ID %d\n", req->crtc_id); | 834 | DRM_DEBUG_KMS("Unknown CRTC ID %d\n", req->crtc_id); |
835 | return -ENOENT; | 835 | return -ENOENT; |
@@ -944,7 +944,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev, | |||
944 | if ((page_flip->flags & DRM_MODE_PAGE_FLIP_ASYNC) && !dev->mode_config.async_page_flip) | 944 | if ((page_flip->flags & DRM_MODE_PAGE_FLIP_ASYNC) && !dev->mode_config.async_page_flip) |
945 | return -EINVAL; | 945 | return -EINVAL; |
946 | 946 | ||
947 | crtc = drm_crtc_find(dev, page_flip->crtc_id); | 947 | crtc = drm_crtc_find(dev, file_priv, page_flip->crtc_id); |
948 | if (!crtc) | 948 | if (!crtc) |
949 | return -ENOENT; | 949 | return -ENOENT; |
950 | 950 | ||
@@ -1005,7 +1005,7 @@ retry: | |||
1005 | goto out; | 1005 | goto out; |
1006 | } | 1006 | } |
1007 | 1007 | ||
1008 | fb = drm_framebuffer_lookup(dev, page_flip->fb_id); | 1008 | fb = drm_framebuffer_lookup(dev, file_priv, page_flip->fb_id); |
1009 | if (!fb) { | 1009 | if (!fb) { |
1010 | ret = -ENOENT; | 1010 | ret = -ENOENT; |
1011 | goto out; | 1011 | goto out; |
diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index 5840aabbf24e..6dc2dde5b672 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c | |||
@@ -99,7 +99,7 @@ drm_mode_validate_pipeline(struct drm_display_mode *mode, | |||
99 | 99 | ||
100 | /* Step 2: Validate against encoders and crtcs */ | 100 | /* Step 2: Validate against encoders and crtcs */ |
101 | for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { | 101 | for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { |
102 | struct drm_encoder *encoder = drm_encoder_find(dev, ids[i]); | 102 | struct drm_encoder *encoder = drm_encoder_find(dev, NULL, ids[i]); |
103 | struct drm_crtc *crtc; | 103 | struct drm_crtc *crtc; |
104 | 104 | ||
105 | if (!encoder) | 105 | if (!encoder) |
diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c index bc5128203056..bae50e6b819d 100644 --- a/drivers/gpu/drm/drm_property.c +++ b/drivers/gpu/drm/drm_property.c | |||
@@ -450,7 +450,7 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev, | |||
450 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 450 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
451 | return -EINVAL; | 451 | return -EINVAL; |
452 | 452 | ||
453 | property = drm_property_find(dev, out_resp->prop_id); | 453 | property = drm_property_find(dev, file_priv, out_resp->prop_id); |
454 | if (!property) | 454 | if (!property) |
455 | return -ENOENT; | 455 | return -ENOENT; |
456 | 456 | ||
@@ -634,7 +634,7 @@ struct drm_property_blob *drm_property_lookup_blob(struct drm_device *dev, | |||
634 | struct drm_mode_object *obj; | 634 | struct drm_mode_object *obj; |
635 | struct drm_property_blob *blob = NULL; | 635 | struct drm_property_blob *blob = NULL; |
636 | 636 | ||
637 | obj = __drm_mode_object_find(dev, id, DRM_MODE_OBJECT_BLOB); | 637 | obj = __drm_mode_object_find(dev, NULL, id, DRM_MODE_OBJECT_BLOB); |
638 | if (obj) | 638 | if (obj) |
639 | blob = obj_to_blob(obj); | 639 | blob = obj_to_blob(obj); |
640 | return blob; | 640 | return blob; |
@@ -897,7 +897,7 @@ bool drm_property_change_valid_get(struct drm_property *property, | |||
897 | if (value == 0) | 897 | if (value == 0) |
898 | return true; | 898 | return true; |
899 | 899 | ||
900 | *ref = __drm_mode_object_find(property->dev, value, | 900 | *ref = __drm_mode_object_find(property->dev, NULL, value, |
901 | property->values[0]); | 901 | property->values[0]); |
902 | return *ref != NULL; | 902 | return *ref != NULL; |
903 | } | 903 | } |
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c index ec4dd9df9150..f4eba87c96f3 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c | |||
@@ -36,7 +36,7 @@ static int hibmc_connector_mode_valid(struct drm_connector *connector, | |||
36 | static struct drm_encoder * | 36 | static struct drm_encoder * |
37 | hibmc_connector_best_encoder(struct drm_connector *connector) | 37 | hibmc_connector_best_encoder(struct drm_connector *connector) |
38 | { | 38 | { |
39 | return drm_encoder_find(connector->dev, connector->encoder_ids[0]); | 39 | return drm_encoder_find(connector->dev, NULL, connector->encoder_ids[0]); |
40 | } | 40 | } |
41 | 41 | ||
42 | static const struct drm_connector_helper_funcs | 42 | static const struct drm_connector_helper_funcs |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index f780f39e0758..0bec6deaae4f 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -13511,7 +13511,7 @@ int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, | |||
13511 | struct drm_crtc *drmmode_crtc; | 13511 | struct drm_crtc *drmmode_crtc; |
13512 | struct intel_crtc *crtc; | 13512 | struct intel_crtc *crtc; |
13513 | 13513 | ||
13514 | drmmode_crtc = drm_crtc_find(dev, pipe_from_crtc_id->crtc_id); | 13514 | drmmode_crtc = drm_crtc_find(dev, file, pipe_from_crtc_id->crtc_id); |
13515 | if (!drmmode_crtc) | 13515 | if (!drmmode_crtc) |
13516 | return -ENOENT; | 13516 | return -ENOENT; |
13517 | 13517 | ||
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c index aace22e7ccac..1b397b41cb4f 100644 --- a/drivers/gpu/drm/i915/intel_overlay.c +++ b/drivers/gpu/drm/i915/intel_overlay.c | |||
@@ -1134,7 +1134,7 @@ int intel_overlay_put_image_ioctl(struct drm_device *dev, void *data, | |||
1134 | if (!params) | 1134 | if (!params) |
1135 | return -ENOMEM; | 1135 | return -ENOMEM; |
1136 | 1136 | ||
1137 | drmmode_crtc = drm_crtc_find(dev, put_image_rec->crtc_id); | 1137 | drmmode_crtc = drm_crtc_find(dev, file_priv, put_image_rec->crtc_id); |
1138 | if (!drmmode_crtc) { | 1138 | if (!drmmode_crtc) { |
1139 | ret = -ENOENT; | 1139 | ret = -ENOENT; |
1140 | goto out_free; | 1140 | goto out_free; |
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index b0d6e3e28d07..28a1209d87e2 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c | |||
@@ -994,7 +994,7 @@ int intel_sprite_set_colorkey(struct drm_device *dev, void *data, | |||
994 | set->flags & I915_SET_COLORKEY_DESTINATION) | 994 | set->flags & I915_SET_COLORKEY_DESTINATION) |
995 | return -EINVAL; | 995 | return -EINVAL; |
996 | 996 | ||
997 | plane = drm_plane_find(dev, set->plane_id); | 997 | plane = drm_plane_find(dev, file_priv, set->plane_id); |
998 | if (!plane || plane->type != DRM_PLANE_TYPE_OVERLAY) | 998 | if (!plane || plane->type != DRM_PLANE_TYPE_OVERLAY) |
999 | return -ENOENT; | 999 | return -ENOENT; |
1000 | 1000 | ||
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c index 5e9cd4c0e8b6..68e5d9c94475 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mode.c +++ b/drivers/gpu/drm/mgag200/mgag200_mode.c | |||
@@ -1670,7 +1670,7 @@ static struct drm_encoder *mga_connector_best_encoder(struct drm_connector | |||
1670 | int enc_id = connector->encoder_ids[0]; | 1670 | int enc_id = connector->encoder_ids[0]; |
1671 | /* pick the encoder ids */ | 1671 | /* pick the encoder ids */ |
1672 | if (enc_id) | 1672 | if (enc_id) |
1673 | return drm_encoder_find(connector->dev, enc_id); | 1673 | return drm_encoder_find(connector->dev, NULL, enc_id); |
1674 | return NULL; | 1674 | return NULL; |
1675 | } | 1675 | } |
1676 | 1676 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 70d8e0d69ad5..69d6e61a01ec 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c | |||
@@ -373,7 +373,7 @@ find_encoder(struct drm_connector *connector, int type) | |||
373 | if (!id) | 373 | if (!id) |
374 | break; | 374 | break; |
375 | 375 | ||
376 | enc = drm_encoder_find(dev, id); | 376 | enc = drm_encoder_find(dev, NULL, id); |
377 | if (!enc) | 377 | if (!enc) |
378 | continue; | 378 | continue; |
379 | nv_encoder = nouveau_encoder(enc); | 379 | nv_encoder = nouveau_encoder(enc); |
@@ -441,7 +441,7 @@ nouveau_connector_ddc_detect(struct drm_connector *connector) | |||
441 | if (id == 0) | 441 | if (id == 0) |
442 | break; | 442 | break; |
443 | 443 | ||
444 | encoder = drm_encoder_find(dev, id); | 444 | encoder = drm_encoder_find(dev, NULL, id); |
445 | if (!encoder) | 445 | if (!encoder) |
446 | continue; | 446 | continue; |
447 | nv_encoder = nouveau_encoder(encoder); | 447 | nv_encoder = nouveau_encoder(encoder); |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index c31e660e35db..7d39ed63e5be 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -1456,7 +1456,7 @@ int r100_cs_packet_parse_vline(struct radeon_cs_parser *p) | |||
1456 | header = radeon_get_ib_value(p, h_idx); | 1456 | header = radeon_get_ib_value(p, h_idx); |
1457 | crtc_id = radeon_get_ib_value(p, h_idx + 5); | 1457 | crtc_id = radeon_get_ib_value(p, h_idx + 5); |
1458 | reg = R100_CP_PACKET0_GET_REG(header); | 1458 | reg = R100_CP_PACKET0_GET_REG(header); |
1459 | crtc = drm_crtc_find(p->rdev->ddev, crtc_id); | 1459 | crtc = drm_crtc_find(p->rdev->ddev, p->filp, crtc_id); |
1460 | if (!crtc) { | 1460 | if (!crtc) { |
1461 | DRM_ERROR("cannot find crtc %d\n", crtc_id); | 1461 | DRM_ERROR("cannot find crtc %d\n", crtc_id); |
1462 | return -ENOENT; | 1462 | return -ENOENT; |
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index 97fd58e97043..c96b31950ca7 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c | |||
@@ -887,7 +887,7 @@ int r600_cs_common_vline_parse(struct radeon_cs_parser *p, | |||
887 | crtc_id = radeon_get_ib_value(p, h_idx + 2 + 7 + 1); | 887 | crtc_id = radeon_get_ib_value(p, h_idx + 2 + 7 + 1); |
888 | reg = R600_CP_PACKET0_GET_REG(header); | 888 | reg = R600_CP_PACKET0_GET_REG(header); |
889 | 889 | ||
890 | crtc = drm_crtc_find(p->rdev->ddev, crtc_id); | 890 | crtc = drm_crtc_find(p->rdev->ddev, p->filp, crtc_id); |
891 | if (!crtc) { | 891 | if (!crtc) { |
892 | DRM_ERROR("cannot find crtc %d\n", crtc_id); | 892 | DRM_ERROR("cannot find crtc %d\n", crtc_id); |
893 | return -ENOENT; | 893 | return -ENOENT; |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 2f642cbefd8e..59dcefb2df3b 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -263,7 +263,7 @@ radeon_connector_update_scratch_regs(struct drm_connector *connector, enum drm_c | |||
263 | if (connector->encoder_ids[i] == 0) | 263 | if (connector->encoder_ids[i] == 0) |
264 | break; | 264 | break; |
265 | 265 | ||
266 | encoder = drm_encoder_find(connector->dev, | 266 | encoder = drm_encoder_find(connector->dev, NULL, |
267 | connector->encoder_ids[i]); | 267 | connector->encoder_ids[i]); |
268 | if (!encoder) | 268 | if (!encoder) |
269 | continue; | 269 | continue; |
@@ -290,7 +290,7 @@ static struct drm_encoder *radeon_find_encoder(struct drm_connector *connector, | |||
290 | if (connector->encoder_ids[i] == 0) | 290 | if (connector->encoder_ids[i] == 0) |
291 | break; | 291 | break; |
292 | 292 | ||
293 | encoder = drm_encoder_find(connector->dev, connector->encoder_ids[i]); | 293 | encoder = drm_encoder_find(connector->dev, NULL, connector->encoder_ids[i]); |
294 | if (!encoder) | 294 | if (!encoder) |
295 | continue; | 295 | continue; |
296 | 296 | ||
@@ -404,7 +404,7 @@ static struct drm_encoder *radeon_best_single_encoder(struct drm_connector *conn | |||
404 | int enc_id = connector->encoder_ids[0]; | 404 | int enc_id = connector->encoder_ids[0]; |
405 | /* pick the encoder ids */ | 405 | /* pick the encoder ids */ |
406 | if (enc_id) | 406 | if (enc_id) |
407 | return drm_encoder_find(connector->dev, enc_id); | 407 | return drm_encoder_find(connector->dev, NULL, enc_id); |
408 | return NULL; | 408 | return NULL; |
409 | } | 409 | } |
410 | 410 | ||
@@ -1368,7 +1368,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
1368 | if (connector->encoder_ids[i] == 0) | 1368 | if (connector->encoder_ids[i] == 0) |
1369 | break; | 1369 | break; |
1370 | 1370 | ||
1371 | encoder = drm_encoder_find(connector->dev, | 1371 | encoder = drm_encoder_find(connector->dev, NULL, |
1372 | connector->encoder_ids[i]); | 1372 | connector->encoder_ids[i]); |
1373 | if (!encoder) | 1373 | if (!encoder) |
1374 | continue; | 1374 | continue; |
@@ -1454,7 +1454,7 @@ static struct drm_encoder *radeon_dvi_encoder(struct drm_connector *connector) | |||
1454 | if (connector->encoder_ids[i] == 0) | 1454 | if (connector->encoder_ids[i] == 0) |
1455 | break; | 1455 | break; |
1456 | 1456 | ||
1457 | encoder = drm_encoder_find(connector->dev, connector->encoder_ids[i]); | 1457 | encoder = drm_encoder_find(connector->dev, NULL, connector->encoder_ids[i]); |
1458 | if (!encoder) | 1458 | if (!encoder) |
1459 | continue; | 1459 | continue; |
1460 | 1460 | ||
@@ -1473,7 +1473,7 @@ static struct drm_encoder *radeon_dvi_encoder(struct drm_connector *connector) | |||
1473 | /* then check use digitial */ | 1473 | /* then check use digitial */ |
1474 | /* pick the first one */ | 1474 | /* pick the first one */ |
1475 | if (enc_id) | 1475 | if (enc_id) |
1476 | return drm_encoder_find(connector->dev, enc_id); | 1476 | return drm_encoder_find(connector->dev, NULL, enc_id); |
1477 | return NULL; | 1477 | return NULL; |
1478 | } | 1478 | } |
1479 | 1479 | ||
@@ -1620,7 +1620,7 @@ u16 radeon_connector_encoder_get_dp_bridge_encoder_id(struct drm_connector *conn | |||
1620 | if (connector->encoder_ids[i] == 0) | 1620 | if (connector->encoder_ids[i] == 0) |
1621 | break; | 1621 | break; |
1622 | 1622 | ||
1623 | encoder = drm_encoder_find(connector->dev, connector->encoder_ids[i]); | 1623 | encoder = drm_encoder_find(connector->dev, NULL, connector->encoder_ids[i]); |
1624 | if (!encoder) | 1624 | if (!encoder) |
1625 | continue; | 1625 | continue; |
1626 | 1626 | ||
@@ -1649,7 +1649,7 @@ static bool radeon_connector_encoder_is_hbr2(struct drm_connector *connector) | |||
1649 | if (connector->encoder_ids[i] == 0) | 1649 | if (connector->encoder_ids[i] == 0) |
1650 | break; | 1650 | break; |
1651 | 1651 | ||
1652 | encoder = drm_encoder_find(connector->dev, connector->encoder_ids[i]); | 1652 | encoder = drm_encoder_find(connector->dev, NULL, connector->encoder_ids[i]); |
1653 | if (!encoder) | 1653 | if (!encoder) |
1654 | continue; | 1654 | continue; |
1655 | 1655 | ||
diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c index 9f9a49748d17..091ca81658eb 100644 --- a/drivers/gpu/drm/udl/udl_connector.c +++ b/drivers/gpu/drm/udl/udl_connector.c | |||
@@ -105,7 +105,7 @@ static struct drm_encoder* | |||
105 | udl_best_single_encoder(struct drm_connector *connector) | 105 | udl_best_single_encoder(struct drm_connector *connector) |
106 | { | 106 | { |
107 | int enc_id = connector->encoder_ids[0]; | 107 | int enc_id = connector->encoder_ids[0]; |
108 | return drm_encoder_find(connector->dev, enc_id); | 108 | return drm_encoder_find(connector->dev, NULL, enc_id); |
109 | } | 109 | } |
110 | 110 | ||
111 | static int udl_connector_set_property(struct drm_connector *connector, | 111 | static int udl_connector_set_property(struct drm_connector *connector, |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c index 5ec24fd801cd..01be355525e4 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | |||
@@ -286,7 +286,7 @@ int vmw_present_ioctl(struct drm_device *dev, void *data, | |||
286 | 286 | ||
287 | drm_modeset_lock_all(dev); | 287 | drm_modeset_lock_all(dev); |
288 | 288 | ||
289 | fb = drm_framebuffer_lookup(dev, arg->fb_id); | 289 | fb = drm_framebuffer_lookup(dev, file_priv, arg->fb_id); |
290 | if (!fb) { | 290 | if (!fb) { |
291 | DRM_ERROR("Invalid framebuffer id.\n"); | 291 | DRM_ERROR("Invalid framebuffer id.\n"); |
292 | ret = -ENOENT; | 292 | ret = -ENOENT; |
@@ -369,7 +369,7 @@ int vmw_present_readback_ioctl(struct drm_device *dev, void *data, | |||
369 | 369 | ||
370 | drm_modeset_lock_all(dev); | 370 | drm_modeset_lock_all(dev); |
371 | 371 | ||
372 | fb = drm_framebuffer_lookup(dev, arg->fb_id); | 372 | fb = drm_framebuffer_lookup(dev, file_priv, arg->fb_id); |
373 | if (!fb) { | 373 | if (!fb) { |
374 | DRM_ERROR("Invalid framebuffer id.\n"); | 374 | DRM_ERROR("Invalid framebuffer id.\n"); |
375 | ret = -ENOENT; | 375 | ret = -ENOENT; |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index b850562fbdd6..0545740b3724 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
@@ -1726,7 +1726,7 @@ int vmw_kms_cursor_bypass_ioctl(struct drm_device *dev, void *data, | |||
1726 | return 0; | 1726 | return 0; |
1727 | } | 1727 | } |
1728 | 1728 | ||
1729 | crtc = drm_crtc_find(dev, arg->crtc_id); | 1729 | crtc = drm_crtc_find(dev, file_priv, arg->crtc_id); |
1730 | if (!crtc) { | 1730 | if (!crtc) { |
1731 | ret = -ENOENT; | 1731 | ret = -ENOENT; |
1732 | goto out; | 1732 | goto out; |
diff --git a/drivers/staging/vboxvideo/vbox_mode.c b/drivers/staging/vboxvideo/vbox_mode.c index 257a77830410..c745a0402c68 100644 --- a/drivers/staging/vboxvideo/vbox_mode.c +++ b/drivers/staging/vboxvideo/vbox_mode.c | |||
@@ -377,7 +377,7 @@ static struct drm_encoder *vbox_best_single_encoder(struct drm_connector | |||
377 | 377 | ||
378 | /* pick the encoder ids */ | 378 | /* pick the encoder ids */ |
379 | if (enc_id) | 379 | if (enc_id) |
380 | return drm_encoder_find(connector->dev, enc_id); | 380 | return drm_encoder_find(connector->dev, NULL, enc_id); |
381 | 381 | ||
382 | return NULL; | 382 | return NULL; |
383 | } | 383 | } |
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index b34904dc8b9b..b4285c40e1e4 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h | |||
@@ -939,10 +939,11 @@ static inline unsigned drm_connector_index(struct drm_connector *connector) | |||
939 | * add takes a reference to it. | 939 | * add takes a reference to it. |
940 | */ | 940 | */ |
941 | static inline struct drm_connector *drm_connector_lookup(struct drm_device *dev, | 941 | static inline struct drm_connector *drm_connector_lookup(struct drm_device *dev, |
942 | struct drm_file *file_priv, | ||
942 | uint32_t id) | 943 | uint32_t id) |
943 | { | 944 | { |
944 | struct drm_mode_object *mo; | 945 | struct drm_mode_object *mo; |
945 | mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_CONNECTOR); | 946 | mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_CONNECTOR); |
946 | return mo ? obj_to_connector(mo) : NULL; | 947 | return mo ? obj_to_connector(mo) : NULL; |
947 | } | 948 | } |
948 | 949 | ||
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 80c97210eda5..f7fcceef46d9 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -959,10 +959,11 @@ struct drm_crtc *drm_crtc_from_index(struct drm_device *dev, int idx); | |||
959 | * userspace interface should be done using &drm_property. | 959 | * userspace interface should be done using &drm_property. |
960 | */ | 960 | */ |
961 | static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev, | 961 | static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev, |
962 | uint32_t id) | 962 | struct drm_file *file_priv, |
963 | uint32_t id) | ||
963 | { | 964 | { |
964 | struct drm_mode_object *mo; | 965 | struct drm_mode_object *mo; |
965 | mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_CRTC); | 966 | mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_CRTC); |
966 | return mo ? obj_to_crtc(mo) : NULL; | 967 | return mo ? obj_to_crtc(mo) : NULL; |
967 | } | 968 | } |
968 | 969 | ||
diff --git a/include/drm/drm_encoder.h b/include/drm/drm_encoder.h index 8d8245ec0181..86db0da8bdcb 100644 --- a/include/drm/drm_encoder.h +++ b/include/drm/drm_encoder.h | |||
@@ -214,11 +214,12 @@ static inline bool drm_encoder_crtc_ok(struct drm_encoder *encoder, | |||
214 | * drm_mode_object_find(). | 214 | * drm_mode_object_find(). |
215 | */ | 215 | */ |
216 | static inline struct drm_encoder *drm_encoder_find(struct drm_device *dev, | 216 | static inline struct drm_encoder *drm_encoder_find(struct drm_device *dev, |
217 | struct drm_file *file_priv, | ||
217 | uint32_t id) | 218 | uint32_t id) |
218 | { | 219 | { |
219 | struct drm_mode_object *mo; | 220 | struct drm_mode_object *mo; |
220 | 221 | ||
221 | mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_ENCODER); | 222 | mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_ENCODER); |
222 | 223 | ||
223 | return mo ? obj_to_encoder(mo) : NULL; | 224 | return mo ? obj_to_encoder(mo) : NULL; |
224 | } | 225 | } |
diff --git a/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h index b6996ddb19d6..4c5ee4ae54df 100644 --- a/include/drm/drm_framebuffer.h +++ b/include/drm/drm_framebuffer.h | |||
@@ -205,6 +205,7 @@ int drm_framebuffer_init(struct drm_device *dev, | |||
205 | struct drm_framebuffer *fb, | 205 | struct drm_framebuffer *fb, |
206 | const struct drm_framebuffer_funcs *funcs); | 206 | const struct drm_framebuffer_funcs *funcs); |
207 | struct drm_framebuffer *drm_framebuffer_lookup(struct drm_device *dev, | 207 | struct drm_framebuffer *drm_framebuffer_lookup(struct drm_device *dev, |
208 | struct drm_file *file_priv, | ||
208 | uint32_t id); | 209 | uint32_t id); |
209 | void drm_framebuffer_remove(struct drm_framebuffer *fb); | 210 | void drm_framebuffer_remove(struct drm_framebuffer *fb); |
210 | void drm_framebuffer_cleanup(struct drm_framebuffer *fb); | 211 | void drm_framebuffer_cleanup(struct drm_framebuffer *fb); |
diff --git a/include/drm/drm_mode_object.h b/include/drm/drm_mode_object.h index a767b4a30a6d..b2f920b518e3 100644 --- a/include/drm/drm_mode_object.h +++ b/include/drm/drm_mode_object.h | |||
@@ -27,6 +27,7 @@ | |||
27 | struct drm_object_properties; | 27 | struct drm_object_properties; |
28 | struct drm_property; | 28 | struct drm_property; |
29 | struct drm_device; | 29 | struct drm_device; |
30 | struct drm_file; | ||
30 | 31 | ||
31 | /** | 32 | /** |
32 | * struct drm_mode_object - base structure for modeset objects | 33 | * struct drm_mode_object - base structure for modeset objects |
@@ -113,6 +114,7 @@ struct drm_object_properties { | |||
113 | } | 114 | } |
114 | 115 | ||
115 | struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, | 116 | struct drm_mode_object *drm_mode_object_find(struct drm_device *dev, |
117 | struct drm_file *file_priv, | ||
116 | uint32_t id, uint32_t type); | 118 | uint32_t id, uint32_t type); |
117 | void drm_mode_object_get(struct drm_mode_object *obj); | 119 | void drm_mode_object_get(struct drm_mode_object *obj); |
118 | void drm_mode_object_put(struct drm_mode_object *obj); | 120 | void drm_mode_object_put(struct drm_mode_object *obj); |
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index 82a217bd77f0..069c4c8ce360 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h | |||
@@ -597,10 +597,11 @@ int drm_mode_plane_set_obj_prop(struct drm_plane *plane, | |||
597 | * drm_mode_object_find(). | 597 | * drm_mode_object_find(). |
598 | */ | 598 | */ |
599 | static inline struct drm_plane *drm_plane_find(struct drm_device *dev, | 599 | static inline struct drm_plane *drm_plane_find(struct drm_device *dev, |
600 | struct drm_file *file_priv, | ||
600 | uint32_t id) | 601 | uint32_t id) |
601 | { | 602 | { |
602 | struct drm_mode_object *mo; | 603 | struct drm_mode_object *mo; |
603 | mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PLANE); | 604 | mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_PLANE); |
604 | return mo ? obj_to_plane(mo) : NULL; | 605 | return mo ? obj_to_plane(mo) : NULL; |
605 | } | 606 | } |
606 | 607 | ||
diff --git a/include/drm/drm_property.h b/include/drm/drm_property.h index 37355c623e6c..429d8218f740 100644 --- a/include/drm/drm_property.h +++ b/include/drm/drm_property.h | |||
@@ -312,10 +312,11 @@ drm_property_unreference_blob(struct drm_property_blob *blob) | |||
312 | * This function looks up the property object specified by id and returns it. | 312 | * This function looks up the property object specified by id and returns it. |
313 | */ | 313 | */ |
314 | static inline struct drm_property *drm_property_find(struct drm_device *dev, | 314 | static inline struct drm_property *drm_property_find(struct drm_device *dev, |
315 | struct drm_file *file_priv, | ||
315 | uint32_t id) | 316 | uint32_t id) |
316 | { | 317 | { |
317 | struct drm_mode_object *mo; | 318 | struct drm_mode_object *mo; |
318 | mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PROPERTY); | 319 | mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_PROPERTY); |
319 | return mo ? obj_to_property(mo) : NULL; | 320 | return mo ? obj_to_property(mo) : NULL; |
320 | } | 321 | } |
321 | 322 | ||