RE: [RFC PATCH v3 2/4] drm/ipvr: drm driver for VED

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Cheng, Yao
> Sent: Saturday, November 22, 2014 3:07
> To: intel-gfx@xxxxxxxxxxxxxxxxxxxxx; dri-devel@xxxxxxxxxxxxxxxxxxxxx;
> daniel.vetter@xxxxxxxx; Kelley, Sean V; Chehab, John
> Cc: Jiang, Fei; dh.herrmann@xxxxxxxxx; jani.nikula@xxxxxxxxxxxxxxx;
> emil.l.velikov@xxxxxxxxx; ville.syrjala@xxxxxxxxxxxxxxx;
> jbarnes@xxxxxxxxxxxxxxxx; daniel@xxxxxxxxxxxxx; Cheng, Yao
> Subject: [RFC PATCH v3 2/4] drm/ipvr: drm driver for VED
> 
> +static void
> +ipvr_drm_preclose(struct drm_device *dev, struct drm_file *file_priv)
> +{
> +	/* if user didn't destory ctx explicitly, remove ctx here */
> +	struct drm_ipvr_private *dev_priv;
> +	struct drm_ipvr_file_private *ipvr_fpriv;
> +	struct ved_private *ved_priv;
> +	struct ipvr_context *ipvr_ctx  = NULL;
> +	unsigned long irq_flags;
> +
> +	IPVR_DEBUG_ENTRY("enter\n");
> +	dev_priv = dev->dev_private;
> +	ipvr_fpriv = file_priv->driver_priv;
> +	ved_priv = dev_priv->ved_private;
> +
> +	if (ipvr_fpriv->ctx_id == IPVR_CONTEXT_INVALID_ID)
> +		return;
> +	ipvr_ctx = (struct ipvr_context *)
> +			idr_find(&dev_priv->ipvr_ctx_idr, ipvr_fpriv->ctx_id);

Need protection on ipvr_ctx_idr. Same to the other idr related code.

> +	if (!ipvr_ctx  || (ipvr_ctx->ipvr_fpriv != ipvr_fpriv)) {
> +		IPVR_DEBUG_GENERAL("ctx for id %d has already
> destroyed\n",
> +				ipvr_fpriv->ctx_id);
> +		return;
> +	}
> +
> +	/**
> +	 * fixme: remove this work-around (WA the issue that calling
> +	 * close() with queued cmd might cause state machine issue).
> +	 * we should wait for only the cmds sent from contexts in this file
> +	 * instead of all cmds
> +	 */
> +	ipvr_fence_wait_empty_locked(dev_priv);
> +
> +	IPVR_DEBUG_PM("Video:remove context type 0x%x\n", ipvr_ctx-
> >ctx_type);
> +	mutex_lock(&ved_priv->ved_mutex);
> +	if (ved_priv->ipvr_ctx == ipvr_ctx )
> +		ved_priv->ipvr_ctx = NULL;
> +	mutex_unlock(&ved_priv->ved_mutex);
> +
> +	spin_lock_irqsave(&dev_priv->ipvr_ctx_lock, irq_flags);
> +	list_del(&ipvr_ctx->head);
> +	ipvr_fpriv->ctx_id = IPVR_CONTEXT_INVALID_ID;
> +	spin_unlock_irqrestore(&dev_priv->ipvr_ctx_lock, irq_flags);
> +
> +	idr_remove(&dev_priv->ipvr_ctx_idr, ipvr_ctx->ctx_id);
> +
> +	kfree(ipvr_ctx );
> +	kfree(ipvr_fpriv);
> +}


_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux