All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mesa v2 1/2] nv30: Fix color resolving for nv3x cards
@ 2015-09-09 13:52 Hans de Goede
       [not found] ` <1441806729-9016-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2015-09-09 16:14 ` [PATCH mesa v2 1/2] nv30: Fix color resolving for nv3x cards Ilia Mirkin
  0 siblings, 2 replies; 4+ messages in thread
From: Hans de Goede @ 2015-09-09 13:52 UTC (permalink / raw)
  To: Ilia Mirkin, mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

We do not have a generic blitter on nv3x cards, so we must use the
sifm object for color resolving.

This commit divides the sources and dest surfaces in to tiles which
match the constraints of the sifm object, so that color resolving
will work properly on nv3x cards.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
-Use 1024x1024 blocks
-Use the sifm on both nv3x and nv4x cards instead of only on nv3x cards
---
 src/gallium/drivers/nouveau/nv30/nv30_miptree.c | 38 ++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c
index 76bb8b8..735c718 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c
@@ -149,14 +149,50 @@ static void
 nv30_resource_resolve(struct nv30_context *nv30,
                       const struct pipe_blit_info *info)
 {
+   struct nv30_miptree *src_mt = nv30_miptree(info->src.resource);
    struct nv30_rect src, dst;
+   unsigned x, x0, x1, y, y1, w, h;
 
    define_rect(info->src.resource, 0, info->src.box.z, info->src.box.x,
       info->src.box.y, info->src.box.width, info->src.box.height, &src);
    define_rect(info->dst.resource, 0, info->dst.box.z, info->dst.box.x,
       info->dst.box.y, info->dst.box.width, info->dst.box.height, &dst);
 
-   nv30_transfer_rect(nv30, BILINEAR, &src, &dst);
+   x0 = src.x0;
+   x1 = src.x1;
+   y1 = src.y1;
+
+   /* On nv3x we must use sifm which is restricted to 1024x1024 tiles */
+   for (y = src.y0; y < y1; y += h) {
+      h = y1 - y;
+      if (h > 1024)
+         h = 1024;
+
+      src.y0 = 0;
+      src.y1 = h;
+      src.h = h;
+
+      dst.y1 = dst.y0 + (h >> src_mt->ms_y);
+      dst.h = h >> src_mt->ms_y;
+
+      for (x = x0; x < x1; x += w) {
+         w = x1 - x;
+         if (w > 1024)
+            w = 1024;
+
+         src.offset = y * src.pitch + x * src.cpp;
+         src.x0 = 0;
+         src.x1 = w;
+         src.w = w;
+
+         dst.offset = (y >> src_mt->ms_y) * dst.pitch +
+                      (x >> src_mt->ms_x) * dst.cpp;
+         dst.x1 = dst.x0 + (w >> src_mt->ms_x);
+         dst.w = w >> src_mt->ms_x;
+
+         nv30_transfer_rect(nv30, BILINEAR, &src, &dst);
+      }
+   }
 }
 
 void
-- 
2.4.3

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

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

