drm: Pass struct drm_file * to __drm_mode_object_find [v2]
authorKeith Packard <keithp@keithp.com>
Wed, 15 Mar 2017 06:25:07 +0000 (23:25 -0700)
committerDave Airlie <airlied@redhat.com>
Thu, 12 Oct 2017 00:03:04 +0000 (10:03 +1000)
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:
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
drivers/gpu/drm/amd/amdgpu/dce_virtual.c
drivers/gpu/drm/ast/ast_mode.c
drivers/gpu/drm/bochs/bochs_kms.c
drivers/gpu/drm/cirrus/cirrus_mode.c
drivers/gpu/drm/drm_atomic.c
drivers/gpu/drm/drm_atomic_helper.c
drivers/gpu/drm/drm_color_mgmt.c
drivers/gpu/drm/drm_connector.c
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_crtc_internal.h
drivers/gpu/drm/drm_encoder.c
drivers/gpu/drm/drm_framebuffer.c
drivers/gpu/drm/drm_mode_object.c
drivers/gpu/drm/drm_plane.c
drivers/gpu/drm/drm_probe_helper.c
drivers/gpu/drm/drm_property.c
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_overlay.c
drivers/gpu/drm/i915/intel_sprite.c
drivers/gpu/drm/mgag200/mgag200_mode.c
drivers/gpu/drm/nouveau/nouveau_connector.c
drivers/gpu/drm/radeon/r100.c
drivers/gpu/drm/radeon/r600_cs.c
drivers/gpu/drm/radeon/radeon_connectors.c
drivers/gpu/drm/udl/udl_connector.c
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
drivers/staging/vboxvideo/vbox_mode.c
include/drm/drm_connector.h
include/drm/drm_crtc.h
include/drm/drm_encoder.h
include/drm/drm_framebuffer.h
include/drm/drm_mode_object.h
include/drm/drm_plane.h
include/drm/drm_property.h

