* drm/amdgpu: Use GTT for dumb buffer if sg display enabled (v2)
@ 2018-05-22 22:31 Deepak Sharma
[not found] ` <20180522223123.5427-1-Deepak.Sharma-5C7GfCeVMHo@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Deepak Sharma @ 2018-05-22 22:31 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
alexander.deucher-5C7GfCeVMHo, michel-otUistvHUpPR7s880joybQ,
christian.koenig-5C7GfCeVMHo
Cc: Deepak Sharma
When vram size <= THRESHOLD(256M) lets use GTT for dumb buffer
allocation. As SG will be enabled with vram size <= 256M
scan out will not be an issue.
v2: Use amdgpu_display_supported_domains to get supported domain.
Signed-off-by: Deepak Sharma <Deepak.Sharma@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 2c8e27370284..63758db5e2ea 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -30,6 +30,7 @@
#include <drm/drmP.h>
#include <drm/amdgpu_drm.h>
#include "amdgpu.h"
+#include "amdgpu_display.h"
void amdgpu_gem_object_free(struct drm_gem_object *gobj)
{
@@ -749,15 +750,20 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
struct amdgpu_device *adev = dev->dev_private;
struct drm_gem_object *gobj;
uint32_t handle;
+ u32 domain = amdgpu_display_supported_domains(adev);
int r;
args->pitch = amdgpu_align_pitch(adev, args->width,
DIV_ROUND_UP(args->bpp, 8), 0);
args->size = (u64)args->pitch * args->height;
args->size = ALIGN(args->size, PAGE_SIZE);
+ if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) {
+ domain = AMDGPU_GEM_DOMAIN_VRAM;
+ if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
+ domain = AMDGPU_GEM_DOMAIN_GTT;
+ }
- r = amdgpu_gem_object_create(adev, args->size, 0,
- AMDGPU_GEM_DOMAIN_VRAM,
+ r = amdgpu_gem_object_create(adev, args->size, 0, domain,
AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
false, NULL, &gobj);
if (r)
--
2.15.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: drm/amdgpu: Use GTT for dumb buffer if sg display enabled (v2)
[not found] ` <20180522223123.5427-1-Deepak.Sharma-5C7GfCeVMHo@public.gmane.org>
@ 2018-05-23 7:31 ` Christian König
[not found] ` <7471c409-bcee-a72c-5a6d-230153c6823d-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Christian König @ 2018-05-23 7:31 UTC (permalink / raw)
To: Deepak Sharma, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
alexander.deucher-5C7GfCeVMHo, michel-otUistvHUpPR7s880joybQ,
christian.koenig-5C7GfCeVMHo
Am 23.05.2018 um 00:31 schrieb Deepak Sharma:
> When vram size <= THRESHOLD(256M) lets use GTT for dumb buffer
> allocation. As SG will be enabled with vram size <= 256M
> scan out will not be an issue.
>
> v2: Use amdgpu_display_supported_domains to get supported domain.
>
> Signed-off-by: Deepak Sharma <Deepak.Sharma@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> index 2c8e27370284..63758db5e2ea 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
> @@ -30,6 +30,7 @@
> #include <drm/drmP.h>
> #include <drm/amdgpu_drm.h>
> #include "amdgpu.h"
> +#include "amdgpu_display.h"
>
> void amdgpu_gem_object_free(struct drm_gem_object *gobj)
> {
> @@ -749,15 +750,20 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
> struct amdgpu_device *adev = dev->dev_private;
> struct drm_gem_object *gobj;
> uint32_t handle;
> + u32 domain = amdgpu_display_supported_domains(adev);
> int r;
>
> args->pitch = amdgpu_align_pitch(adev, args->width,
> DIV_ROUND_UP(args->bpp, 8), 0);
> args->size = (u64)args->pitch * args->height;
> args->size = ALIGN(args->size, PAGE_SIZE);
> + if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) {
> + domain = AMDGPU_GEM_DOMAIN_VRAM;
> + if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
> + domain = AMDGPU_GEM_DOMAIN_GTT;
> + }
As Michel suggested as well better make that an helper in amdgpu_object.c.
Apart from that looks good to me,
Christian.
>
> - r = amdgpu_gem_object_create(adev, args->size, 0,
> - AMDGPU_GEM_DOMAIN_VRAM,
> + r = amdgpu_gem_object_create(adev, args->size, 0, domain,
> AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
> false, NULL, &gobj);
> if (r)
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: drm/amdgpu: Use GTT for dumb buffer if sg display enabled (v2)
[not found] ` <7471c409-bcee-a72c-5a6d-230153c6823d-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2018-05-23 18:14 ` Deepak Sharma
[not found] ` <1b119b78-60c9-cf44-ea27-3d387e25a6af-5C7GfCeVMHo@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Deepak Sharma @ 2018-05-23 18:14 UTC (permalink / raw)
To: christian.koenig-5C7GfCeVMHo,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
alexander.deucher-5C7GfCeVMHo, michel-otUistvHUpPR7s880joybQ
On 05/23/2018 12:31 AM, Christian König wrote:
> Am 23.05.2018 um 00:31 schrieb Deepak Sharma:
>> When vram size <= THRESHOLD(256M) lets use GTT for dumb buffer
>> allocation. As SG will be enabled with vram size <= 256M
>> scan out will not be an issue.
>>
>> v2: Use amdgpu_display_supported_domains to get supported domain.
>>
>> Signed-off-by: Deepak Sharma <Deepak.Sharma@amd.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 10 ++++++++--
>> 1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> index 2c8e27370284..63758db5e2ea 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>> @@ -30,6 +30,7 @@
>> #include <drm/drmP.h>
>> #include <drm/amdgpu_drm.h>
>> #include "amdgpu.h"
>> +#include "amdgpu_display.h"
>> void amdgpu_gem_object_free(struct drm_gem_object *gobj)
>> {
>> @@ -749,15 +750,20 @@ int amdgpu_mode_dumb_create(struct drm_file
>> *file_priv,
>> struct amdgpu_device *adev = dev->dev_private;
>> struct drm_gem_object *gobj;
>> uint32_t handle;
>> + u32 domain = amdgpu_display_supported_domains(adev);
>> int r;
>> args->pitch = amdgpu_align_pitch(adev, args->width,
>> DIV_ROUND_UP(args->bpp, 8), 0);
>> args->size = (u64)args->pitch * args->height;
>> args->size = ALIGN(args->size, PAGE_SIZE);
>> + if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) {
>> + domain = AMDGPU_GEM_DOMAIN_VRAM;
>> + if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>> + domain = AMDGPU_GEM_DOMAIN_GTT;
>> + }
>
> As Michel suggested as well better make that an helper in amdgpu_object.c.
>
> Apart from that looks good to me,
> Christian.
I can push another patch to create helper function and use that here as
well as in amdgpu_bo_pin_restricted.
otherwise I can push v3 if you want that change in this patch itself.
Thanks,
Deepak
>
>> - r = amdgpu_gem_object_create(adev, args->size, 0,
>> - AMDGPU_GEM_DOMAIN_VRAM,
>> + r = amdgpu_gem_object_create(adev, args->size, 0, domain,
>> AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
>> false, NULL, &gobj);
>> if (r)
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: drm/amdgpu: Use GTT for dumb buffer if sg display enabled (v2)
[not found] ` <1b119b78-60c9-cf44-ea27-3d387e25a6af-5C7GfCeVMHo@public.gmane.org>
@ 2018-05-24 7:01 ` Christian König
0 siblings, 0 replies; 4+ messages in thread
From: Christian König @ 2018-05-24 7:01 UTC (permalink / raw)
To: Deepak Sharma, christian.koenig-5C7GfCeVMHo,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
alexander.deucher-5C7GfCeVMHo, michel-otUistvHUpPR7s880joybQ
Am 23.05.2018 um 20:14 schrieb Deepak Sharma:
>
>
> On 05/23/2018 12:31 AM, Christian König wrote:
>> Am 23.05.2018 um 00:31 schrieb Deepak Sharma:
>>> When vram size <= THRESHOLD(256M) lets use GTT for dumb buffer
>>> allocation. As SG will be enabled with vram size <= 256M
>>> scan out will not be an issue.
>>>
>>> v2: Use amdgpu_display_supported_domains to get supported domain.
>>>
>>> Signed-off-by: Deepak Sharma <Deepak.Sharma@amd.com>
>>> ---
>>> drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 10 ++++++++--
>>> 1 file changed, 8 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>>> index 2c8e27370284..63758db5e2ea 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
>>> @@ -30,6 +30,7 @@
>>> #include <drm/drmP.h>
>>> #include <drm/amdgpu_drm.h>
>>> #include "amdgpu.h"
>>> +#include "amdgpu_display.h"
>>> void amdgpu_gem_object_free(struct drm_gem_object *gobj)
>>> {
>>> @@ -749,15 +750,20 @@ int amdgpu_mode_dumb_create(struct drm_file
>>> *file_priv,
>>> struct amdgpu_device *adev = dev->dev_private;
>>> struct drm_gem_object *gobj;
>>> uint32_t handle;
>>> + u32 domain = amdgpu_display_supported_domains(adev);
>>> int r;
>>> args->pitch = amdgpu_align_pitch(adev, args->width,
>>> DIV_ROUND_UP(args->bpp, 8), 0);
>>> args->size = (u64)args->pitch * args->height;
>>> args->size = ALIGN(args->size, PAGE_SIZE);
>>> + if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) {
>>> + domain = AMDGPU_GEM_DOMAIN_VRAM;
>>> + if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>>> + domain = AMDGPU_GEM_DOMAIN_GTT;
>>> + }
>>
>> As Michel suggested as well better make that an helper in
>> amdgpu_object.c.
>>
>> Apart from that looks good to me,
>> Christian.
>
> I can push another patch to create helper function and use that here
> as well as in amdgpu_bo_pin_restricted.
>
> otherwise I can push v3 if you want that change in this patch itself.
Since this is just a minor cleanup either way works with me. Use
whatever approach suits you better.
Thanks,
Christian.
>
> Thanks,
> Deepak
>
>>
>>> - r = amdgpu_gem_object_create(adev, args->size, 0,
>>> - AMDGPU_GEM_DOMAIN_VRAM,
>>> + r = amdgpu_gem_object_create(adev, args->size, 0, domain,
>>> AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
>>> false, NULL, &gobj);
>>> if (r)
>>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-05-24 7:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-22 22:31 drm/amdgpu: Use GTT for dumb buffer if sg display enabled (v2) Deepak Sharma
[not found] ` <20180522223123.5427-1-Deepak.Sharma-5C7GfCeVMHo@public.gmane.org>
2018-05-23 7:31 ` Christian König
[not found] ` <7471c409-bcee-a72c-5a6d-230153c6823d-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-05-23 18:14 ` Deepak Sharma
[not found] ` <1b119b78-60c9-cf44-ea27-3d387e25a6af-5C7GfCeVMHo@public.gmane.org>
2018-05-24 7:01 ` Christian König
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.