Skip to contentSkip to conversation

radeon: simplify ZS buffer checking on r600

PATCH In review Marek Olšák 5 participants 14 messages Jul 29, 2012 – Jul 30, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 radeon: simplify ZS buffer checking on r600

Setting those flags has no effect anywhere else.

---
 radeon/radeon_surface.c |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
radeon/radeon_surface.c +1 -8
index c80f7f4..5800c33 100644
@@ -385,14 +385,7 @@ static int r6_surface_init(struct radeon_surface_manager *surf_man,
     /* tiling mode */
     mode = (surf->flags >> RADEON_SURF_MODE_SHIFT) & RADEON_SURF_MODE_MASK;
 
-    /* always enable z & stencil together */
-    if (surf->flags & RADEON_SURF_ZBUFFER) {
-        surf->flags |= RADEON_SURF_SBUFFER;
-    }
-    if (surf->flags & RADEON_SURF_SBUFFER) {
-        surf->flags |= RADEON_SURF_ZBUFFER;
-    }
-    if (surf->flags & RADEON_SURF_ZBUFFER) {
+    if (surf->flags & (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) {
         /* zbuffer only support 1D or 2D tiled surface */
         switch (mode) {
         case RADEON_SURF_MODE_1D:
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/2 radeon: optimize allocation for depth w/o stencil and stencil w/o depth on EG

If we don't need stencil, don't allocate it.
If we need only stencil (like PIPE_FORMAT_S8_UINT), don't allocate depth.

---
 radeon/radeon_surface.c |   19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)
radeon/radeon_surface.c +5 -14
index 5800c33..fcfefdc 100644
@@ -604,7 +604,10 @@ static int eg_surface_init_1d(struct radeon_surface_manager *surf_man,
         }
     }
 
-    if (surf->flags & RADEON_SURF_SBUFFER) {
+    /* The depth and stencil buffers are in separate resources on evergreen.
+     * We allocate them in one buffer next to each other to simplify
+     * communication between the DDX and the Mesa driver. */
+    if (surf->flags & (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) {
         surf->stencil_offset = ALIGN(surf->bo_size, surf->bo_alignment);
         surf->bo_size = surf->stencil_offset + surf->bo_size / 4;
     }
@@ -752,14 +755,7 @@ static int eg_surface_init(struct radeon_surface_manager *surf_man,
     /* tiling mode */
     mode = (surf->flags >> RADEON_SURF_MODE_SHIFT) & RADEON_SURF_MODE_MASK;
 
-    /* for some reason eg need to have room for stencil right after depth */
-    if (surf->flags & RADEON_SURF_ZBUFFER) {
-        surf->flags |= RADEON_SURF_SBUFFER;
-    }
-    if (surf->flags & RADEON_SURF_SBUFFER) {
-        surf->flags |= RADEON_SURF_ZBUFFER;
-    }
-    if (surf->flags & RADEON_SURF_ZBUFFER) {
+    if (surf->flags & (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) {
         /* zbuffer only support 1D or 2D tiled surface */
         switch (mode) {
         case RADEON_SURF_MODE_1D:
@@ -828,11 +824,6 @@ static int eg_surface_best(struct radeon_surface_manager *surf_man,
     /* tiling mode */
     mode = (surf->flags >> RADEON_SURF_MODE_SHIFT) & RADEON_SURF_MODE_MASK;
 
-    /* for some reason eg need to have room for stencil right after depth */
-    if (surf->flags & RADEON_SURF_ZBUFFER) {
-        surf->flags |= RADEON_SURF_SBUFFER;
-    }
-
     /* set some default value to avoid sanity check choking on them */
     surf->tile_split = 1024;
     surf->bankw = 1;
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/2 radeon: optimize allocation for depth w/o stencil and stencil w/o depth on EG

If we don't need stencil, don't allocate it.
If we need only stencil (like PIPE_FORMAT_S8_UINT), don't allocate depth.

v2: actually do it correctly

---
 radeon/radeon_surface.c |   23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)
radeon/radeon_surface.c +8 -15
index 5800c33..874a092 100644
@@ -604,7 +604,11 @@ static int eg_surface_init_1d(struct radeon_surface_manager *surf_man,
         }
     }
 
-    if (surf->flags & RADEON_SURF_SBUFFER) {
+    /* The depth and stencil buffers are in separate resources on evergreen.
+     * We allocate them in one buffer next to each other to simplify
+     * communication between the DDX and the Mesa driver. */
+    if ((surf->flags & (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) ==
+	(RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) {
         surf->stencil_offset = ALIGN(surf->bo_size, surf->bo_alignment);
         surf->bo_size = surf->stencil_offset + surf->bo_size / 4;
     }
@@ -656,7 +660,8 @@ static int eg_surface_init_2d(struct radeon_surface_manager *surf_man,
         }
     }
 
-    if (surf->flags & RADEON_SURF_SBUFFER) {
+    if ((surf->flags & (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) ==
+	(RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) {
         surf->stencil_offset = ALIGN(surf->bo_size, surf->bo_alignment);
         surf->bo_size = surf->stencil_offset + surf->bo_size / 4;
     }
@@ -752,14 +757,7 @@ static int eg_surface_init(struct radeon_surface_manager *surf_man,
     /* tiling mode */
     mode = (surf->flags >> RADEON_SURF_MODE_SHIFT) & RADEON_SURF_MODE_MASK;
 
-    /* for some reason eg need to have room for stencil right after depth */
-    if (surf->flags & RADEON_SURF_ZBUFFER) {
-        surf->flags |= RADEON_SURF_SBUFFER;
-    }
-    if (surf->flags & RADEON_SURF_SBUFFER) {
-        surf->flags |= RADEON_SURF_ZBUFFER;
-    }
-    if (surf->flags & RADEON_SURF_ZBUFFER) {
+    if (surf->flags & (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) {
         /* zbuffer only support 1D or 2D tiled surface */
         switch (mode) {
         case RADEON_SURF_MODE_1D:
@@ -828,11 +826,6 @@ static int eg_surface_best(struct radeon_surface_manager *surf_man,
     /* tiling mode */
     mode = (surf->flags >> RADEON_SURF_MODE_SHIFT) & RADEON_SURF_MODE_MASK;
 
-    /* for some reason eg need to have room for stencil right after depth */
-    if (surf->flags & RADEON_SURF_ZBUFFER) {
-        surf->flags |= RADEON_SURF_SBUFFER;
-    }
-
     /* set some default value to avoid sanity check choking on them */
     surf->tile_split = 1024;
     surf->bankw = 1;
Signature · 1 line
1.7.9.5
Reviewed-by on v1 1/2
#13 lore raw
In reply to Marek Olšák

I wanted to work on something similar this week, cause we need some updates for SI on this.

So thx, you saved me some work here. And both patches are:

Quoted 25 lines · Marek Olšák

Setting those flags has no effect anywhere else.

---
  radeon/radeon_surface.c |    9 +--------
  1 file changed, 1 insertion(+), 8 deletions(-)
radeon/radeon_surface.c +1 -8
index c80f7f4..5800c33 100644
@@ -385,14 +385,7 @@ static int r6_surface_init(struct radeon_surface_manager *surf_man,
      /* tiling mode */
      mode = (surf->flags >> RADEON_SURF_MODE_SHIFT) & RADEON_SURF_MODE_MASK;
 
-    /* always enable z & stencil together */
-    if (surf->flags & RADEON_SURF_ZBUFFER) {
-        surf->flags |= RADEON_SURF_SBUFFER;
-    }
-    if (surf->flags & RADEON_SURF_SBUFFER) {
-        surf->flags |= RADEON_SURF_ZBUFFER;
-    }
-    if (surf->flags & RADEON_SURF_ZBUFFER) {
+    if (surf->flags & (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) {
          /* zbuffer only support 1D or 2D tiled surface */
          switch (mode) {
          case RADEON_SURF_MODE_1D:
#3 lore raw

Re: [PATCH 2/2] radeon: optimize allocation for depth w/o stencil and stencil w/o depth on EG

In reply to Marek Olšák
Quoted 4 lines · Marek Olšák

If we don't need stencil, don't allocate it.
If we need only stencil (like PIPE_FORMAT_S8_UINT), don't allocate depth.

v2: actually do it correctly

Big NAK

We need to allocate stencil and depth no matter what. Otherwise it will lockup. You can take a look by poisonning the surface and see that when stencil is disabled or depth is disabled the hw still write to it.

Cheers,
Jerome

Quoted 62 lines
---
 radeon/radeon_surface.c |   23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)
radeon/radeon_surface.c +8 -16
index 5800c33..874a092 100644
@@ -604,7 +604,11 @@ static int eg_surface_init_1d(struct radeon_surface_manager *surf_man,
         }
     }
 
-    if (surf->flags & RADEON_SURF_SBUFFER) {
+    /* The depth and stencil buffers are in separate resources on evergreen.
+     * We allocate them in one buffer next to each other to simplify
+     * communication between the DDX and the Mesa driver. */
+    if ((surf->flags & (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) ==
+       (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) {
         surf->stencil_offset = ALIGN(surf->bo_size, surf->bo_alignment);
         surf->bo_size = surf->stencil_offset + surf->bo_size / 4;
     }
@@ -656,7 +660,8 @@ static int eg_surface_init_2d(struct radeon_surface_manager *surf_man,
         }
     }
 
-    if (surf->flags & RADEON_SURF_SBUFFER) {
+    if ((surf->flags & (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) ==
+       (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) {
         surf->stencil_offset = ALIGN(surf->bo_size, surf->bo_alignment);
         surf->bo_size = surf->stencil_offset + surf->bo_size / 4;
     }
@@ -752,14 +757,7 @@ static int eg_surface_init(struct radeon_surface_manager *surf_man,
     /* tiling mode */
     mode = (surf->flags >> RADEON_SURF_MODE_SHIFT) & RADEON_SURF_MODE_MASK;
 
-    /* for some reason eg need to have room for stencil right after depth */
-    if (surf->flags & RADEON_SURF_ZBUFFER) {
-        surf->flags |= RADEON_SURF_SBUFFER;
-    }
-    if (surf->flags & RADEON_SURF_SBUFFER) {
-        surf->flags |= RADEON_SURF_ZBUFFER;
-    }
-    if (surf->flags & RADEON_SURF_ZBUFFER) {
+    if (surf->flags & (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) {
         /* zbuffer only support 1D or 2D tiled surface */
         switch (mode) {
         case RADEON_SURF_MODE_1D:
@@ -828,11 +826,6 @@ static int eg_surface_best(struct radeon_surface_manager *surf_man,
     /* tiling mode */
     mode = (surf->flags >> RADEON_SURF_MODE_SHIFT) & RADEON_SURF_MODE_MASK;
 
-    /* for some reason eg need to have room for stencil right after depth */
-    if (surf->flags & RADEON_SURF_ZBUFFER) {
-        surf->flags |= RADEON_SURF_SBUFFER;
-    }
-
     /* set some default value to avoid sanity check choking on them */
     surf->tile_split = 1024;
     surf->bankw = 1;
--

1.7.9.5

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

Re: [PATCH 2/2] radeon: optimize allocation for depth w/o stencil and stencil w/o depth on EG

Quoted 11 lines · Jerome Glisse
Quoted 4 lines · Marek Olšák

If we don't need stencil, don't allocate it.
If we need only stencil (like PIPE_FORMAT_S8_UINT), don't allocate depth.

v2: actually do it correctly

Big NAK

We need to allocate stencil and depth no matter what. Otherwise it will lockup. You can take a look by poisonning the surface and see that when stencil is disabled or depth is disabled the hw still write to it.

Really? That bug is new to me, at least on SI that works perfectly (currently working on it), so on which hardware do you see that behavior?

Anyway, when we have hardware bugs that enabling depth also enables stencil we should handle that in the hardware specific drivers, not in general purpose code.

Cheers,
Christian.

Quoted 66 lines

Cheers,
Jerome

Quoted 62 lines
---
  radeon/radeon_surface.c |   23 ++++++++---------------
  1 file changed, 8 insertions(+), 15 deletions(-)
radeon/radeon_surface.c +8 -16
index 5800c33..874a092 100644
@@ -604,7 +604,11 @@ static int eg_surface_init_1d(struct radeon_surface_manager *surf_man,
          }
      }
 
-    if (surf->flags & RADEON_SURF_SBUFFER) {
+    /* The depth and stencil buffers are in separate resources on evergreen.
+     * We allocate them in one buffer next to each other to simplify
+     * communication between the DDX and the Mesa driver. */
+    if ((surf->flags & (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) ==
+       (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) {
          surf->stencil_offset = ALIGN(surf->bo_size, surf->bo_alignment);
          surf->bo_size = surf->stencil_offset + surf->bo_size / 4;
      }
@@ -656,7 +660,8 @@ static int eg_surface_init_2d(struct radeon_surface_manager *surf_man,
          }
      }
 
-    if (surf->flags & RADEON_SURF_SBUFFER) {
+    if ((surf->flags & (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) ==
+       (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) {
          surf->stencil_offset = ALIGN(surf->bo_size, surf->bo_alignment);
          surf->bo_size = surf->stencil_offset + surf->bo_size / 4;
      }
@@ -752,14 +757,7 @@ static int eg_surface_init(struct radeon_surface_manager *surf_man,
      /* tiling mode */
      mode = (surf->flags >> RADEON_SURF_MODE_SHIFT) & RADEON_SURF_MODE_MASK;
 
-    /* for some reason eg need to have room for stencil right after depth */
-    if (surf->flags & RADEON_SURF_ZBUFFER) {
-        surf->flags |= RADEON_SURF_SBUFFER;
-    }
-    if (surf->flags & RADEON_SURF_SBUFFER) {
-        surf->flags |= RADEON_SURF_ZBUFFER;
-    }
-    if (surf->flags & RADEON_SURF_ZBUFFER) {
+    if (surf->flags & (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) {
          /* zbuffer only support 1D or 2D tiled surface */
          switch (mode) {
          case RADEON_SURF_MODE_1D:
@@ -828,11 +826,6 @@ static int eg_surface_best(struct radeon_surface_manager *surf_man,
      /* tiling mode */
      mode = (surf->flags >> RADEON_SURF_MODE_SHIFT) & RADEON_SURF_MODE_MASK;
 
-    /* for some reason eg need to have room for stencil right after depth */
-    if (surf->flags & RADEON_SURF_ZBUFFER) {
-        surf->flags |= RADEON_SURF_SBUFFER;
-    }
-
      /* set some default value to avoid sanity check choking on them */
      surf->tile_split = 1024;
      surf->bankw = 1;
--

1.7.9.5

Quoted 8 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

Re: [PATCH 2/2] radeon: optimize allocation for depth w/o stencil and stencil w/o depth on EG

Quoted 11 lines · Christian König
Quoted 10 lines · Jerome Glisse
Quoted 5 lines · Marek Olšák

If we don't need stencil, don't allocate it.
If we need only stencil (like PIPE_FORMAT_S8_UINT), don't allocate depth.

v2: actually do it correctly

Big NAK

Quoted 8 lines
Quoted 4 lines

We need to allocate stencil and depth no matter what. Otherwise it will lockup. You can take a look by poisonning the surface and see that when stencil is disabled or depth is disabled the hw still write to it.

Really? That bug is new to me, at least on SI that works perfectly (currently working on it), so on which hardware do you see that behavior?

I must have put which GPU are affected in one commit either ddx, mesa or libdrm. From memory all evergreen but not in all case and cayman in all case.

Cheers,
Jerome

Quoted 7 lines

Anyway, when we have hardware bugs that enabling depth also enables stencil we should handle that in the hardware specific drivers, not in general purpose code.

Cheers,
Christian.

At time it was the easiest solution to put it there.

Cheers,
Jerome
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw

Re: [PATCH 2/2] radeon: optimize allocation for depth w/o stencil and stencil w/o depth on EG

In reply to Jerome Glisse
Quoted 4 lines · Jerome Glisse
Quoted 3 lines · Marek Olšák

If we don't need stencil, don't allocate it.
If we need only stencil (like PIPE_FORMAT_S8_UINT), don't allocate depth.

Quoted 8 lines
Quoted 1 line

v2: actually do it correctly

Big NAK

We need to allocate stencil and depth no matter what. Otherwise it will lockup. You can take a look by poisonning the surface and see that when stencil is disabled or depth is disabled the hw still write to it.

:)

If what you say is true, then we're in a big trouble. Regardless of this patch, we're in it right now, because we cannot fully disable depth or stencil if the user binds a NULL zbuffer. That's clearly the kind of issue that cannot be fixed in the allocator code and should be fixed in r600g where the hardware is programmed.

I *think* that the correct way to disable Z or stencil is to set the Z_INVALID or STENCIL_INVALID format, respectively, and not by disabling reads and writes. (cc'ing Alex to confirm that if he can). I don't think the hardware designers have added those "invalid" formats just for the lulz. Please see my latest kernel patch "drm/radeon/kms:
allow "invalid" DB formats as a means to disable DB" that tries to address this issue.

For r600g, I was thinking of allocating a dummy buffer that will be always bound in case the depth or stencil buffer or both are missing. Either way, we should find how to get around this issue without wasting memory, especially when there are other options to try.

BTW, before we used this allocator, we allocated the depth and stencil buffers in separate resources. We might need to get back to it in the future if Gallium grows separate depth and stencil buffer bindings.

Marek
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#12 lore raw

Re: [PATCH 2/2] radeon: optimize allocation for depth w/o stencil and stencil w/o depth on EG

In reply to Jerome Glisse

Am 30.07.2012 16:56, schrieb Jerome Glisse:

Quoted 12 lines · Marek Olšák
Quoted 4 lines

If we don't need stencil, don't allocate it.
If we need only stencil (like PIPE_FORMAT_S8_UINT), don't allocate depth.

v2: actually do it correctly

Big NAK

We need to allocate stencil and depth no matter what. Otherwise it will lockup. You can take a look by poisonning the surface and see that when stencil is disabled or depth is disabled the hw still write to it.

That seems weird - bandwidth is a precious resource. Is that because of some misconfiguration elsewhere? Or hiz buffers or the like?

Roland

Quoted 66 lines

Cheers,
Jerome

Quoted 62 lines
---
 radeon/radeon_surface.c |   23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)
radeon/radeon_surface.c +8 -16
index 5800c33..874a092 100644
@@ -604,7 +604,11 @@ static int eg_surface_init_1d(struct radeon_surface_manager *surf_man,
         }
     }
 
-    if (surf->flags & RADEON_SURF_SBUFFER) {
+    /* The depth and stencil buffers are in separate resources on evergreen.
+     * We allocate them in one buffer next to each other to simplify
+     * communication between the DDX and the Mesa driver. */
+    if ((surf->flags & (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) ==
+       (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) {
         surf->stencil_offset = ALIGN(surf->bo_size, surf->bo_alignment);
         surf->bo_size = surf->stencil_offset + surf->bo_size / 4;
     }
@@ -656,7 +660,8 @@ static int eg_surface_init_2d(struct radeon_surface_manager *surf_man,
         }
     }
 
-    if (surf->flags & RADEON_SURF_SBUFFER) {
+    if ((surf->flags & (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) ==
+       (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) {
         surf->stencil_offset = ALIGN(surf->bo_size, surf->bo_alignment);
         surf->bo_size = surf->stencil_offset + surf->bo_size / 4;
     }
@@ -752,14 +757,7 @@ static int eg_surface_init(struct radeon_surface_manager *surf_man,
     /* tiling mode */
     mode = (surf->flags >> RADEON_SURF_MODE_SHIFT) & RADEON_SURF_MODE_MASK;
 
-    /* for some reason eg need to have room for stencil right after depth */
-    if (surf->flags & RADEON_SURF_ZBUFFER) {
-        surf->flags |= RADEON_SURF_SBUFFER;
-    }
-    if (surf->flags & RADEON_SURF_SBUFFER) {
-        surf->flags |= RADEON_SURF_ZBUFFER;
-    }
-    if (surf->flags & RADEON_SURF_ZBUFFER) {
+    if (surf->flags & (RADEON_SURF_ZBUFFER | RADEON_SURF_SBUFFER)) {
         /* zbuffer only support 1D or 2D tiled surface */
         switch (mode) {
         case RADEON_SURF_MODE_1D:
@@ -828,11 +826,6 @@ static int eg_surface_best(struct radeon_surface_manager *surf_man,
     /* tiling mode */
     mode = (surf->flags >> RADEON_SURF_MODE_SHIFT) & RADEON_SURF_MODE_MASK;
 
-    /* for some reason eg need to have room for stencil right after depth */
-    if (surf->flags & RADEON_SURF_ZBUFFER) {
-        surf->flags |= RADEON_SURF_SBUFFER;
-    }
-
     /* set some default value to avoid sanity check choking on them */
     surf->tile_split = 1024;
     surf->bankw = 1;
--

1.7.9.5

Quoted 9 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw

Re: [PATCH 2/2] radeon: optimize allocation for depth w/o stencil and stencil w/o depth on EG

In reply to Marek Olšák
Quoted 22 lines · Marek Olšák
Quoted 4 lines · Jerome Glisse
Quoted 3 lines · Marek Olšák

If we don't need stencil, don't allocate it.
If we need only stencil (like PIPE_FORMAT_S8_UINT), don't allocate depth.

Quoted 8 lines
Quoted 1 line

v2: actually do it correctly

Big NAK

We need to allocate stencil and depth no matter what. Otherwise it will lockup. You can take a look by poisonning the surface and see that when stencil is disabled or depth is disabled the hw still write to it.

:)

If what you say is true, then we're in a big trouble. Regardless of this patch, we're in it right now, because we cannot fully disable depth or stencil if the user binds a NULL zbuffer. That's clearly the kind of issue that cannot be fixed in the allocator code and should be fixed in r600g where the hardware is programmed.

Quoted 7 lines

I *think* that the correct way to disable Z or stencil is to set the Z_INVALID or STENCIL_INVALID format, respectively, and not by disabling reads and writes. (cc'ing Alex to confirm that if he can). I don't think the hardware designers have added those "invalid" formats just for the lulz. Please see my latest kernel patch "drm/radeon/kms:
allow "invalid" DB formats as a means to disable DB" that tries to address this issue.

That is correct. I just verified with the hw team. If you allocate both buffers there are some restrictions in that they share tiling parameters, but you can set either buffer to _INVALID and allocate one or the other independently.

Alex

Quoted 10 lines

For r600g, I was thinking of allocating a dummy buffer that will be always bound in case the depth or stencil buffer or both are missing. Either way, we should find how to get around this issue without wasting memory, especially when there are other options to try.

BTW, before we used this allocator, we allocated the depth and stencil buffers in separate resources. We might need to get back to it in the future if Gallium grows separate depth and stencil buffer bindings.

Quoted 5 lines

Marek
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw

Re: [PATCH 2/2] radeon: optimize allocation for depth w/o stencil and stencil w/o depth on EG

Quoted 31 lines · Alex Deucher
Quoted 22 lines · Marek Olšák
Quoted 4 lines · Jerome Glisse
Quoted 3 lines · Marek Olšák

If we don't need stencil, don't allocate it.
If we need only stencil (like PIPE_FORMAT_S8_UINT), don't allocate depth.

Quoted 8 lines
Quoted 1 line

v2: actually do it correctly

Big NAK

We need to allocate stencil and depth no matter what. Otherwise it will lockup. You can take a look by poisonning the surface and see that when stencil is disabled or depth is disabled the hw still write to it.

:)

If what you say is true, then we're in a big trouble. Regardless of this patch, we're in it right now, because we cannot fully disable depth or stencil if the user binds a NULL zbuffer. That's clearly the kind of issue that cannot be fixed in the allocator code and should be fixed in r600g where the hardware is programmed.

Quoted 7 lines

I *think* that the correct way to disable Z or stencil is to set the Z_INVALID or STENCIL_INVALID format, respectively, and not by disabling reads and writes. (cc'ing Alex to confirm that if he can). I don't think the hardware designers have added those "invalid" formats just for the lulz. Please see my latest kernel patch "drm/radeon/kms:
allow "invalid" DB formats as a means to disable DB" that tries to address this issue.

Quoted 4 lines

That is correct. I just verified with the hw team. If you allocate both buffers there are some restrictions in that they share tiling parameters, but you can set either buffer to _INVALID and allocate one or the other independently.

Some further clarifications from the hw team. If you want to have truly independent z and stencil buffers that allows for mixing and matching, you need to make sure that any z and stencil buffer that can be bound together must share the same addressing parameters (except tile split), and you must disable the htile buffer on evergreen and before (DB_Z_INFO.TILE_SURFACE_ENABLE=0) or disable the htile buffer for stencil on cayman and newer (DB_STENCIL_INFO.TILE_STENCIL_DISABLE=1). If you are only interested in unbinding z or stencil independently (but not mixing and matching) then you don't need to the above restrictions on the htile buffer. You can do so by setting the format to INVALID.

Alex
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#9 lore raw

Re: [PATCH 2/2] radeon: optimize allocation for depth w/o stencil and stencil w/o depth on EG

Quoted 49 lines · Alex Deucher
Quoted 31 lines · Alex Deucher
Quoted 22 lines · Marek Olšák
Quoted 4 lines · Jerome Glisse
Quoted 3 lines · Marek Olšák

If we don't need stencil, don't allocate it.
If we need only stencil (like PIPE_FORMAT_S8_UINT), don't allocate depth.

Quoted 8 lines
Quoted 1 line

v2: actually do it correctly

Big NAK

We need to allocate stencil and depth no matter what. Otherwise it will lockup. You can take a look by poisonning the surface and see that when stencil is disabled or depth is disabled the hw still write to it.

:)

If what you say is true, then we're in a big trouble. Regardless of this patch, we're in it right now, because we cannot fully disable depth or stencil if the user binds a NULL zbuffer. That's clearly the kind of issue that cannot be fixed in the allocator code and should be fixed in r600g where the hardware is programmed.

Quoted 7 lines

I *think* that the correct way to disable Z or stencil is to set the Z_INVALID or STENCIL_INVALID format, respectively, and not by disabling reads and writes. (cc'ing Alex to confirm that if he can). I don't think the hardware designers have added those "invalid" formats just for the lulz. Please see my latest kernel patch "drm/radeon/kms:
allow "invalid" DB formats as a means to disable DB" that tries to address this issue.

Quoted 4 lines

That is correct. I just verified with the hw team. If you allocate both buffers there are some restrictions in that they share tiling parameters, but you can set either buffer to _INVALID and allocate one or the other independently.

Some further clarifications from the hw team. If you want to have truly independent z and stencil buffers that allows for mixing and matching, you need to make sure that any z and stencil buffer that can be bound together must share the same addressing parameters (except tile split), and you must disable the htile buffer on evergreen and before (DB_Z_INFO.TILE_SURFACE_ENABLE=0) or disable the htile buffer for stencil on cayman and newer (DB_STENCIL_INFO.TILE_STENCIL_DISABLE=1). If you are only interested in unbinding z or stencil independently (but not mixing and matching) then you don't need to the above restrictions on the htile buffer. You can do so by setting the format to INVALID.

Quoted 1 line

Alex

Well somehow i can't reproduce might have been fixed by something like render backend fix. I should have write down how i saw this back in the day.

Cheers,
Jerome
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#10 lore raw

Re: [PATCH 2/2] radeon: optimize allocation for depth w/o stencil and stencil w/o depth on EG

Quoted 50 lines · Jerome Glisse
Quoted 49 lines · Alex Deucher
Quoted 31 lines · Alex Deucher
Quoted 22 lines · Marek Olšák
Quoted 4 lines · Jerome Glisse
Quoted 3 lines · Marek Olšák

If we don't need stencil, don't allocate it.
If we need only stencil (like PIPE_FORMAT_S8_UINT), don't allocate depth.

Quoted 8 lines
Quoted 1 line

v2: actually do it correctly

Big NAK

We need to allocate stencil and depth no matter what. Otherwise it will lockup. You can take a look by poisonning the surface and see that when stencil is disabled or depth is disabled the hw still write to it.

:)

If what you say is true, then we're in a big trouble. Regardless of this patch, we're in it right now, because we cannot fully disable depth or stencil if the user binds a NULL zbuffer. That's clearly the kind of issue that cannot be fixed in the allocator code and should be fixed in r600g where the hardware is programmed.

Quoted 7 lines

I *think* that the correct way to disable Z or stencil is to set the Z_INVALID or STENCIL_INVALID format, respectively, and not by disabling reads and writes. (cc'ing Alex to confirm that if he can). I don't think the hardware designers have added those "invalid" formats just for the lulz. Please see my latest kernel patch "drm/radeon/kms:
allow "invalid" DB formats as a means to disable DB" that tries to address this issue.

Quoted 4 lines

That is correct. I just verified with the hw team. If you allocate both buffers there are some restrictions in that they share tiling parameters, but you can set either buffer to _INVALID and allocate one or the other independently.

Some further clarifications from the hw team. If you want to have truly independent z and stencil buffers that allows for mixing and matching, you need to make sure that any z and stencil buffer that can be bound together must share the same addressing parameters (except tile split), and you must disable the htile buffer on evergreen and before (DB_Z_INFO.TILE_SURFACE_ENABLE=0) or disable the htile buffer for stencil on cayman and newer (DB_STENCIL_INFO.TILE_STENCIL_DISABLE=1). If you are only interested in unbinding z or stencil independently (but not mixing and matching) then you don't need to the above restrictions on the htile buffer. You can do so by setting the format to INVALID.

Quoted 5 lines
Quoted 1 line

Alex

Well somehow i can't reproduce might have been fixed by something like render backend fix. I should have write down how i saw this back in the day.

I think it was related to tiling. I remember you mentioning something about that at the time.

Alex

#11 lore raw

Re: [PATCH 2/2] radeon: optimize allocation for depth w/o stencil and stencil w/o depth on EG

Quoted 53 lines · Alex Deucher
Quoted 52 lines · Jerome Glisse
Quoted 50 lines · Alex Deucher
Quoted 31 lines · Alex Deucher
Quoted 22 lines · Marek Olšák
Quoted 4 lines · Jerome Glisse
Quoted 3 lines · Marek Olšák

If we don't need stencil, don't allocate it.
If we need only stencil (like PIPE_FORMAT_S8_UINT), don't allocate depth.

Quoted 8 lines
Quoted 1 line

v2: actually do it correctly

Big NAK

We need to allocate stencil and depth no matter what. Otherwise it will lockup. You can take a look by poisonning the surface and see that when stencil is disabled or depth is disabled the hw still write to it.

:)

If what you say is true, then we're in a big trouble. Regardless of this patch, we're in it right now, because we cannot fully disable depth or stencil if the user binds a NULL zbuffer. That's clearly the kind of issue that cannot be fixed in the allocator code and should be fixed in r600g where the hardware is programmed.

Quoted 7 lines

I *think* that the correct way to disable Z or stencil is to set the Z_INVALID or STENCIL_INVALID format, respectively, and not by disabling reads and writes. (cc'ing Alex to confirm that if he can). I don't think the hardware designers have added those "invalid" formats just for the lulz. Please see my latest kernel patch "drm/radeon/kms:
allow "invalid" DB formats as a means to disable DB" that tries to address this issue.

Quoted 4 lines

That is correct. I just verified with the hw team. If you allocate both buffers there are some restrictions in that they share tiling parameters, but you can set either buffer to _INVALID and allocate one or the other independently.

Some further clarifications from the hw team. If you want to have truly independent z and stencil buffers that allows for mixing and matching, you need to make sure that any z and stencil buffer that can be bound together must share the same addressing parameters (except tile split), and you must disable the htile buffer on evergreen and before (DB_Z_INFO.TILE_SURFACE_ENABLE=0) or disable the htile buffer for stencil on cayman and newer (DB_STENCIL_INFO.TILE_STENCIL_DISABLE=1). If you are only interested in unbinding z or stencil independently (but not mixing and matching) then you don't need to the above restrictions on the htile buffer. You can do so by setting the format to INVALID.

Alex

Quoted 8 lines
Quoted 3 lines

Well somehow i can't reproduce might have been fixed by something like render backend fix. I should have write down how i saw this back in the day.

I think it was related to tiling. I remember you mentioning something about that at the time.

Alex

Yeah might be tiling related, surface allocator probably got the bo size right.

Cheers,
Jerime
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel