Christoph Bumiller
2009-May-11 20:27 UTC
[Nouveau] [PATCH] nv50/gallium: small fix for nv50_transfer_rect_m2mf (sy <-> dy)
Hi ! I think src and dst starting positions got mixed up in nv50_transfer_rect_m2mf, there's a diff at the bottom of this message. This came up when trying to make the gearbox demo run correctly, but this change alone doesn't fix it. The mesa state tracker in st_cb_clear.c assumes Y_0_TOP when clearing the color buffer, but that seems to be wrong for NV50. When bypassing the viewport transformation, vertex position (0, 0) becomes bottom left, and not top. This is a problem in several other places. In st_atom_viewport.c, because of Y_0_TOP we get inverted viewport parameters, so the translations are wrong there, too, the image doesn't appear flipped though becasuse scale[1] gets negated again in nv50_state_validate (but the translation - inconsistenly - remains unchanged). Now one could do so_data (so, fui(-(nv50->viewport.translate[1] - nv50->framebuffer.height)); as well, which would make the viewport transformation correct, but the ST still outputs the wrong vertex coordinates for clear_with_quad. To fix both things, one could just let st_fb_orientation in st_context.h return Y_0_BOTTOM, but then glCopyTexSubImage2D (calling the appropriate function in st_cb_texture.c) flips the image and copies from the wrong offset, since offset 0 in memory is, well, top, as opposed to bottom like it seems to be for vertex coordinates that bypass the viewport ... Anyway, I guess I'm a bit confused now, and I don't know where to make the adjustment, in the nv50 driver or in the mesa state tracker (and how to NOT break all other drivers); but then, I guess this issue is probably not so important right now because no one uses and no one is working on the nv50 driver anyway. I just wanted to mention it once. Bye, Christoph. ------------------- diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c index 747195b..41d8160 100644 --- a/src/gallium/drivers/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nv50/nv50_transfer.c @@ -79,13 +79,13 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, struct pipe_buffer *src, OUT_RELOCl(chan, dst_bo, dst_offset, dst_reloc); if (src_bo->tiled) { BEGIN_RING(chan, m2mf, 0x0218, 1); - OUT_RING (chan, (dy << 16) | sx); + OUT_RING (chan, (sy << 16) | sx); } else { src_offset += (line_count * src_pitch); } if (dst_bo->tiled) { BEGIN_RING(chan, m2mf, 0x0234, 1); - OUT_RING (chan, (sy << 16) | dx); + OUT_RING (chan, (dy << 16) | dx); } else { dst_offset += (line_count * dst_pitch); } ---------------------------
Seemingly Similar Threads
- [MESA PATCH 5/5] nv50: update after nouveau_class.h update
- [PATCH] nouveau: avoid running out of relocs (attempt 3)
- [PATCH] nouveau: avoid running out of relocs (attempt 4)
- [PATCH] nouveau: avoid running out of relocs (attempt 5)
- [PATCH] nv50, nvc0: don't base decisions on available pushbuf space