Ignore:
Timestamp:
Apr 14, 2017, 9:41:36 PM (2 months ago)
Author:
brainslayer
Message:

kernel update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/linux/universal/linux-4.4/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c

    r28606 r31859  
    540540{
    541541        struct vmw_fence_obj *fence;
    542         int ret;
     542        int ret;
    543543
    544544        fence = kzalloc(sizeof(*fence), GFP_KERNEL);
     
    703703
    704704
     705/**
     706 * vmw_fence_obj_lookup - Look up a user-space fence object
     707 *
     708 * @tfile: A struct ttm_object_file identifying the caller.
     709 * @handle: A handle identifying the fence object.
     710 * @return: A struct vmw_user_fence base ttm object on success or
     711 * an error pointer on failure.
     712 *
     713 * The fence object is looked up and type-checked. The caller needs
     714 * to have opened the fence object first, but since that happens on
     715 * creation and fence objects aren't shareable, that's not an
     716 * issue currently.
     717 */
     718static struct ttm_base_object *
     719vmw_fence_obj_lookup(struct ttm_object_file *tfile, u32 handle)
     720{
     721        struct ttm_base_object *base = ttm_base_object_lookup(tfile, handle);
     722
     723        if (!base) {
     724                pr_err("Invalid fence object handle 0x%08lx.\n",
     725                       (unsigned long)handle);
     726                return ERR_PTR(-EINVAL);
     727        }
     728
     729        if (base->refcount_release != vmw_user_fence_base_release) {
     730                pr_err("Invalid fence object handle 0x%08lx.\n",
     731                       (unsigned long)handle);
     732                ttm_base_object_unref(&base);
     733                return ERR_PTR(-EINVAL);
     734        }
     735
     736        return base;
     737}
     738
     739
    705740int vmw_fence_obj_wait_ioctl(struct drm_device *dev, void *data,
    706741                             struct drm_file *file_priv)
     
    728763        }
    729764
    730         base = ttm_base_object_lookup(tfile, arg->handle);
    731         if (unlikely(base == NULL)) {
    732                 printk(KERN_ERR "Wait invalid fence object handle "
    733                        "0x%08lx.\n",
    734                        (unsigned long)arg->handle);
    735                 return -EINVAL;
    736         }
     765        base = vmw_fence_obj_lookup(tfile, arg->handle);
     766        if (IS_ERR(base))
     767                return PTR_ERR(base);
    737768
    738769        fence = &(container_of(base, struct vmw_user_fence, base)->fence);
     
    773804        struct vmw_private *dev_priv = vmw_priv(dev);
    774805
    775         base = ttm_base_object_lookup(tfile, arg->handle);
    776         if (unlikely(base == NULL)) {
    777                 printk(KERN_ERR "Fence signaled invalid fence object handle "
    778                        "0x%08lx.\n",
    779                        (unsigned long)arg->handle);
    780                 return -EINVAL;
    781         }
     806        base = vmw_fence_obj_lookup(tfile, arg->handle);
     807        if (IS_ERR(base))
     808                return PTR_ERR(base);
    782809
    783810        fence = &(container_of(base, struct vmw_user_fence, base)->fence);
     
    10941121        struct vmw_fence_obj *fence = NULL;
    10951122        struct vmw_fpriv *vmw_fp = vmw_fpriv(file_priv);
     1123        struct ttm_object_file *tfile = vmw_fp->tfile;
    10961124        struct drm_vmw_fence_rep __user *user_fence_rep =
    10971125                (struct drm_vmw_fence_rep __user *)(unsigned long)
     
    11071135        if (arg->handle) {
    11081136                struct ttm_base_object *base =
    1109                         ttm_base_object_lookup_for_ref(dev_priv->tdev,
    1110                                                        arg->handle);
    1111 
    1112                 if (unlikely(base == NULL)) {
    1113                         DRM_ERROR("Fence event invalid fence object handle "
    1114                                   "0x%08lx.\n",
    1115                                   (unsigned long)arg->handle);
    1116                         return -EINVAL;
    1117                 }
     1137                        vmw_fence_obj_lookup(tfile, arg->handle);
     1138
     1139                if (IS_ERR(base))
     1140                        return PTR_ERR(base);
     1141
    11181142                fence = &(container_of(base, struct vmw_user_fence,
    11191143                                       base)->fence);
     
    11211145
    11221146                if (user_fence_rep != NULL) {
    1123                         bool existed;
    1124 
    11251147                        ret = ttm_ref_object_add(vmw_fp->tfile, base,
    1126                                                  TTM_REF_USAGE, &existed);
     1148                                                 TTM_REF_USAGE, NULL, false);
    11271149                        if (unlikely(ret != 0)) {
    11281150                                DRM_ERROR("Failed to reference a fence "
     
    11671189out_no_create:
    11681190        if (user_fence_rep != NULL)
    1169                 ttm_ref_object_base_unref(vmw_fpriv(file_priv)->tfile,
    1170                                           handle, TTM_REF_USAGE);
     1191                ttm_ref_object_base_unref(tfile, handle, TTM_REF_USAGE);
    11711192out_no_ref_obj:
    11721193        vmw_fence_obj_unreference(&fence);
Note: See TracChangeset for help on using the changeset viewer.