ac/surface: set structure size and handle errors for AddrComputeBaseSwizzle
authorMarek Olšák <marek.olsak@amd.com>
Fri, 28 Jul 2017 21:53:19 +0000 (23:53 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 4 Aug 2017 00:10:04 +0000 (02:10 +0200)
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/amd/common/ac_surface.c

index 68700f4102403997fc1662271719262579e84b11..1eff4e51dd6333dc380601b17a1cde429b90b233 100644 (file)
@@ -714,12 +714,19 @@ static int gfx6_compute_surface(ADDR_HANDLE addrlib,
                ADDR_COMPUTE_BASE_SWIZZLE_INPUT AddrBaseSwizzleIn = {0};
                ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT AddrBaseSwizzleOut = {0};
 
+               AddrBaseSwizzleIn.size = sizeof(ADDR_COMPUTE_BASE_SWIZZLE_INPUT);
+               AddrBaseSwizzleOut.size = sizeof(ADDR_COMPUTE_BASE_SWIZZLE_OUTPUT);
+
                AddrBaseSwizzleIn.surfIndex = p_atomic_inc_return(config->info.surf_index) - 1;
                AddrBaseSwizzleIn.tileIndex = AddrSurfInfoIn.tileIndex;
                AddrBaseSwizzleIn.macroModeIndex = AddrSurfInfoOut.macroModeIndex;
                AddrBaseSwizzleIn.pTileInfo = AddrSurfInfoOut.pTileInfo;
                AddrBaseSwizzleIn.tileMode = AddrSurfInfoOut.tileMode;
-               AddrComputeBaseSwizzle(addrlib, &AddrBaseSwizzleIn, &AddrBaseSwizzleOut);
+
+               r = AddrComputeBaseSwizzle(addrlib, &AddrBaseSwizzleIn,
+                                          &AddrBaseSwizzleOut);
+               if (r != ADDR_OK)
+                       return r;
 
                assert(AddrBaseSwizzleOut.tileSwizzle <=
                       u_bit_consecutive(0, sizeof(surf->tile_swizzle) * 8));