All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nirmoy <nirmodas@amd.com>
To: Gerd Hoffmann <kraxel@redhat.com>, Nirmoy Das <nirmoy.aiemd@gmail.com>
Cc: thellstrom@vmware.com, amd-gfx@lists.freedesktop.org,
	airlied@linux.ie, kenny.ho@amd.com, brian.welty@intel.com,
	dri-devel@lists.freedesktop.org, nirmoy.das@amd.com,
	linux-graphics-maintainer@vmware.com, bskeggs@redhat.com,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	alexander.deucher@amd.com, sean@poorly.run,
	christian.koenig@amd.com
Subject: Re: [PATCH 6/8] drm/vram-helper: don't use ttm bo->offset v3
Date: Thu, 5 Mar 2020 15:35:57 +0100	[thread overview]
Message-ID: <3f6148c1-8357-0f18-3bda-bd989ac26393@amd.com> (raw)
In-Reply-To: <20200305140749.5oggp4gh6hozsh7j@sirius.home.kraxel.org>


[-- Attachment #1.1: Type: text/plain, Size: 1891 bytes --]


On 3/5/20 3:07 PM, Gerd Hoffmann wrote:
> On Thu, Mar 05, 2020 at 02:29:08PM +0100, Nirmoy Das wrote:
>> Calculate GEM VRAM bo's offset within vram-helper without depending on
>> bo->offset.
>>
>> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
>> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>> ---
>>   drivers/gpu/drm/drm_gem_vram_helper.c | 9 ++++++++-
>>   1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
>> index 92a11bb42365..2749c2d25ac4 100644
>> --- a/drivers/gpu/drm/drm_gem_vram_helper.c
>> +++ b/drivers/gpu/drm/drm_gem_vram_helper.c
>> @@ -198,6 +198,13 @@ u64 drm_gem_vram_mmap_offset(struct drm_gem_vram_object *gbo)
>>   }
>>   EXPORT_SYMBOL(drm_gem_vram_mmap_offset);
>>
>> +static s64 drm_gem_vram_pg_offset(struct drm_gem_vram_object *gbo)
>> +{
>> +	if (WARN_ON_ONCE(!gbo->bo.mem.mm_node))
>> +		return 0;
> returns 0 on error.

I am not sure if we should call this an error. This patch series removes 
below offset calculation from ttm_bo.c.

-	if (bo->mem.mm_node)
-		bo->offset = (bo->mem.start << PAGE_SHIFT) +
-		    bdev->man[bo->mem.mem_type].gpu_offset;
-	else
-		bo->offset = 0;
-

Most of the driver sets "bo->mem.mm_node". Thomas suggested to use this 
"return 0" in case some driver depends on bo->offset = 0.

>
>> +	return gbo->bo.mem.start;
>> +}
>> +
>>   /**
>>    * drm_gem_vram_offset() - \
>>   	Returns a GEM VRAM object's offset in video memory
>> @@ -214,7 +221,7 @@ s64 drm_gem_vram_offset(struct drm_gem_vram_object *gbo)
>>   {
>>   	if (WARN_ON_ONCE(!gbo->pin_count))
>>   		return (s64)-ENODEV;
> returns -errno on error.
>
>> -	return gbo->bo.offset;
>> +	return drm_gem_vram_pg_offset(gbo) << PAGE_SHIFT;
> And given that one calls the other behavior on error should better be
> consistent ...
>
> cheers,
>    Gerd
>

Regards,

Nirmoy


[-- Attachment #1.2: Type: text/html, Size: 3264 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

WARNING: multiple messages have this Message-ID (diff)
From: Nirmoy <nirmodas@amd.com>
To: Gerd Hoffmann <kraxel@redhat.com>, Nirmoy Das <nirmoy.aiemd@gmail.com>
Cc: David1.Zhou@amd.com, thellstrom@vmware.com,
	amd-gfx@lists.freedesktop.org, airlied@linux.ie,
	kenny.ho@amd.com, brian.welty@intel.com,
	maarten.lankhorst@linux.intel.com,
	dri-devel@lists.freedesktop.org, nirmoy.das@amd.com,
	linux-graphics-maintainer@vmware.com, bskeggs@redhat.com,
	daniel@ffwll.ch, Daniel Vetter <daniel.vetter@ffwll.ch>,
	alexander.deucher@amd.com, sean@poorly.run,
	christian.koenig@amd.com
Subject: Re: [PATCH 6/8] drm/vram-helper: don't use ttm bo->offset v3
Date: Thu, 5 Mar 2020 15:35:57 +0100	[thread overview]
Message-ID: <3f6148c1-8357-0f18-3bda-bd989ac26393@amd.com> (raw)
In-Reply-To: <20200305140749.5oggp4gh6hozsh7j@sirius.home.kraxel.org>


[-- Attachment #1.1: Type: text/plain, Size: 1891 bytes --]


On 3/5/20 3:07 PM, Gerd Hoffmann wrote:
> On Thu, Mar 05, 2020 at 02:29:08PM +0100, Nirmoy Das wrote:
>> Calculate GEM VRAM bo's offset within vram-helper without depending on
>> bo->offset.
>>
>> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
>> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>> ---
>>   drivers/gpu/drm/drm_gem_vram_helper.c | 9 ++++++++-
>>   1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
>> index 92a11bb42365..2749c2d25ac4 100644
>> --- a/drivers/gpu/drm/drm_gem_vram_helper.c
>> +++ b/drivers/gpu/drm/drm_gem_vram_helper.c
>> @@ -198,6 +198,13 @@ u64 drm_gem_vram_mmap_offset(struct drm_gem_vram_object *gbo)
>>   }
>>   EXPORT_SYMBOL(drm_gem_vram_mmap_offset);
>>
>> +static s64 drm_gem_vram_pg_offset(struct drm_gem_vram_object *gbo)
>> +{
>> +	if (WARN_ON_ONCE(!gbo->bo.mem.mm_node))
>> +		return 0;
> returns 0 on error.

I am not sure if we should call this an error. This patch series removes 
below offset calculation from ttm_bo.c.

-	if (bo->mem.mm_node)
-		bo->offset = (bo->mem.start << PAGE_SHIFT) +
-		    bdev->man[bo->mem.mem_type].gpu_offset;
-	else
-		bo->offset = 0;
-

Most of the driver sets "bo->mem.mm_node". Thomas suggested to use this 
"return 0" in case some driver depends on bo->offset = 0.

>
>> +	return gbo->bo.mem.start;
>> +}
>> +
>>   /**
>>    * drm_gem_vram_offset() - \
>>   	Returns a GEM VRAM object's offset in video memory
>> @@ -214,7 +221,7 @@ s64 drm_gem_vram_offset(struct drm_gem_vram_object *gbo)
>>   {
>>   	if (WARN_ON_ONCE(!gbo->pin_count))
>>   		return (s64)-ENODEV;
> returns -errno on error.
>
>> -	return gbo->bo.offset;
>> +	return drm_gem_vram_pg_offset(gbo) << PAGE_SHIFT;
> And given that one calls the other behavior on error should better be
> consistent ...
>
> cheers,
>    Gerd
>

Regards,

Nirmoy


[-- Attachment #1.2: Type: text/html, Size: 3264 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2020-03-05 14:32 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05 13:29 [PATCH v4 0/8] do not store GPU address in TTM Nirmoy Das
2020-03-05 13:29 ` Nirmoy Das
2020-03-05 13:29 ` [PATCH 1/8] drm/amdgpu: move ttm bo->offset to amdgpu_bo Nirmoy Das
2020-03-05 13:29   ` Nirmoy Das
2020-03-05 19:11   ` Luben Tuikov
2020-03-05 19:11     ` Luben Tuikov
2020-03-05 13:29 ` [PATCH 2/8] drm/radeon: don't use ttm bo->offset Nirmoy Das
2020-03-05 13:29   ` Nirmoy Das
2020-03-05 19:19   ` Luben Tuikov
2020-03-05 19:19     ` Luben Tuikov
2020-03-05 19:37     ` Ho, Kenny
2020-03-05 19:37       ` Ho, Kenny
2020-03-05 20:18       ` Luben Tuikov
2020-03-05 20:18         ` Luben Tuikov
2020-03-05 13:29 ` [PATCH 3/8] drm/vmwgfx: " Nirmoy Das
2020-03-05 13:29   ` Nirmoy Das
2020-03-05 13:29 ` [PATCH 4/8] drm/nouveau: don't use ttm bo->offset v3 Nirmoy Das
2020-03-05 13:29   ` Nirmoy Das
2020-03-05 13:33   ` Christian König
2020-03-05 13:33     ` Christian König
2020-03-05 19:23   ` Luben Tuikov
2020-03-05 19:23     ` Luben Tuikov
2020-03-05 13:29 ` [PATCH 5/8] drm/qxl: don't use ttm bo->offset Nirmoy Das
2020-03-05 13:29   ` Nirmoy Das
2020-03-05 13:29 ` [PATCH 6/8] drm/vram-helper: don't use ttm bo->offset v3 Nirmoy Das
2020-03-05 13:29   ` Nirmoy Das
2020-03-05 14:07   ` Gerd Hoffmann
2020-03-05 14:07     ` Gerd Hoffmann
2020-03-05 14:26     ` Thomas Zimmermann
2020-03-05 14:26       ` Thomas Zimmermann
2020-03-05 14:35     ` Nirmoy [this message]
2020-03-05 14:35       ` Nirmoy
2020-03-05 14:34       ` Christian König
2020-03-05 14:34         ` Christian König
2020-03-05 13:29 ` [PATCH 7/8] drm/bochs: use drm_gem_vram_offset to get bo offset v2 Nirmoy Das
2020-03-05 13:29   ` Nirmoy Das
2020-03-05 13:29 ` [PATCH 8/8] drm/ttm: do not keep GPU dependent addresses Nirmoy Das
2020-03-05 13:29   ` Nirmoy Das
2020-03-05 13:34   ` Christian König
2020-03-05 13:34     ` Christian König

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=3f6148c1-8357-0f18-3bda-bd989ac26393@amd.com \
    --to=nirmodas@amd.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=brian.welty@intel.com \
    --cc=bskeggs@redhat.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kenny.ho@amd.com \
    --cc=kraxel@redhat.com \
    --cc=linux-graphics-maintainer@vmware.com \
    --cc=nirmoy.aiemd@gmail.com \
    --cc=nirmoy.das@amd.com \
    --cc=sean@poorly.run \
    --cc=thellstrom@vmware.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.