public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Singh, Gaurav K" <gaurav.k.singh@intel.com>
To: intel-gfx <intel-gfx@lists.freedesktop.org>
Cc: Shobhit Kumar <shobhit.kumar@intel.com>
Subject: Re: {Intel-gfx] [RFC 01/14] drm/i915: allocate gem memory for mipi dbi cmd buffer
Date: Fri, 19 Jun 2015 03:36:49 +0530	[thread overview]
Message-ID: <558340F9.7060808@intel.com> (raw)
In-Reply-To: <1434664936-20458-1-git-send-email-gaurav.k.singh@intel.com>



On 6/19/2015 3:32 AM, Gaurav K Singh wrote:
> Allocate gem memory for MIPI DBI command buffer. This memory
> will be used when sending command via DBI interface.
>
> v2: lock mutex before gem object unreference and later set gem obj ptr to NULL (Gaurav)
>
> Signed-off-by: Yogesh Mohan Marimuthu <yogesh.mohan.marimuthu@intel.com>
> Signed-off-by: Gaurav K Singh <gaurav.k.singh@intel.com>
> Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com>
> ---
>   drivers/gpu/drm/i915/intel_dsi.c |   40 ++++++++++++++++++++++++++++++++++++++
>   drivers/gpu/drm/i915/intel_dsi.h |    4 ++++
>   2 files changed, 44 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index 98998e9..011fef2 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -407,9 +407,35 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)
>   	enum pipe pipe = intel_crtc->pipe;
>   	enum port port;
>   	u32 tmp;
> +	int ret;
>   
>   	DRM_DEBUG_KMS("\n");
>   
> +	if (!intel_dsi->gem_obj && is_cmd_mode(intel_dsi)) {
> +		intel_dsi->gem_obj = i915_gem_alloc_object(dev, 4096);
> +		if (!intel_dsi->gem_obj) {
> +			DRM_ERROR("Failed to allocate seqno page\n");
> +			return;
> +		}
> +
> +		ret = i915_gem_object_set_cache_level(intel_dsi->gem_obj,
> +						      I915_CACHE_LLC);
> +		if (ret)
> +			goto err_unref;
> +
> +		ret = i915_gem_obj_ggtt_pin(intel_dsi->gem_obj, 4096, 0);
> +		if (ret) {
> +err_unref:
> +			drm_gem_object_unreference(&intel_dsi->gem_obj->base);
> +			return;
> +		}
> +
> +		intel_dsi->cmd_buff =
> +				kmap(sg_page(intel_dsi->gem_obj->pages->sgl));
> +		intel_dsi->cmd_buff_phy_addr = page_to_phys(
> +				sg_page(intel_dsi->gem_obj->pages->sgl));
> +	}
> +
>   	/* Disable DPOunit clock gating, can stall pipe
>   	 * and we need DPLL REFA always enabled */
>   	tmp = I915_READ(DPLL(pipe));
> @@ -555,6 +581,7 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder)
>   {
>   	struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
>   	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
> +	struct drm_device *dev = encoder->base.dev;
>   	u32 val;
>   
>   	DRM_DEBUG_KMS("\n");
> @@ -571,6 +598,15 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder)
>   
>   	msleep(intel_dsi->panel_off_delay);
>   	msleep(intel_dsi->panel_pwr_cycle_delay);
> +
> +	if (intel_dsi->gem_obj) {
> +		kunmap(intel_dsi->cmd_buff);
> +		i915_gem_object_ggtt_unpin(intel_dsi->gem_obj);
> +		mutex_lock(&dev->struct_mutex);
> +		drm_gem_object_unreference(&intel_dsi->gem_obj->base);
> +		mutex_unlock(&dev->struct_mutex);
> +	}
> +	intel_dsi->gem_obj = NULL;
>   }
>   
>   static bool intel_dsi_get_hw_state(struct intel_encoder *encoder,
> @@ -1042,6 +1078,10 @@ void intel_dsi_init(struct drm_device *dev)
>   		intel_dsi->ports = (1 << PORT_C);
>   	}
>   
> +	intel_dsi->cmd_buff = NULL;
> +	intel_dsi->cmd_buff_phy_addr = 0;
> +	intel_dsi->gem_obj = NULL;
> +
>   	/* Create a DSI host (and a device) for each port. */
>   	for_each_dsi_port(port, intel_dsi->ports) {
>   		struct intel_dsi_host *host;
> diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
> index 2784ac4..36ca3cc 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.h
> +++ b/drivers/gpu/drm/i915/intel_dsi.h
> @@ -44,6 +44,10 @@ struct intel_dsi {
>   
>   	struct intel_connector *attached_connector;
>   
> +	struct drm_i915_gem_object *gem_obj;
> +	void *cmd_buff;
> +	dma_addr_t cmd_buff_phy_addr;
> +
>   	/* bit mask of ports being driven */
>   	u16 ports;
>   
Corrected the initial patch. Working on the dma_alloc_coherent patch , 
will update soon.

With regards,
Gaurav
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-06-18 22:06 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-29 10:36 [RFC 00/14] DSI Command mode(DBI mode) enabling on CHT Gaurav K Singh
2015-05-29 10:36 ` [RFC 01/14] drm/i915: allocate gem memory for mipi dbi cmd buffer Gaurav K Singh
2015-05-29 10:59   ` Ville Syrjälä
2015-05-29 17:10     ` Daniel Vetter
2015-06-01 11:03       ` Ville Syrjälä
2015-06-15 10:30         ` Daniel Vetter
2015-06-16 17:08           ` Singh, Gaurav K
2015-06-18 22:02             ` {Intel-gfx] " Gaurav K Singh
2015-06-18 22:06               ` Singh, Gaurav K [this message]
2015-05-29 10:36 ` [RFC 02/14] drm/i915: Add support for TEAR ON Sequence Gaurav K Singh
2015-05-29 10:36 ` [RFC 03/14] drm/i915: Add functions for dcs memory write cmd Gaurav K Singh
2015-05-29 10:36 ` [RFC 04/14] drm/i915: Calculate bw timer for mipi DBI interface Gaurav K Singh
2015-05-29 10:36 ` [RFC 05/14] drm/i915: Use the bpp value wrt the pixel format Gaurav K Singh
2015-05-29 10:36 ` [RFC 06/14] drm/i915: Disable vlank interrupt for disabling MIPI cmd mode Gaurav K Singh
2015-05-29 17:14   ` Daniel Vetter
2015-05-29 17:23     ` Daniel Vetter
2015-06-16 16:54       ` Singh, Gaurav K
2015-06-17 11:36         ` Daniel Vetter
2015-06-18 21:49         ` Gaurav K Singh
2015-06-22 11:58           ` Daniel Vetter
2015-05-29 10:36 ` [RFC 07/14] drm/i915: Disable MIPI display self refresh mode Gaurav K Singh
2015-05-29 17:16   ` Daniel Vetter
2015-05-29 17:20     ` Daniel Vetter
2015-06-16 16:59       ` Singh, Gaurav K
2015-06-18 21:53         ` Gaurav K Singh
2015-06-22 12:04           ` Daniel Vetter
2015-05-29 10:37 ` [RFC 08/14] drm/i915: Disable Tearing effect trigger by GPIO pin Gaurav K Singh
2015-05-29 10:37 ` [RFC 09/14] drm/i915: Changes for command mode preparation Gaurav K Singh
2015-05-29 10:37 ` [RFC 10/14] drm/i915: Enable Tearing effect trigger by GPIO pin Gaurav K Singh
2015-05-29 10:37 ` [RFC 11/14] drm/i915: Enable MIPI display self refresh mode Gaurav K Singh
2015-05-29 17:21   ` Daniel Vetter
2015-06-13  6:54     ` Mohan Marimuthu, Yogesh
2015-06-15 10:33       ` Daniel Vetter
2015-06-16 17:03         ` Singh, Gaurav K
2015-06-17 11:39           ` Daniel Vetter
2015-06-18 21:56           ` Gaurav K Singh
2015-06-22 12:05             ` Daniel Vetter
2015-06-22 12:08               ` Daniel Vetter
2015-05-29 10:37 ` [RFC 12/14] drm/i915: Generalize DSI enable function Gaurav K Singh
2015-05-29 10:37 ` [RFC 13/14] drm/i915: Reset the display hw if vid mode to cmd mode Gaurav K Singh
2015-05-29 10:37 ` [RFC 14/14] drm/i915: send one frame after enabling mipi " Gaurav K Singh

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=558340F9.7060808@intel.com \
    --to=gaurav.k.singh@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=shobhit.kumar@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox