dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau: force alignment to 0x1000 for gpu objects
@ 2013-09-02 14:31 Maarten Lankhorst
       [not found] ` <1378132297-19616-1-git-send-email-maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Maarten Lankhorst @ 2013-09-02 14:31 UTC (permalink / raw)
  To: nouveau; +Cc: dri-devel

There are a lot of places that allocate multiples of 1000,
but do not set alignment correctly and still require this
alignment implicitly or explicitly.
---
 drivers/gpu/drm/nouveau/core/core/gpuobj.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/core/core/gpuobj.c b/drivers/gpu/drm/nouveau/core/core/gpuobj.c
index 7595506..7bcae1d 100644
--- a/drivers/gpu/drm/nouveau/core/core/gpuobj.c
+++ b/drivers/gpu/drm/nouveau/core/core/gpuobj.c
@@ -65,6 +65,14 @@ nouveau_gpuobj_create_(struct nouveau_object *parent,
 	int ret, i;
 	u64 addr;
 
+	/*
+	 * There are a lot of places that allocate multiples of 1000,
+	 * but do not set alignment correctly and still require this
+	 * alignment implicitly or explicitly.
+	 */
+	if (size >= 0x1000 && align < 0x1000)
+		align = 0x1000;
+
 	*pobject = NULL;
 
 	if (pargpu) {
-- 
1.8.3.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/nouveau: force alignment to 0x1000 for gpu objects
       [not found] ` <1378132297-19616-1-git-send-email-maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
@ 2013-09-04  3:34   ` Ben Skeggs
  2013-09-04 11:59     ` Maarten Lankhorst
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Skeggs @ 2013-09-04  3:34 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org

On Tue, Sep 3, 2013 at 12:31 AM, Maarten Lankhorst
<maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org> wrote:
> There are a lot of places that allocate multiples of 1000,
> but do not set alignment correctly and still require this
> alignment implicitly or explicitly.
This is wrong.  Where are the places you think you need this?

Ben.

> ---
>  drivers/gpu/drm/nouveau/core/core/gpuobj.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/gpu/drm/nouveau/core/core/gpuobj.c b/drivers/gpu/drm/nouveau/core/core/gpuobj.c
> index 7595506..7bcae1d 100644
> --- a/drivers/gpu/drm/nouveau/core/core/gpuobj.c
> +++ b/drivers/gpu/drm/nouveau/core/core/gpuobj.c
> @@ -65,6 +65,14 @@ nouveau_gpuobj_create_(struct nouveau_object *parent,
>         int ret, i;
>         u64 addr;
>
> +       /*
> +        * There are a lot of places that allocate multiples of 1000,
> +        * but do not set alignment correctly and still require this
> +        * alignment implicitly or explicitly.
> +        */
> +       if (size >= 0x1000 && align < 0x1000)
> +               align = 0x1000;
> +
>         *pobject = NULL;
>
>         if (pargpu) {
> --
> 1.8.3.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/nouveau: force alignment to 0x1000 for gpu objects
  2013-09-04  3:34   ` Ben Skeggs
@ 2013-09-04 11:59     ` Maarten Lankhorst
  2013-09-09 23:21       ` Ben Skeggs
  0 siblings, 1 reply; 4+ messages in thread
From: Maarten Lankhorst @ 2013-09-04 11:59 UTC (permalink / raw)
  To: Ben Skeggs; +Cc: nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org

Op 04-09-13 05:34, Ben Skeggs schreef:
> On Tue, Sep 3, 2013 at 12:31 AM, Maarten Lankhorst
> <maarten.lankhorst@canonical.com> wrote:
>> There are a lot of places that allocate multiples of 1000,
>> but do not set alignment correctly and still require this
>> alignment implicitly or explicitly.
> This is wrong.  Where are the places you think you need this?
>
All the calls to nouveau_gpuobj_map_vm for example in core/engine/graph/nvc0.c.

engctx_create is usually called with alignment = 0x100 too, which seems like it would break in the fifo_context_attach calls too.

~Maarten

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/nouveau: force alignment to 0x1000 for gpu objects
  2013-09-04 11:59     ` Maarten Lankhorst
@ 2013-09-09 23:21       ` Ben Skeggs
  0 siblings, 0 replies; 4+ messages in thread
From: Ben Skeggs @ 2013-09-09 23:21 UTC (permalink / raw)
  To: Maarten Lankhorst
  Cc: nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org

On Wed, Sep 4, 2013 at 9:59 PM, Maarten Lankhorst
<maarten.lankhorst@canonical.com> wrote:
> Op 04-09-13 05:34, Ben Skeggs schreef:
>> On Tue, Sep 3, 2013 at 12:31 AM, Maarten Lankhorst
>> <maarten.lankhorst@canonical.com> wrote:
>>> There are a lot of places that allocate multiples of 1000,
>>> but do not set alignment correctly and still require this
>>> alignment implicitly or explicitly.
>> This is wrong.  Where are the places you think you need this?
>>
> All the calls to nouveau_gpuobj_map_vm for example in core/engine/graph/nvc0.c.
>
> engctx_create is usually called with alignment = 0x100 too, which seems like it would break in the fifo_context_attach calls too.
All the places I can see with a "too small" alignment are not
suballocated, so the backend will force alignment to minimum GPU page
size anyway.

If someone wants to go through all these calls and fix them up
explicitly too, then, patches welcome.  The posted patch, however,
isn't the right way to go about this, and I couldn't find an example
yet that'd cause an actual breakage.

Ben.

>
> ~Maarten

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-09 23:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-02 14:31 [PATCH] drm/nouveau: force alignment to 0x1000 for gpu objects Maarten Lankhorst
     [not found] ` <1378132297-19616-1-git-send-email-maarten.lankhorst-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
2013-09-04  3:34   ` Ben Skeggs
2013-09-04 11:59     ` Maarten Lankhorst
2013-09-09 23:21       ` Ben Skeggs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).