index f51b41f094ef2f25ad99b891e42dd911bceba3d3..df9cbc78e1689eebef8c0c15358fb8b94d79a7e2 100644 (file)
@@ -231,7 +231,7 @@ amdgpu_connector_update_scratch_regs(struct drm_connector *connector,
                if (connector->encoder_ids[i] == 0)
                        break;
 
-               encoder = drm_encoder_find(connector->dev,
+               encoder = drm_encoder_find(connector->dev, NULL,
                                        connector->encoder_ids[i]);
                if (!encoder)
                        continue;
@@ -256,7 +256,7 @@ amdgpu_connector_find_encoder(struct drm_connector *connector,
        for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
                if (connector->encoder_ids[i] == 0)
                        break;
-               encoder = drm_encoder_find(connector->dev,
+               encoder = drm_encoder_find(connector->dev, NULL,
                                        connector->encoder_ids[i]);
                if (!encoder)
                        continue;
@@ -372,7 +372,7 @@ amdgpu_connector_best_single_encoder(struct drm_connector *connector)
 
        /* pick the encoder ids */
        if (enc_id)
-               return drm_encoder_find(connector->dev, enc_id);
+               return drm_encoder_find(connector->dev, NULL, enc_id);
        return NULL;
 }
 
@@ -1077,7 +1077,7 @@ amdgpu_connector_dvi_detect(struct drm_connector *connector, bool force)
                        if (connector->encoder_ids[i] == 0)
                                break;
 
-                       encoder = drm_encoder_find(connector->dev, connector->encoder_ids[i]);
+                       encoder = drm_encoder_find(connector->dev, NULL, connector->encoder_ids[i]);
                        if (!encoder)
                                continue;
 
@@ -1134,7 +1134,7 @@ amdgpu_connector_dvi_encoder(struct drm_connector *connector)
                if (connector->encoder_ids[i] == 0)
                        break;
 
-               encoder = drm_encoder_find(connector->dev, connector->encoder_ids[i]);
+               encoder = drm_encoder_find(connector->dev, NULL, connector->encoder_ids[i]);
                if (!encoder)
                        continue;
 
@@ -1153,7 +1153,7 @@ amdgpu_connector_dvi_encoder(struct drm_connector *connector)
        /* then check use digitial */
        /* pick the first one */
        if (enc_id)
-               return drm_encoder_find(connector->dev, enc_id);
+               return drm_encoder_find(connector->dev, NULL, enc_id);
        return NULL;
 }
 
@@ -1294,7 +1294,7 @@ u16 amdgpu_connector_encoder_get_dp_bridge_encoder_id(struct drm_connector *conn
                if (connector->encoder_ids[i] == 0)
                        break;
 
-               encoder = drm_encoder_find(connector->dev,
+               encoder = drm_encoder_find(connector->dev, NULL,
                                        connector->encoder_ids[i]);
                if (!encoder)
                        continue;
@@ -1323,7 +1323,7 @@ static bool amdgpu_connector_encoder_is_hbr2(struct drm_connector *connector)
        for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
                if (connector->encoder_ids[i] == 0)
                        break;
-               encoder = drm_encoder_find(connector->dev,
+               encoder = drm_encoder_find(connector->dev, NULL,
                                        connector->encoder_ids[i]);
                if (!encoder)
                        continue;
index b9ee9073cb0dc2df7a0f28790282aa5c68a969fa..a8829af120c1f713a1ff6b90f27170cce2b72d3a 100644 (file)
@@ -288,7 +288,7 @@ dce_virtual_encoder(struct drm_connector *connector)
                if (connector->encoder_ids[i] == 0)
                        break;
 
-               encoder = drm_encoder_find(connector->dev, connector->encoder_ids[i]);
+               encoder = drm_encoder_find(connector->dev, NULL, connector->encoder_ids[i]);
                if (!encoder)
                        continue;
 
@@ -298,7 +298,7 @@ dce_virtual_encoder(struct drm_connector *connector)
 
        /* pick the first one */
        if (enc_id)
-               return drm_encoder_find(connector->dev, enc_id);
+               return drm_encoder_find(connector->dev, NULL, enc_id);
        return NULL;
 }
 
index 6f3849ec0c1d0eb3fabc071c132b4ac7717f77bd..9555a35420220ed21871aa38adc11cb164a79323 100644 (file)
@@ -713,7 +713,7 @@ static struct drm_encoder *ast_best_single_encoder(struct drm_connector *connect
        int enc_id = connector->encoder_ids[0];
        /* pick the encoder ids */
        if (enc_id)
-               return drm_encoder_find(connector->dev, enc_id);
+               return drm_encoder_find(connector->dev, NULL, enc_id);
        return NULL;
 }
 
index 6a91e62da2f4aee18e423b90076bbfcbd51d1e05..a24a18fbd65a23ddafc8ec2bd06377a004a7267f 100644 (file)
@@ -213,7 +213,7 @@ bochs_connector_best_encoder(struct drm_connector *connector)
        int enc_id = connector->encoder_ids[0];
        /* pick the encoder ids */
        if (enc_id)
-               return drm_encoder_find(connector->dev, enc_id);
+               return drm_encoder_find(connector->dev, NULL, enc_id);
        return NULL;
 }
 
index a4c4a465b38523e69abcc92e70578bc6f2e1db49..cd23b1b28259435602efeaf99fcc885366291efe 100644 (file)
@@ -457,7 +457,7 @@ static struct drm_encoder *cirrus_connector_best_encoder(struct drm_connector
        int enc_id = connector->encoder_ids[0];
        /* pick the encoder ids */
        if (enc_id)
-               return drm_encoder_find(connector->dev, enc_id);
+               return drm_encoder_find(connector->dev, NULL, enc_id);
        return NULL;
 }
 
index 366c56fe5f58409b5269875c1e9cf09d451c9c55..268969fecee7b5cac5c288c56ae9e91defbbaf75 100644 (file)
@@ -718,7 +718,7 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
        struct drm_mode_config *config = &dev->mode_config;
 
        if (property == config->prop_fb_id) {
-               struct drm_framebuffer *fb = drm_framebuffer_lookup(dev, val);
+               struct drm_framebuffer *fb = drm_framebuffer_lookup(dev, NULL, val);
                drm_atomic_set_fb_for_plane(state, fb);
                if (fb)
                        drm_framebuffer_put(fb);
@@ -734,7 +734,7 @@ static int drm_atomic_plane_set_property(struct drm_plane *plane,
                        return -EINVAL;
 
        } else if (property == config->prop_crtc_id) {
-               struct drm_crtc *crtc = drm_crtc_find(dev, val);
+               struct drm_crtc *crtc = drm_crtc_find(dev, NULL, val);
                return drm_atomic_set_crtc_for_plane(state, crtc);
        } else if (property == config->prop_crtc_x) {
                state->crtc_x = U642I64(val);
@@ -1149,7 +1149,7 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector,
        struct drm_mode_config *config = &dev->mode_config;
 
        if (property == config->prop_crtc_id) {
-               struct drm_crtc *crtc = drm_crtc_find(dev, val);
+               struct drm_crtc *crtc = drm_crtc_find(dev, NULL, val);
                return drm_atomic_set_crtc_for_connector(state, crtc);
        } else if (property == config->dpms_property) {
                /* setting DPMS property requires special handling, which
@@ -2259,7 +2259,7 @@ retry:
                        goto out;
                }
 
-               obj = drm_mode_object_find(dev, obj_id, DRM_MODE_OBJECT_ANY);
+               obj = drm_mode_object_find(dev, file_priv, obj_id, DRM_MODE_OBJECT_ANY);
                if (!obj) {
                        ret = -ENOENT;
                        goto out;
index 01c34bc5b5b0ce5c09d866cdfe600bdeedb5346e..c49fbc4db3b5cd3d82076f14b781c5d1e5962533 100644 (file)
@@ -3206,7 +3206,7 @@ struct drm_encoder *
 drm_atomic_helper_best_encoder(struct drm_connector *connector)
 {
        WARN_ON(connector->encoder_ids[1]);
-       return drm_encoder_find(connector->dev, connector->encoder_ids[0]);
+       return drm_encoder_find(connector->dev, NULL, connector->encoder_ids[0]);
 }
 EXPORT_SYMBOL(drm_atomic_helper_best_encoder);
 
index fe0982708e9528cdaaaca6cd1e1996558c4a0806..0d002b045bd26f4d1a19c515c406b5d330f52fdf 100644 (file)
@@ -230,7 +230,7 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev,
        if (!drm_core_check_feature(dev, DRIVER_MODESET))
                return -EINVAL;
 
-       crtc = drm_crtc_find(dev, crtc_lut->crtc_id);
+       crtc = drm_crtc_find(dev, file_priv, crtc_lut->crtc_id);
        if (!crtc)
                return -ENOENT;
 
@@ -308,7 +308,7 @@ int drm_mode_gamma_get_ioctl(struct drm_device *dev,
        if (!drm_core_check_feature(dev, DRIVER_MODESET))
                return -EINVAL;
 
-       crtc = drm_crtc_find(dev, crtc_lut->crtc_id);
+       crtc = drm_crtc_find(dev, file_priv, crtc_lut->crtc_id);
        if (!crtc)
                return -ENOENT;
 
index d8ca526ca4eebc775f8736e7154682a4eca6c573..704fc893461629d71955e513f61c9e34c2f2a057 100644 (file)
@@ -1310,7 +1310,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
 
        memset(&u_mode, 0, sizeof(struct drm_mode_modeinfo));
 
-       connector = drm_connector_lookup(dev, out_resp->connector_id);
+       connector = drm_connector_lookup(dev, file_priv, out_resp->connector_id);
        if (!connector)
                return -ENOENT;
 
index 68b4e976d5e0f37fca1ac42a2d2b469c64c73e4b..f0556e654116760a754dae15ad53b65338ade433 100644 (file)
@@ -402,7 +402,7 @@ int drm_mode_getcrtc(struct drm_device *dev,
        if (!drm_core_check_feature(dev, DRIVER_MODESET))
                return -EINVAL;
 
-       crtc = drm_crtc_find(dev, crtc_resp->crtc_id);
+       crtc = drm_crtc_find(dev, file_priv, crtc_resp->crtc_id);
        if (!crtc)
                return -ENOENT;
 
@@ -569,7 +569,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
        if (crtc_req->x & 0xffff0000 || crtc_req->y & 0xffff0000)
                return -ERANGE;
 
-       crtc = drm_crtc_find(dev, crtc_req->crtc_id);
+       crtc = drm_crtc_find(dev, file_priv, crtc_req->crtc_id);
        if (!crtc) {
                DRM_DEBUG_KMS("Unknown CRTC ID %d\n", crtc_req->crtc_id);
                return -ENOENT;
@@ -595,7 +595,7 @@ retry:
                        /* Make refcounting symmetric with the lookup path. */
                        drm_framebuffer_get(fb);
                } else {
-                       fb = drm_framebuffer_lookup(dev, crtc_req->fb_id);
+                       fb = drm_framebuffer_lookup(dev, file_priv, crtc_req->fb_id);
                        if (!fb) {
                                DRM_DEBUG_KMS("Unknown FB ID%d\n",
                                                crtc_req->fb_id);
@@ -680,7 +680,7 @@ retry:
                                goto out;
                        }
 
-                       connector = drm_connector_lookup(dev, out_id);
+                       connector = drm_connector_lookup(dev, file_priv, out_id);
                        if (!connector) {
                                DRM_DEBUG_KMS("Connector id %d unknown\n",
                                                out_id);
index a43582076b20b9283fa02f44abf1bc97f4e7395d..9ebb8841778cc99095a2235ab8b1d89f654816f2 100644 (file)
@@ -106,6 +106,7 @@ int drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj,
 void drm_mode_object_register(struct drm_device *dev,
                              struct drm_mode_object *obj);
 struct drm_mode_object *__drm_mode_object_find(struct drm_device *dev,
+                                              struct drm_file *file_priv,
                                               uint32_t id, uint32_t type);
 void drm_mode_object_unregister(struct drm_device *dev,
                                struct drm_mode_object *object);
index 0708779840d29ee2bdc9cfd1ec81fac58a9db0e7..43f644844b836ac746921b069407644d1114cd69 100644 (file)
@@ -220,7 +220,7 @@ int drm_mode_getencoder(struct drm_device *dev, void *data,
        if (!drm_core_check_feature(dev, DRIVER_MODESET))
                return -EINVAL;
 
-       encoder = drm_encoder_find(dev, enc_resp->encoder_id);
+       encoder = drm_encoder_find(dev, file_priv, enc_resp->encoder_id);
        if (!encoder)
                return -ENOENT;
 
index af279844d7ceb69d44ec9bf260ea63d9435b6de4..2affe53f3fda80e5e901e51949ead238e0a8a3f8 100644 (file)
@@ -381,7 +381,7 @@ int drm_mode_rmfb(struct drm_device *dev,
        if (!drm_core_check_feature(dev, DRIVER_MODESET))
                return -EINVAL;
 
-       fb = drm_framebuffer_lookup(dev, *id);
+       fb = drm_framebuffer_lookup(dev, file_priv, *id);
        if (!fb)
                return -ENOENT;
 
@@ -450,7 +450,7 @@ int drm_mode_getfb(struct drm_device *dev,
        if (!drm_core_check_feature(dev, DRIVER_MODESET))
                return -EINVAL;
 
-       fb = drm_framebuffer_lookup(dev, r->fb_id);
+       fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id);
        if (!fb)
                return -ENOENT;
 
@@ -515,7 +515,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
        if (!drm_core_check_feature(dev, DRIVER_MODESET))
                return -EINVAL;
 
-       fb = drm_framebuffer_lookup(dev, r->fb_id);
+       fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id);
        if (!fb)
                return -ENOENT;
 
@@ -688,12 +688,13 @@ EXPORT_SYMBOL(drm_framebuffer_init);
  * again, using drm_framebuffer_put().
  */
 struct drm_framebuffer *drm_framebuffer_lookup(struct drm_device *dev,
+                                              struct drm_file *file_priv,
                                               uint32_t id)
 {
        struct drm_mode_object *obj;
        struct drm_framebuffer *fb = NULL;
 
-       obj = __drm_mode_object_find(dev, id, DRM_MODE_OBJECT_FB);
+       obj = __drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_FB);
        if (obj)
                fb = obj_to_fb(obj);
        return fb;
index 7a1ea91d3343cfc13531b9dfd1e290db0490edda..240a05d91a5386a5a21de1c5a9f8faaba14be620 100644 (file)
@@ -105,6 +105,7 @@ void drm_mode_object_unregister(struct drm_device *dev,
 }
 
 struct drm_mode_object *__drm_mode_object_find(struct drm_device *dev,
+                                              struct drm_file *file_priv,
                                               uint32_t id, uint32_t type)
 {
        struct drm_mode_object *obj = NULL;
@@ -127,7 +128,7 @@ struct drm_mode_object *__drm_mode_object_find(struct drm_device *dev,
 
 /**
  * drm_mode_object_find - look up a drm object with static lifetime
- * @dev: drm device
+ * @file_priv: drm file
  * @id: id of the mode object
  * @type: type of the mode object
  *
@@ -136,11 +137,12 @@ struct drm_mode_object *__drm_mode_object_find(struct drm_device *dev,
  * by callind drm_mode_object_put().
  */
 struct drm_mode_object *drm_mode_object_find(struct drm_device *dev,
+               struct drm_file *file_priv,
                uint32_t id, uint32_t type)
 {
        struct drm_mode_object *obj = NULL;
 
-       obj = __drm_mode_object_find(dev, id, type);
+       obj = __drm_mode_object_find(dev, file_priv, id, type);
        return obj;
 }
 EXPORT_SYMBOL(drm_mode_object_find);
@@ -359,7 +361,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
 
        drm_modeset_lock_all(dev);
 
-       obj = drm_mode_object_find(dev, arg->obj_id, arg->obj_type);
+       obj = drm_mode_object_find(dev, file_priv, arg->obj_id, arg->obj_type);
        if (!obj) {
                ret = -ENOENT;
                goto out;
@@ -481,7 +483,7 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
        if (!drm_core_check_feature(dev, DRIVER_MODESET))
                return -EINVAL;
 
-       arg_obj = drm_mode_object_find(dev, arg->obj_id, arg->obj_type);
+       arg_obj = drm_mode_object_find(dev, file_priv, arg->obj_id, arg->obj_type);
        if (!arg_obj)
                return -ENOENT;
 
index 72cba9805edcd939071a43952cfc49a546aed945..6af02c7b5da395e49de6dd06584da6534a94f43b 100644 (file)
@@ -513,7 +513,7 @@ int drm_mode_getplane(struct drm_device *dev, void *data,
        if (!drm_core_check_feature(dev, DRIVER_MODESET))
                return -EINVAL;
 
-       plane = drm_plane_find(dev, plane_resp->plane_id);
+       plane = drm_plane_find(dev, file_priv, plane_resp->plane_id);
        if (!plane)
                return -ENOENT;
 
@@ -703,7 +703,7 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
         * First, find the plane, crtc, and fb objects.  If not available,
         * we don't bother to call the driver.
         */
-       plane = drm_plane_find(dev, plane_req->plane_id);
+       plane = drm_plane_find(dev, file_priv, plane_req->plane_id);
        if (!plane) {
                DRM_DEBUG_KMS("Unknown plane ID %d\n",
                              plane_req->plane_id);
@@ -711,14 +711,14 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
        }
 
        if (plane_req->fb_id) {
-               fb = drm_framebuffer_lookup(dev, plane_req->fb_id);
+               fb = drm_framebuffer_lookup(dev, file_priv, plane_req->fb_id);
                if (!fb) {
                        DRM_DEBUG_KMS("Unknown framebuffer ID %d\n",
                                      plane_req->fb_id);
                        return -ENOENT;
                }
 
-               crtc = drm_crtc_find(dev, plane_req->crtc_id);
+               crtc = drm_crtc_find(dev, file_priv, plane_req->crtc_id);
                if (!crtc) {
                        drm_framebuffer_put(fb);
                        DRM_DEBUG_KMS("Unknown crtc ID %d\n",
@@ -829,7 +829,7 @@ static int drm_mode_cursor_common(struct drm_device *dev,
        if (!req->flags || (~DRM_MODE_CURSOR_FLAGS & req->flags))
                return -EINVAL;
 
-       crtc = drm_crtc_find(dev, req->crtc_id);
+       crtc = drm_crtc_find(dev, file_priv, req->crtc_id);
        if (!crtc) {
                DRM_DEBUG_KMS("Unknown CRTC ID %d\n", req->crtc_id);
                return -ENOENT;
@@ -944,7 +944,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
        if ((page_flip->flags & DRM_MODE_PAGE_FLIP_ASYNC) && !dev->mode_config.async_page_flip)
                return -EINVAL;
 
-       crtc = drm_crtc_find(dev, page_flip->crtc_id);
+       crtc = drm_crtc_find(dev, file_priv, page_flip->crtc_id);
        if (!crtc)
                return -ENOENT;
 
@@ -1005,7 +1005,7 @@ retry:
                goto out;
        }
 
-       fb = drm_framebuffer_lookup(dev, page_flip->fb_id);
+       fb = drm_framebuffer_lookup(dev, file_priv, page_flip->fb_id);
        if (!fb) {
                ret = -ENOENT;
                goto out;
index 5840aabbf24e51611cb825ab6fc8b017a6ce6701..6dc2dde5b67202d43ad17438c8feb84eda010f41 100644 (file)
@@ -99,7 +99,7 @@ drm_mode_validate_pipeline(struct drm_display_mode *mode,
 
        /* Step 2: Validate against encoders and crtcs */
        for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
-               struct drm_encoder *encoder = drm_encoder_find(dev, ids[i]);
+               struct drm_encoder *encoder = drm_encoder_find(dev, NULL, ids[i]);
                struct drm_crtc *crtc;
 
                if (!encoder)
index bc5128203056d08e1bf8ec806b401d7a3de90727..bae50e6b819df77b9c0c42e9b5a813821af157e7 100644 (file)
@@ -450,7 +450,7 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
        if (!drm_core_check_feature(dev, DRIVER_MODESET))
                return -EINVAL;
 
-       property = drm_property_find(dev, out_resp->prop_id);
+       property = drm_property_find(dev, file_priv, out_resp->prop_id);
        if (!property)
                return -ENOENT;
 
@@ -634,7 +634,7 @@ struct drm_property_blob *drm_property_lookup_blob(struct drm_device *dev,
        struct drm_mode_object *obj;
        struct drm_property_blob *blob = NULL;
 
-       obj = __drm_mode_object_find(dev, id, DRM_MODE_OBJECT_BLOB);
+       obj = __drm_mode_object_find(dev, NULL, id, DRM_MODE_OBJECT_BLOB);
        if (obj)
                blob = obj_to_blob(obj);
        return blob;
@@ -897,7 +897,7 @@ bool drm_property_change_valid_get(struct drm_property *property,
                if (value == 0)
                        return true;
 
-               *ref = __drm_mode_object_find(property->dev, value,
+               *ref = __drm_mode_object_find(property->dev, NULL, value,
                                              property->values[0]);
                return *ref != NULL;
        }
index ec4dd9df91500d279ce078dacfff95606761b10e..f4eba87c96f3847e72c890fb60e94a598c365a9a 100644 (file)
@@ -36,7 +36,7 @@ static int hibmc_connector_mode_valid(struct drm_connector *connector,
 static struct drm_encoder *
 hibmc_connector_best_encoder(struct drm_connector *connector)
 {
-       return drm_encoder_find(connector->dev, connector->encoder_ids[0]);
+       return drm_encoder_find(connector->dev, NULL, connector->encoder_ids[0]);
 }
 
 static const struct drm_connector_helper_funcs
index f780f39e0758c646dae633ce93306892c667f480..0bec6deaae4f585ee0ec8013aeda8bd7cfd6f8c8 100644 (file)
@@ -13511,7 +13511,7 @@ int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
        struct drm_crtc *drmmode_crtc;
        struct intel_crtc *crtc;
 
-       drmmode_crtc = drm_crtc_find(dev, pipe_from_crtc_id->crtc_id);
+       drmmode_crtc = drm_crtc_find(dev, file, pipe_from_crtc_id->crtc_id);
        if (!drmmode_crtc)
                return -ENOENT;
 
index aace22e7ccaced9165236fadd128cf3f1f58ce3c..1b397b41cb4fc17efad5aeeafab1d9e8c9cd05e9 100644 (file)
@@ -1134,7 +1134,7 @@ int intel_overlay_put_image_ioctl(struct drm_device *dev, void *data,
        if (!params)
                return -ENOMEM;
 
-       drmmode_crtc = drm_crtc_find(dev, put_image_rec->crtc_id);
+       drmmode_crtc = drm_crtc_find(dev, file_priv, put_image_rec->crtc_id);
        if (!drmmode_crtc) {
                ret = -ENOENT;
                goto out_free;
index b0d6e3e28d07d64699ef68f1d2c3846ff8697aa4..28a1209d87e2761203bef48dbbaa6fa298cbc277 100644 (file)
@@ -994,7 +994,7 @@ int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
            set->flags & I915_SET_COLORKEY_DESTINATION)
                return -EINVAL;
 
-       plane = drm_plane_find(dev, set->plane_id);
+       plane = drm_plane_find(dev, file_priv, set->plane_id);
        if (!plane || plane->type != DRM_PLANE_TYPE_OVERLAY)
                return -ENOENT;
 
index 5e9cd4c0e8b631be790148c1df05d9573f7068cf..68e5d9c94475e4b83b1408034062db8b653026b9 100644 (file)
@@ -1670,7 +1670,7 @@ static struct drm_encoder *mga_connector_best_encoder(struct drm_connector
        int enc_id = connector->encoder_ids[0];
        /* pick the encoder ids */
        if (enc_id)
-               return drm_encoder_find(connector->dev, enc_id);
+               return drm_encoder_find(connector->dev, NULL, enc_id);
        return NULL;
 }
 
index 70d8e0d69ad56df38ae504fa8f8779b6fc4af61b..69d6e61a01ecfb3e48d6ecaa7749b532227ec0bf 100644 (file)
@@ -373,7 +373,7 @@ find_encoder(struct drm_connector *connector, int type)
                if (!id)
                        break;
 
-               enc = drm_encoder_find(dev, id);
+               enc = drm_encoder_find(dev, NULL, id);
                if (!enc)
                        continue;
                nv_encoder = nouveau_encoder(enc);
@@ -441,7 +441,7 @@ nouveau_connector_ddc_detect(struct drm_connector *connector)
                if (id == 0)
                        break;
 
-               encoder = drm_encoder_find(dev, id);
+               encoder = drm_encoder_find(dev, NULL, id);
                if (!encoder)
                        continue;
                nv_encoder = nouveau_encoder(encoder);
index c31e660e35db1b6e5ee98ce036d1484c323aa141..7d39ed63e5be755e7d3de41899b46663086bf52b 100644 (file)
@@ -1456,7 +1456,7 @@ int r100_cs_packet_parse_vline(struct radeon_cs_parser *p)
        header = radeon_get_ib_value(p, h_idx);
        crtc_id = radeon_get_ib_value(p, h_idx + 5);
        reg = R100_CP_PACKET0_GET_REG(header);
-       crtc = drm_crtc_find(p->rdev->ddev, crtc_id);
+       crtc = drm_crtc_find(p->rdev->ddev, p->filp, crtc_id);
        if (!crtc) {
                DRM_ERROR("cannot find crtc %d\n", crtc_id);
                return -ENOENT;
index 97fd58e9704308a04c590c240a851f91b189f251..c96b31950ca7cb4d6351cc16d6d1454f13e8e227 100644 (file)
@@ -887,7 +887,7 @@ int r600_cs_common_vline_parse(struct radeon_cs_parser *p,
        crtc_id = radeon_get_ib_value(p, h_idx + 2 + 7 + 1);
        reg = R600_CP_PACKET0_GET_REG(header);
 
-       crtc = drm_crtc_find(p->rdev->ddev, crtc_id);
+       crtc = drm_crtc_find(p->rdev->ddev, p->filp, crtc_id);
        if (!crtc) {
                DRM_ERROR("cannot find crtc %d\n", crtc_id);
                return -ENOENT;
index 2f642cbefd8eaa2223205f99bdac474d658a076c..59dcefb2df3bce8b6b914fce5d40d8b064c218e7 100644 (file)
@@ -263,7 +263,7 @@ radeon_connector_update_scratch_regs(struct drm_connector *connector, enum drm_c
                if (connector->encoder_ids[i] == 0)
                        break;
 
-               encoder = drm_encoder_find(connector->dev,
+               encoder = drm_encoder_find(connector->dev, NULL,
                                           connector->encoder_ids[i]);
                if (!encoder)
                        continue;
@@ -290,7 +290,7 @@ static struct drm_encoder *radeon_find_encoder(struct drm_connector *connector,
                if (connector->encoder_ids[i] == 0)
                        break;
 
-               encoder = drm_encoder_find(connector->dev, connector->encoder_ids[i]);
+               encoder = drm_encoder_find(connector->dev, NULL, connector->encoder_ids[i]);
                if (!encoder)
                        continue;
 
@@ -404,7 +404,7 @@ static struct drm_encoder *radeon_best_single_encoder(struct drm_connector *conn
        int enc_id = connector->encoder_ids[0];
        /* pick the encoder ids */
        if (enc_id)
-               return drm_encoder_find(connector->dev, enc_id);
+               return drm_encoder_find(connector->dev, NULL, enc_id);
        return NULL;
 }
 
@@ -1368,7 +1368,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
                        if (connector->encoder_ids[i] == 0)
                                break;
 
-                       encoder = drm_encoder_find(connector->dev,
+                       encoder = drm_encoder_find(connector->dev, NULL,
                                                   connector->encoder_ids[i]);
                        if (!encoder)
                                continue;
@@ -1454,7 +1454,7 @@ static struct drm_encoder *radeon_dvi_encoder(struct drm_connector *connector)
                if (connector->encoder_ids[i] == 0)
                        break;
 
-               encoder = drm_encoder_find(connector->dev, connector->encoder_ids[i]);
+               encoder = drm_encoder_find(connector->dev, NULL, connector->encoder_ids[i]);
                if (!encoder)
                        continue;
 
@@ -1473,7 +1473,7 @@ static struct drm_encoder *radeon_dvi_encoder(struct drm_connector *connector)
        /* then check use digitial */
        /* pick the first one */
        if (enc_id)
-               return drm_encoder_find(connector->dev, enc_id);
+               return drm_encoder_find(connector->dev, NULL, enc_id);
        return NULL;
 }
 
@@ -1620,7 +1620,7 @@ u16 radeon_connector_encoder_get_dp_bridge_encoder_id(struct drm_connector *conn
                if (connector->encoder_ids[i] == 0)
                        break;
 
-               encoder = drm_encoder_find(connector->dev, connector->encoder_ids[i]);
+               encoder = drm_encoder_find(connector->dev, NULL, connector->encoder_ids[i]);
                if (!encoder)
                        continue;
 
@@ -1649,7 +1649,7 @@ static bool radeon_connector_encoder_is_hbr2(struct drm_connector *connector)
                if (connector->encoder_ids[i] == 0)
                        break;
 
-               encoder = drm_encoder_find(connector->dev, connector->encoder_ids[i]);
+               encoder = drm_encoder_find(connector->dev, NULL, connector->encoder_ids[i]);
                if (!encoder)
                        continue;
 
index 9f9a49748d176c7e8b53833968daded5ea646631..091ca81658eba144daae145a5ea5b72ce929316b 100644 (file)
@@ -105,7 +105,7 @@ static struct drm_encoder*
 udl_best_single_encoder(struct drm_connector *connector)
 {
        int enc_id = connector->encoder_ids[0];
-       return drm_encoder_find(connector->dev, enc_id);
+       return drm_encoder_find(connector->dev, NULL, enc_id);
 }
 
 static int udl_connector_set_property(struct drm_connector *connector,
index 5ec24fd801cd2bb1b32b66540b91edcca2ef3b6d..01be355525e4deff03b6b96199dff7460d6b3cf2 100644 (file)
@@ -286,7 +286,7 @@ int vmw_present_ioctl(struct drm_device *dev, void *data,
 
        drm_modeset_lock_all(dev);
 
-       fb = drm_framebuffer_lookup(dev, arg->fb_id);
+       fb = drm_framebuffer_lookup(dev, file_priv, arg->fb_id);
        if (!fb) {
                DRM_ERROR("Invalid framebuffer id.\n");
                ret = -ENOENT;
@@ -369,7 +369,7 @@ int vmw_present_readback_ioctl(struct drm_device *dev, void *data,
 
        drm_modeset_lock_all(dev);
 
-       fb = drm_framebuffer_lookup(dev, arg->fb_id);
+       fb = drm_framebuffer_lookup(dev, file_priv, arg->fb_id);
        if (!fb) {
                DRM_ERROR("Invalid framebuffer id.\n");
                ret = -ENOENT;
index b850562fbdd657f489632dceb467597f4a63b84c..0545740b3724f1d6c28b9e1dd169351fdd723949 100644 (file)
@@ -1726,7 +1726,7 @@ int vmw_kms_cursor_bypass_ioctl(struct drm_device *dev, void *data,
                return 0;
        }
 
-       crtc = drm_crtc_find(dev, arg->crtc_id);
+       crtc = drm_crtc_find(dev, file_priv, arg->crtc_id);
        if (!crtc) {
                ret = -ENOENT;
                goto out;
index 257a778304107240763b338eeaee07b45c4cf700..c745a0402c6896e2d75b135bfdacfb45e0eaccbd 100644 (file)
@@ -377,7 +377,7 @@ static struct drm_encoder *vbox_best_single_encoder(struct drm_connector
 
        /* pick the encoder ids */
        if (enc_id)
-               return drm_encoder_find(connector->dev, enc_id);
+               return drm_encoder_find(connector->dev, NULL, enc_id);
 
        return NULL;
 }
index b34904dc8b9beb5ca068b6ebd63ae4cb03a97665..b4285c40e1e45bc76ec6fb83fd9f1a0c9be94463 100644 (file)
@@ -939,10 +939,11 @@ static inline unsigned drm_connector_index(struct drm_connector *connector)
  * add takes a reference to it.
  */
 static inline struct drm_connector *drm_connector_lookup(struct drm_device *dev,
+               struct drm_file *file_priv,
                uint32_t id)
 {
        struct drm_mode_object *mo;
-       mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_CONNECTOR);
+       mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_CONNECTOR);
        return mo ? obj_to_connector(mo) : NULL;
 }
 
index 80c97210eda55c040617378e3937ab4fa6522099..f7fcceef46d96978fdba9b92fabe4b14fad456d4 100644 (file)
@@ -959,10 +959,11 @@ struct drm_crtc *drm_crtc_from_index(struct drm_device *dev, int idx);
  * userspace interface should be done using &drm_property.
  */
 static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
-       uint32_t id)
+               struct drm_file *file_priv,
+               uint32_t id)
 {
        struct drm_mode_object *mo;
-       mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_CRTC);
+       mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_CRTC);
        return mo ? obj_to_crtc(mo) : NULL;
 }
 
index 8d8245ec0181d043324f86ea15b22a63ce12c227..86db0da8bdcb43ff9878ffb25adbc44aa9166304 100644 (file)
@@ -214,11 +214,12 @@ static inline bool drm_encoder_crtc_ok(struct drm_encoder *encoder,
  * drm_mode_object_find().
  */
 static inline struct drm_encoder *drm_encoder_find(struct drm_device *dev,
+                                                  struct drm_file *file_priv,
                                                   uint32_t id)
 {
        struct drm_mode_object *mo;
 
-       mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_ENCODER);
+       mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_ENCODER);
 
        return mo ? obj_to_encoder(mo) : NULL;
 }
index b6996ddb19d6e8831d74aac16d6be98d6c72bdff..4c5ee4ae54dfa73dc4ae47d65a4913254c892d73 100644 (file)
@@ -205,6 +205,7 @@ int drm_framebuffer_init(struct drm_device *dev,
                         struct drm_framebuffer *fb,
                         const struct drm_framebuffer_funcs *funcs);
 struct drm_framebuffer *drm_framebuffer_lookup(struct drm_device *dev,
+                                              struct drm_file *file_priv,
                                               uint32_t id);
 void drm_framebuffer_remove(struct drm_framebuffer *fb);
 void drm_framebuffer_cleanup(struct drm_framebuffer *fb);
index a767b4a30a6d37704c136c862eabee5417550bb7..b2f920b518e3f0ba967e0d8e93c8b2b3abe59db3 100644 (file)
@@ -27,6 +27,7 @@
 struct drm_object_properties;
 struct drm_property;
 struct drm_device;
+struct drm_file;
 
 /**
  * struct drm_mode_object - base structure for modeset objects
@@ -113,6 +114,7 @@ struct drm_object_properties {
        }
 
 struct drm_mode_object *drm_mode_object_find(struct drm_device *dev,
+                                            struct drm_file *file_priv,
                                             uint32_t id, uint32_t type);
 void drm_mode_object_get(struct drm_mode_object *obj);
 void drm_mode_object_put(struct drm_mode_object *obj);
index 82a217bd77f05a8014f364b0e434ea486e665b61..069c4c8ce360526390e9a2befcf47a48ff402adc 100644 (file)
@@ -597,10 +597,11 @@ int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
  * drm_mode_object_find().
  */
 static inline struct drm_plane *drm_plane_find(struct drm_device *dev,
+               struct drm_file *file_priv,
                uint32_t id)
 {
        struct drm_mode_object *mo;
-       mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PLANE);
+       mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_PLANE);
        return mo ? obj_to_plane(mo) : NULL;
 }
 
index 37355c623e6c32888b2f7b2defabc8f023e7bcc4..429d8218f740d3b707cd3f992d8092d4ce8626e8 100644 (file)
@@ -312,10 +312,11 @@ drm_property_unreference_blob(struct drm_property_blob *blob)
  * This function looks up the property object specified by id and returns it.
  */
 static inline struct drm_property *drm_property_find(struct drm_device *dev,
+                                                    struct drm_file *file_priv,
                                                     uint32_t id)
 {
        struct drm_mode_object *mo;
-       mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PROPERTY);
+       mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_PROPERTY);
        return mo ? obj_to_property(mo) : NULL;
 }