All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cheng, Yao" <yao.cheng@intel.com>
To: "intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"daniel.vetter@ffwll.ch" <daniel.vetter@ffwll.ch>,
	"Kelley, Sean V" <sean.v.kelley@intel.com>,
	"Chehab, John" <john.chehab@intel.com>
Cc: "emil.l.velikov@gmail.com" <emil.l.velikov@gmail.com>,
	"Jiang, Fei" <fei.jiang@intel.com>
Subject: RE: [RFC PATCH v3 2/4] drm/ipvr: drm driver for VED
Date: Wed, 26 Nov 2014 16:50:33 +0000	[thread overview]
Message-ID: <8FF7D634BEE4C2428EFFAB6B7E919E4B018313F7@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1416596818-5651-3-git-send-email-yao.cheng@intel.com>

> -----Original Message-----
> From: Cheng, Yao
> Sent: Saturday, November 22, 2014 3:07
> To: intel-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org;
> daniel.vetter@ffwll.ch; Kelley, Sean V; Chehab, John
> Cc: Jiang, Fei; dh.herrmann@gmail.com; jani.nikula@linux.intel.com;
> emil.l.velikov@gmail.com; ville.syrjala@linux.intel.com;
> jbarnes@virtuousgeek.org; daniel@fooishbar.org; 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@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2014-11-26 16:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-21 19:06 [RFC PATCH v3 0/4] drm driver for VED in Intel GPU Yao Cheng
2014-11-21 19:06 ` [RFC PATCH v3 1/4] drm/i915: add i915_ved.c to setup bridge for VED Yao Cheng
2014-11-28 16:59   ` Robert Beckett
2014-12-01  3:04     ` Cheng, Yao
2014-12-01  8:32       ` [Intel-gfx] " Daniel Vetter
2014-11-21 19:06 ` [RFC PATCH v3 2/4] drm/ipvr: drm driver " Yao Cheng
2014-11-23 13:29   ` Cheng, Yao
2014-11-26 16:50   ` Cheng, Yao [this message]
2014-11-27 11:49   ` Cheng, Yao
2014-12-01  3:09     ` Cheng, Yao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8FF7D634BEE4C2428EFFAB6B7E919E4B018313F7@shsmsx102.ccr.corp.intel.com \
    --to=yao.cheng@intel.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.l.velikov@gmail.com \
    --cc=fei.jiang@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=john.chehab@intel.com \
    --cc=sean.v.kelley@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.