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.9/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c

    r31574 r31859  
    539539{
    540540        struct vmw_fence_obj *fence;
    541         int ret;
     541        int ret;
    542542
    543543        fence = kzalloc(sizeof(*fence), GFP_KERNEL);
     
    702702
    703703
     704/**
     705 * vmw_fence_obj_lookup - Look up a user-space fence object
     706 *
     707 * @tfile: A struct ttm_object_file identifying the caller.
     708 * @handle: A handle identifying the fence object.
     709 * @return: A struct vmw_user_fence base ttm object on success or
     710 * an error pointer on failure.
     711 *
     712 * The fence object is looked up and type-checked. The caller needs
     713 * to have opened the fence object first, but since that happens on
     714 * creation and fence objects aren't shareable, that's not an
     715 * issue currently.
     716 */
     717static struct ttm_base_object *
     718vmw_fence_obj_lookup(struct ttm_object_file *tfile, u32 handle)
     719{
     720        struct ttm_base_object *base = ttm_base_object_lookup(tfile, handle);
     721
     722        if (!base) {
     723                pr_err("Invalid fence object handle 0x%08lx.\n",
     724                       (unsigned long)handle);
     725                return ERR_PTR(-EINVAL);
     726        }
     727
     728        if (base->refcount_release != vmw_user_fence_base_release) {
     729                pr_err("Invalid fence object handle 0x%08lx.\n",
     730                       (unsigned long)handle);
     731                ttm_base_object_unref(&base);
     732                return ERR_PTR(-EINVAL);
     733        }
     734
     735        return base;
     736}
     737
     738
    704739int vmw_fence_obj_wait_ioctl(struct drm_device *dev, void *data,
    705740                             struct drm_file *file_priv)
     
    727762        }
    728763
    729         base = ttm_base_object_lookup(tfile, arg->handle);
    730         if (unlikely(base == NULL)) {
    731                 printk(KERN_ERR "Wait invalid fence object handle "
    732                        "0x%08lx.\n",
    733                        (unsigned long)arg->handle);
    734                 return -EINVAL;
    735         }
     764        base = vmw_fence_obj_lookup(tfile, arg->handle);
     765        if (IS_ERR(base))
     766                return PTR_ERR(base);
    736767
    737768        fence = &(container_of(base, struct vmw_user_fence, base)->fence);
     
    772803        struct vmw_private *dev_priv = vmw_priv(dev);
    773804
    774         base = ttm_base_object_lookup(tfile, arg->handle);
    775         if (unlikely(base == NULL)) {
    776                 printk(KERN_ERR "Fence signaled invalid fence object handle "
    777                        "0x%08lx.\n",
    778                        (unsigned long)arg->handle);
    779                 return -EINVAL;
    780         }
     805        base = vmw_fence_obj_lookup(tfile, arg->handle);
     806        if (IS_ERR(base))
     807                return PTR_ERR(base);
    781808
    782809        fence = &(container_of(base, struct vmw_user_fence, base)->fence);
     
    10251052        struct vmw_fence_obj *fence = NULL;
    10261053        struct vmw_fpriv *vmw_fp = vmw_fpriv(file_priv);
     1054        struct ttm_object_file *tfile = vmw_fp->tfile;
    10271055        struct drm_vmw_fence_rep __user *user_fence_rep =
    10281056                (struct drm_vmw_fence_rep __user *)(unsigned long)
     
    10381066        if (arg->handle) {
    10391067                struct ttm_base_object *base =
    1040                         ttm_base_object_lookup_for_ref(dev_priv->tdev,
    1041                                                        arg->handle);
    1042 
    1043                 if (unlikely(base == NULL)) {
    1044                         DRM_ERROR("Fence event invalid fence object handle "
    1045                                   "0x%08lx.\n",
    1046                                   (unsigned long)arg->handle);
    1047                         return -EINVAL;
    1048                 }
     1068                        vmw_fence_obj_lookup(tfile, arg->handle);
     1069
     1070                if (IS_ERR(base))
     1071                        return PTR_ERR(base);
     1072
    10491073                fence = &(container_of(base, struct vmw_user_fence,
    10501074                                       base)->fence);
     
    10521076
    10531077                if (user_fence_rep != NULL) {
    1054                         bool existed;
    1055 
    10561078                        ret = ttm_ref_object_add(vmw_fp->tfile, base,
    1057                                                  TTM_REF_USAGE, &existed);
     1079                                                 TTM_REF_USAGE, NULL, false);
    10581080                        if (unlikely(ret != 0)) {
    10591081                                DRM_ERROR("Failed to reference a fence "
     
    10981120out_no_create:
    10991121        if (user_fence_rep != NULL)
    1100                 ttm_ref_object_base_unref(vmw_fpriv(file_priv)->tfile,
    1101                                           handle, TTM_REF_USAGE);
     1122                ttm_ref_object_base_unref(tfile, handle, TTM_REF_USAGE);
    11021123out_no_ref_obj:
    11031124        vmw_fence_obj_unreference(&fence);
Note: See TracChangeset for help on using the changeset viewer.