All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] radeon: avoid possible divide by 0 in surface manager
@ 2013-12-10 17:42 Alex Deucher
  2013-12-10 22:35 ` Marek Olšák
  2013-12-11  0:39 ` Michel Dänzer
  0 siblings, 2 replies; 4+ messages in thread
From: Alex Deucher @ 2013-12-10 17:42 UTC (permalink / raw)
  To: dri-devel; +Cc: Alex Deucher

Some users report hitting a divide by 0 with the tile split in
certain apps.  Tile_split shouldn't ever be 0 unless the surface
structure was not properly initialized.  I think there may be some
cases where mesa uses an improperly initialized surface struct,
but I haven't had time to track it down.

Bug:
https://bugs.freedesktop.org/show_bug.cgi?id=72425

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 radeon/radeon_surface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/radeon/radeon_surface.c b/radeon/radeon_surface.c
index dcbbfdc..15127d4 100644
--- a/radeon/radeon_surface.c
+++ b/radeon/radeon_surface.c
@@ -655,7 +655,7 @@ static int eg_surface_init_2d(struct radeon_surface_manager *surf_man,
     tileb = tilew * tileh * bpe * surf->nsamples;
     /* slices per tile */
     slice_pt = 1;
-    if (tileb > tile_split) {
+    if (tileb > tile_split && tile_split) {
         slice_pt = tileb / tile_split;
     }
     tileb = tileb / slice_pt;
@@ -1621,7 +1621,7 @@ static int si_surface_init_2d(struct radeon_surface_manager *surf_man,
     tileb = tilew * tileh * bpe * surf->nsamples;
     /* slices per tile */
     slice_pt = 1;
-    if (tileb > tile_split) {
+    if (tileb > tile_split && tile_split) {
         slice_pt = tileb / tile_split;
     }
     tileb = tileb / slice_pt;
@@ -2223,7 +2223,7 @@ static int cik_surface_init_2d(struct radeon_surface_manager *surf_man,
 
     /* slices per tile */
     slice_pt = 1;
-    if (tileb > tile_split) {
+    if (tileb > tile_split && tile_split) {
         slice_pt = tileb / tile_split;
         tileb = tileb / slice_pt;
     }
-- 
1.8.3.1

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

* Re: [PATCH] radeon: avoid possible divide by 0 in surface manager
  2013-12-10 17:42 [PATCH] radeon: avoid possible divide by 0 in surface manager Alex Deucher
@ 2013-12-10 22:35 ` Marek Olšák
  2013-12-11  0:39 ` Michel Dänzer
  1 sibling, 0 replies; 4+ messages in thread
From: Marek Olšák @ 2013-12-10 22:35 UTC (permalink / raw)
  To: Alex Deucher; +Cc: Alex Deucher, dri-devel

Reviewed-by: Marek Olšák <marek.olsak@amd.com>

Marek

On Tue, Dec 10, 2013 at 6:42 PM, Alex Deucher <alexdeucher@gmail.com> wrote:
> Some users report hitting a divide by 0 with the tile split in
> certain apps.  Tile_split shouldn't ever be 0 unless the surface
> structure was not properly initialized.  I think there may be some
> cases where mesa uses an improperly initialized surface struct,
> but I haven't had time to track it down.
>
> Bug:
> https://bugs.freedesktop.org/show_bug.cgi?id=72425
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  radeon/radeon_surface.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/radeon/radeon_surface.c b/radeon/radeon_surface.c
> index dcbbfdc..15127d4 100644
> --- a/radeon/radeon_surface.c
> +++ b/radeon/radeon_surface.c
> @@ -655,7 +655,7 @@ static int eg_surface_init_2d(struct radeon_surface_manager *surf_man,
>      tileb = tilew * tileh * bpe * surf->nsamples;
>      /* slices per tile */
>      slice_pt = 1;
> -    if (tileb > tile_split) {
> +    if (tileb > tile_split && tile_split) {
>          slice_pt = tileb / tile_split;
>      }
>      tileb = tileb / slice_pt;
> @@ -1621,7 +1621,7 @@ static int si_surface_init_2d(struct radeon_surface_manager *surf_man,
>      tileb = tilew * tileh * bpe * surf->nsamples;
>      /* slices per tile */
>      slice_pt = 1;
> -    if (tileb > tile_split) {
> +    if (tileb > tile_split && tile_split) {
>          slice_pt = tileb / tile_split;
>      }
>      tileb = tileb / slice_pt;
> @@ -2223,7 +2223,7 @@ static int cik_surface_init_2d(struct radeon_surface_manager *surf_man,
>
>      /* slices per tile */
>      slice_pt = 1;
> -    if (tileb > tile_split) {
> +    if (tileb > tile_split && tile_split) {
>          slice_pt = tileb / tile_split;
>          tileb = tileb / slice_pt;
>      }
> --
> 1.8.3.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] radeon: avoid possible divide by 0 in surface manager
  2013-12-10 17:42 [PATCH] radeon: avoid possible divide by 0 in surface manager Alex Deucher
  2013-12-10 22:35 ` Marek Olšák
@ 2013-12-11  0:39 ` Michel Dänzer
  2013-12-24 20:18   ` Alex Deucher
  1 sibling, 1 reply; 4+ messages in thread
From: Michel Dänzer @ 2013-12-11  0:39 UTC (permalink / raw)
  To: Alex Deucher; +Cc: dri-devel

On Die, 2013-12-10 at 12:42 -0500, Alex Deucher wrote:
> Some users report hitting a divide by 0 with the tile split in
> certain apps.  Tile_split shouldn't ever be 0 unless the surface
> structure was not properly initialized.  I think there may be some
> cases where mesa uses an improperly initialized surface struct,
> but I haven't had time to track it down.

It would be good to know where the bogus tile split is coming from
though — who knows what else might be wrong in that case?


-- 
Earthling Michel Dänzer            |                  http://www.amd.com
Libre software enthusiast          |                Mesa and X developer

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

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

* Re: [PATCH] radeon: avoid possible divide by 0 in surface manager
  2013-12-11  0:39 ` Michel Dänzer
@ 2013-12-24 20:18   ` Alex Deucher
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Deucher @ 2013-12-24 20:18 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: Maling list - DRI developers

On Tue, Dec 10, 2013 at 7:39 PM, Michel Dänzer <michel@daenzer.net> wrote:
> On Die, 2013-12-10 at 12:42 -0500, Alex Deucher wrote:
>> Some users report hitting a divide by 0 with the tile split in
>> certain apps.  Tile_split shouldn't ever be 0 unless the surface
>> structure was not properly initialized.  I think there may be some
>> cases where mesa uses an improperly initialized surface struct,
>> but I haven't had time to track it down.
>
> It would be good to know where the bogus tile split is coming from
> though — who knows what else might be wrong in that case?

Agreed.  The reporter updated the bug with the full backtrace, I just
haven't had a chance to look at it yet.
https://bugs.freedesktop.org/show_bug.cgi?id=72425

Alex

>
>
> --
> Earthling Michel Dänzer            |                  http://www.amd.com
> Libre software enthusiast          |                Mesa and X developer
>

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

end of thread, other threads:[~2013-12-24 20:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-10 17:42 [PATCH] radeon: avoid possible divide by 0 in surface manager Alex Deucher
2013-12-10 22:35 ` Marek Olšák
2013-12-11  0:39 ` Michel Dänzer
2013-12-24 20:18   ` Alex Deucher

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.