Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Shyti <andi.shyti@linux.intel.com>
To: Nirmoy Das <nirmoy.das@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	Matthew Auld <matthew.auld@intel.com>
Subject: Re: [Intel-gfx] [PATCH 3/5] drm/i915: Add a function to mmap framebuffer obj
Date: Tue, 4 Apr 2023 18:57:01 +0200	[thread overview]
Message-ID: <ZCxW3WZCKFRchRAE@ashyti-mobl2.lan> (raw)
In-Reply-To: <20230404143100.10452-3-nirmoy.das@intel.com>

Hi Nirmoy,

[...]

> +int i915_gem_fb_mmap(struct drm_i915_gem_object *obj, struct vm_area_struct *vma)
> +{
> +	struct drm_i915_private *i915 = to_i915(obj->base.dev);
> +	struct drm_device *dev = &i915->drm;
> +	struct i915_mmap_offset *mmo = NULL;
> +	enum i915_mmap_type mmap_type;
> +	struct i915_ggtt *ggtt = to_gt(i915)->ggtt;
> +
> +	if (drm_dev_is_unplugged(dev))
> +		return -ENODEV;
> +
> +	/* handle ttm object */
> +	if (obj->ops->mmap_ops) {
> +		/*
> +		 * ttm fault handler, ttm_bo_vm_fault_reserved() uses fake offset
> +		 * to calculate page offset so set that up.
> +		 */
> +		vma->vm_pgoff += drm_vma_node_start(&obj->base.vma_node);

you could have kept my r-b. Good work here!

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> 

Thanks,
Andi

> +	} else {
> +		/* handle stolen and smem objects */
> +		mmap_type = i915_ggtt_has_aperture(ggtt) ? I915_MMAP_TYPE_GTT : I915_MMAP_TYPE_WC;
> +		mmo = mmap_offset_attach(obj, mmap_type, NULL);
> +		if (!mmo)
> +			return -ENODEV;
> +	}
> +
> +	/*
> +	 * When we install vm_ops for mmap we are too late for
> +	 * the vm_ops->open() which increases the ref_count of
> +	 * this obj and then it gets decreased by the vm_ops->close().
> +	 * To balance this increase the obj ref_count here.
> +	 */
> +	obj = i915_gem_object_get(obj);
> +	return i915_gem_object_mmap(obj, mmo, vma);
> +}

  reply	other threads:[~2023-04-04 16:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-04 14:30 [Intel-gfx] [PATCH 1/5] drm/i915/ttm: Add I915_BO_PREALLOC Nirmoy Das
2023-04-04 14:30 ` [Intel-gfx] [PATCH 2/5] drm/i915/display: Set I915_BO_ALLOC_USER for fb Nirmoy Das
2023-04-04 16:36   ` Andi Shyti
2023-04-05 14:11   ` Andrzej Hajda
2023-04-04 14:30 ` [Intel-gfx] [PATCH 3/5] drm/i915: Add a function to mmap framebuffer obj Nirmoy Das
2023-04-04 16:57   ` Andi Shyti [this message]
2023-04-04 17:59     ` Das, Nirmoy
2023-04-04 14:30 ` [Intel-gfx] [PATCH 4/5] drm/i915/display: Add helper func to get intel_fbdev from drm_fb_helper Nirmoy Das
2023-04-05 14:13   ` Andrzej Hajda
2023-04-05 14:14     ` Andrzej Hajda
2023-04-04 14:31 ` [Intel-gfx] [PATCH 5/5] drm/i915/display: Implement fb_mmap callback function Nirmoy Das
2023-04-04 15:30 ` [Intel-gfx] [PATCH 1/5] drm/i915/ttm: Add I915_BO_PREALLOC Andrzej Hajda
2023-04-05 10:42   ` Das, Nirmoy
2023-04-04 15:47 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/5] " Patchwork
2023-04-04 15:47 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-04-04 16:00 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-04-04 16:23 ` [Intel-gfx] [PATCH 1/5] " Andi Shyti
2023-04-05 10:52   ` Das, Nirmoy
2023-04-05 11:53     ` Andi Shyti
2023-04-05 12:36       ` Das, Nirmoy
2023-04-05 13:52         ` Andi Shyti
2023-04-05  0:30 ` [Intel-gfx] ✓ Fi.CI.IGT: success for series starting with [1/5] " Patchwork

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=ZCxW3WZCKFRchRAE@ashyti-mobl2.lan \
    --to=andi.shyti@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=matthew.auld@intel.com \
    --cc=nirmoy.das@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