* [PATCH mesa v2 2/2] nv30: Disable msaa unless requested from the env by NV30_MAX_MSAA
       [not found] ` <1441806729-9016-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2015-09-09 13:52   ` Hans de Goede
       [not found]     ` <1441806729-9016-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Hans de Goede @ 2015-09-09 13:52 UTC (permalink / raw)
  To: Ilia Mirkin, mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Some modern apps try to use msaa without keeping in mind the
restrictions on videomem of older cards. Resulting in dmesg saying:

 [ 1197.850642] nouveau E[soffice.bin[3785]] fail ttm_validate
 [ 1197.850648] nouveau E[soffice.bin[3785]] validating bo list
 [ 1197.850654] nouveau E[soffice.bin[3785]] validate: -12

Because we are running out of video memory, after which the program
using the msaa visual freezes, and eventually the entire system freezes.

To work around this we do not allow msaa visauls by default and allow
the user to override this via NV30_MAX_MSAA.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Changes in v2:
-Allow re-enabling msaa by setting NV30_MAX_MSAA in the environment
---
 src/gallium/drivers/nouveau/nv30/nv30_screen.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
index 7aad26b..4b77f43 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
@@ -319,8 +319,28 @@ nv30_screen_is_format_supported(struct pipe_screen *pscreen,
                                 unsigned sample_count,
                                 unsigned bindings)
 {
-   if (sample_count > 4)
+   unsigned int max_sample_count;
+
+   /*
+    * Some modern apps try to use msaa without keeping in mind the
+    * restrictions on videomem of older cards. Resulting in dmesg saying:
+    * [ 1197.850642] nouveau E[soffice.bin[3785]] fail ttm_validate
+    * [ 1197.850648] nouveau E[soffice.bin[3785]] validating bo list
+    * [ 1197.850654] nouveau E[soffice.bin[3785]] validate: -12
+    *
+    * Because we are running out of video memory, after which the program
+    * using the msaa visual freezes, and eventually the entire system freezes.
+    *
+    * To work around this we do not allow msaa visauls by default and allow
+    * the user to override this via NV30_MAX_MSAA.
+    */
+   max_sample_count = debug_get_num_option("NV30_MAX_MSAA", 0);
+   if (max_sample_count > 4)
+      max_sample_count = 4;
+
+   if (sample_count > max_sample_count)
       return false;
+
    if (!(0x00000017 & (1 << sample_count)))
       return false;
 
-- 
2.4.3

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

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

* Re: [PATCH mesa v2 1/2] nv30: Fix color resolving for nv3x cards
  2015-09-09 13:52 [PATCH mesa v2 1/2] nv30: Fix color resolving for nv3x cards Hans de Goede
       [not found] ` <1441806729-9016-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2015-09-09 16:14 ` Ilia Mirkin
  1 sibling, 0 replies; 4+ messages in thread
From: Ilia Mirkin @ 2015-09-09 16:14 UTC (permalink / raw)
  To: Hans de Goede; +Cc: mesa-dev, nouveau

On Wed, Sep 9, 2015 at 9:52 AM, Hans de Goede <hdegoede@redhat.com> wrote:
> We do not have a generic blitter on nv3x cards, so we must use the
> sifm object for color resolving.
>
> This commit divides the sources and dest surfaces in to tiles which
> match the constraints of the sifm object, so that color resolving
> will work properly on nv3x cards.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v2:
> -Use 1024x1024 blocks
> -Use the sifm on both nv3x and nv4x cards instead of only on nv3x cards

Thanks, pushed.

> ---
>  src/gallium/drivers/nouveau/nv30/nv30_miptree.c | 38 ++++++++++++++++++++++++-
>  1 file changed, 37 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c
> index 76bb8b8..735c718 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_miptree.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_miptree.c
> @@ -149,14 +149,50 @@ static void
>  nv30_resource_resolve(struct nv30_context *nv30,
>                        const struct pipe_blit_info *info)
>  {
> +   struct nv30_miptree *src_mt = nv30_miptree(info->src.resource);
>     struct nv30_rect src, dst;
> +   unsigned x, x0, x1, y, y1, w, h;
>
>     define_rect(info->src.resource, 0, info->src.box.z, info->src.box.x,
>        info->src.box.y, info->src.box.width, info->src.box.height, &src);
>     define_rect(info->dst.resource, 0, info->dst.box.z, info->dst.box.x,
>        info->dst.box.y, info->dst.box.width, info->dst.box.height, &dst);
>
> -   nv30_transfer_rect(nv30, BILINEAR, &src, &dst);
> +   x0 = src.x0;
> +   x1 = src.x1;
> +   y1 = src.y1;
> +
> +   /* On nv3x we must use sifm which is restricted to 1024x1024 tiles */
> +   for (y = src.y0; y < y1; y += h) {
> +      h = y1 - y;
> +      if (h > 1024)
> +         h = 1024;
> +
> +      src.y0 = 0;
> +      src.y1 = h;
> +      src.h = h;
> +
> +      dst.y1 = dst.y0 + (h >> src_mt->ms_y);
> +      dst.h = h >> src_mt->ms_y;
> +
> +      for (x = x0; x < x1; x += w) {
> +         w = x1 - x;
> +         if (w > 1024)
> +            w = 1024;
> +
> +         src.offset = y * src.pitch + x * src.cpp;
> +         src.x0 = 0;
> +         src.x1 = w;
> +         src.w = w;
> +
> +         dst.offset = (y >> src_mt->ms_y) * dst.pitch +
> +                      (x >> src_mt->ms_x) * dst.cpp;
> +         dst.x1 = dst.x0 + (w >> src_mt->ms_x);
> +         dst.w = w >> src_mt->ms_x;
> +
> +         nv30_transfer_rect(nv30, BILINEAR, &src, &dst);
> +      }
> +   }
>  }
>
>  void
> --
> 2.4.3
>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

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

* Re: [PATCH mesa v2 2/2] nv30: Disable msaa unless requested from the env by NV30_MAX_MSAA
       [not found]     ` <1441806729-9016-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2015-09-09 16:15       ` Ilia Mirkin
  0 siblings, 0 replies; 4+ messages in thread
From: Ilia Mirkin @ 2015-09-09 16:15 UTC (permalink / raw)
  To: Hans de Goede
  Cc: mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On Wed, Sep 9, 2015 at 9:52 AM, Hans de Goede <hdegoede@redhat.com> wrote:
> Some modern apps try to use msaa without keeping in mind the
> restrictions on videomem of older cards. Resulting in dmesg saying:
>
>  [ 1197.850642] nouveau E[soffice.bin[3785]] fail ttm_validate
>  [ 1197.850648] nouveau E[soffice.bin[3785]] validating bo list
>  [ 1197.850654] nouveau E[soffice.bin[3785]] validate: -12
>
> Because we are running out of video memory, after which the program
> using the msaa visual freezes, and eventually the entire system freezes.
>
> To work around this we do not allow msaa visauls by default and allow
> the user to override this via NV30_MAX_MSAA.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v2:
> -Allow re-enabling msaa by setting NV30_MAX_MSAA in the environment

Moved this to screen init and pushed. is_format_supported is called a
lot, not sure how expensive getenv() is, don't want to find out.

> ---
>  src/gallium/drivers/nouveau/nv30/nv30_screen.c | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> index 7aad26b..4b77f43 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> @@ -319,8 +319,28 @@ nv30_screen_is_format_supported(struct pipe_screen *pscreen,
>                                  unsigned sample_count,
>                                  unsigned bindings)
>  {
> -   if (sample_count > 4)
> +   unsigned int max_sample_count;
> +
> +   /*
> +    * Some modern apps try to use msaa without keeping in mind the
> +    * restrictions on videomem of older cards. Resulting in dmesg saying:
> +    * [ 1197.850642] nouveau E[soffice.bin[3785]] fail ttm_validate
> +    * [ 1197.850648] nouveau E[soffice.bin[3785]] validating bo list
> +    * [ 1197.850654] nouveau E[soffice.bin[3785]] validate: -12
> +    *
> +    * Because we are running out of video memory, after which the program
> +    * using the msaa visual freezes, and eventually the entire system freezes.
> +    *
> +    * To work around this we do not allow msaa visauls by default and allow
> +    * the user to override this via NV30_MAX_MSAA.
> +    */
> +   max_sample_count = debug_get_num_option("NV30_MAX_MSAA", 0);
> +   if (max_sample_count > 4)
> +      max_sample_count = 4;
> +
> +   if (sample_count > max_sample_count)
>        return false;
> +
>     if (!(0x00000017 & (1 << sample_count)))
>        return false;
>
> --
> 2.4.3
>
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

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

end of thread, other threads:[~2015-09-09 16:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-09 13:52 [PATCH mesa v2 1/2] nv30: Fix color resolving for nv3x cards Hans de Goede
     [not found] ` <1441806729-9016-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-09-09 13:52   ` [PATCH mesa v2 2/2] nv30: Disable msaa unless requested from the env by NV30_MAX_MSAA Hans de Goede
     [not found]     ` <1441806729-9016-2-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-09-09 16:15       ` Ilia Mirkin
2015-09-09 16:14 ` [PATCH mesa v2 1/2] nv30: Fix color resolving for nv3x cards Ilia Mirkin

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.