From 5c4f80dca62dc514b04d5553f8be2626e2d62b9e Mon Sep 17 00:00:00 2001 From: Ilia Mirkin Date: Thu, 6 Mar 2014 00:51:48 -0500 Subject: [PATCH] nv50: adjust blit_3d handling of ms output textures This fixes some unwanted scaling when the output is multisampled. Signed-off-by: Ilia Mirkin Reviewed-by: Christoph Bumiller Cc: "10.0 10.1" (cherry picked from commit 253314d4872ab4c4f01c0f1cd31ce4b71877ec30) Also squashed in the following: Revert nvc0 part of "nv50: adjust blit_3d handling of ms output textures" The nvc0 bits don't appear to work, and I thought I had removed them from the commit. Oops. Signed-off-by: Ilia Mirkin Cc: "10.0 10.1" (cherry picked from commit 897f40f25d21af678b1b67c1a68c4a6722d19983) --- src/gallium/drivers/nouveau/nv50/nv50_surface.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/nouveau/nv50/nv50_surface.c b/src/gallium/drivers/nouveau/nv50/nv50_surface.c index 358f57aa6fb..bce84c504be 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_surface.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_surface.c @@ -935,6 +935,7 @@ nv50_blit_3d(struct nv50_context *nv50, const struct pipe_blit_info *info) float x0, x1, y0, y1, z; float dz; float x_range, y_range; + float tri_x, tri_y; blit->mode = nv50_blit_select_mode(info); blit->color_mask = nv50_blit_derive_color_mask(info); @@ -954,11 +955,14 @@ nv50_blit_3d(struct nv50_context *nv50, const struct pipe_blit_info *info) x_range = (float)info->src.box.width / (float)info->dst.box.width; y_range = (float)info->src.box.height / (float)info->dst.box.height; + tri_x = 16384 << nv50_miptree(dst)->ms_x; + tri_y = 16384 << nv50_miptree(dst)->ms_y; + x0 = (float)info->src.box.x - x_range * (float)info->dst.box.x; y0 = (float)info->src.box.y - y_range * (float)info->dst.box.y; - x1 = x0 + 16384.0f * x_range; - y1 = y0 + 16384.0f * y_range; + x1 = x0 + tri_x * x_range; + y1 = y0 + tri_y * y_range; x0 *= (float)(1 << nv50_miptree(src)->ms_x); x1 *= (float)(1 << nv50_miptree(src)->ms_x); @@ -1027,7 +1031,7 @@ nv50_blit_3d(struct nv50_context *nv50, const struct pipe_blit_info *info) PUSH_DATAf(push, y0); PUSH_DATAf(push, z); BEGIN_NV04(push, NV50_3D(VTX_ATTR_2F_X(0)), 2); - PUSH_DATAf(push, 16384 << nv50_miptree(dst)->ms_x); + PUSH_DATAf(push, tri_x); PUSH_DATAf(push, 0.0f); BEGIN_NV04(push, NV50_3D(VTX_ATTR_3F_X(1)), 3); PUSH_DATAf(push, x0); @@ -1035,7 +1039,7 @@ nv50_blit_3d(struct nv50_context *nv50, const struct pipe_blit_info *info) PUSH_DATAf(push, z); BEGIN_NV04(push, NV50_3D(VTX_ATTR_2F_X(0)), 2); PUSH_DATAf(push, 0.0f); - PUSH_DATAf(push, 16384 << nv50_miptree(dst)->ms_y); + PUSH_DATAf(push, tri_y); BEGIN_NV04(push, NV50_3D(VERTEX_END_GL), 1); PUSH_DATA (push, 0); }