Skip to contentSkip to conversation

Check before trying a solid fill

PATCH In review Ilia Mirkin 2 participants 4 messages May 19, 2015 3 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Check before trying a solid fill

Pre-nv50 has all sorts of funny requirements for non-copy alu operations, and will bail out of solid fills left and right. Account for that case and fall back to the memset.

---
 src/drmmode_display.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
src/drmmode_display.c +8 -5
index 7c1d2bb..2ca1dba 100644
@@ -410,12 +410,15 @@ drmmode_fbcon_copy(ScreenPtr pScreen)
 
 fallback:
 	if (pdpix) {
-		pNv->EXADriverPtr->PrepareSolid(pdpix, GXclear, ~0, 0);
-		pNv->EXADriverPtr->Solid(pdpix, 0, 0, w, h);
-		pNv->EXADriverPtr->DoneSolid(pdpix);
-		nouveau_bo_wait(pNv->scanout, NOUVEAU_BO_RDWR, pNv->client);
+		if (exa->PrepareSolid(pdpix, GXclear, ~0, 0)) {
+			exa->Solid(pdpix, 0, 0, w, h);
+			exa->DoneSolid(pdpix);
+			PUSH_KICK(pNv->pushbuf);
+			nouveau_bo_wait(pNv->scanout, NOUVEAU_BO_RDWR, pNv->client);
+			pScreen->DestroyPixmap(pdpix);
+			return;
+		}
 		pScreen->DestroyPixmap(pdpix);
-		return;
 	}
 #endif
 	if (nouveau_bo_map(pNv->scanout, NOUVEAU_BO_WR, pNv->client))
Signature · 6 lines
2.3.6

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): 1432067309-14175-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/[email protected]

#2 lore raw

PATCH 2/2 nv04-nv40: don't attempt to do 32-bit shifts

A 32-bit shift is a no-op, which will also make the new planemask get or'd with ~0, thus negating the usefulness of the subsequent planemask != ~0 check. Only do this if it's a less-than-32-bit per pixel format, in which case it will have the desired effect of setting the high bits.

---
 src/nv04_exa.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
src/nv04_exa.c +2 -1
index 7a58dd7..d5dec68 100644
@@ -49,7 +49,8 @@ NV04EXASetROP(PixmapPtr ppix, int subc, int mthd, int alu, Pixel planemask)
 	NVPtr pNv = NVPTR(pScrn);
 	struct nouveau_pushbuf *push = pNv->pushbuf;
 
-	planemask |= ~0 << ppix->drawable.bitsPerPixel;
+	if (ppix->drawable.bitsPerPixel < 32)
+		planemask |= ~0 << ppix->drawable.bitsPerPixel;
 	if (planemask != ~0 || alu != GXcopy) {
 		if (ppix->drawable.bitsPerPixel == 32)
 			return FALSE;
Signature · 6 lines
2.3.6

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): 1432067309-14175-2-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/[email protected]

Reviewed-by
#4 lore raw

Re: [PATCH 2/2] nv04-nv40: don't attempt to do 32-bit shifts

Quoted 16 lines · Ilia Mirkin

A 32-bit shift is a no-op, which will also make the new planemask get or'd with ~0, thus negating the usefulness of the subsequent planemask != ~0 check. Only do this if it's a less-than-32-bit per pixel format, in which case it will have the desired effect of setting the high bits.

---
  src/nv04_exa.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
src/nv04_exa.c +0 -0
index 7a58dd7..d5dec68 100644

src/nv04_exa.c NV04EXASetROP(PixmapPtr ppix, int subc, int mthd, int alu, Pixel planemask) · line 56

Quoted 9 lines
src/nv04_exa.c +2 -1
@@ -49,7 +49,8 @@ NV04EXASetROP(PixmapPtr ppix, int subc, int mthd, int alu, Pixel planemask)
  	NVPtr pNv = NVPTR(pScrn);
  	struct nouveau_pushbuf *push = pNv->pushbuf;
 
-	planemask |= ~0 << ppix->drawable.bitsPerPixel;
+	if (ppix->drawable.bitsPerPixel < 32)
+		planemask |= ~0 << ppix->drawable.bitsPerPixel;
  	if (planemask != ~0 || alu != GXcopy) {
  		if (ppix->drawable.bitsPerPixel == 32)
  			return FALSE;

Both patches look good to me. Thanks for tracking those bugs down :)

_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Re: [PATCH 2/2] nv04-nv40: don't attempt to do 32-bit shifts

Quoted 31 lines · Martin Peres
Quoted 17 lines · Ilia Mirkin

A 32-bit shift is a no-op, which will also make the new planemask get or'd with ~0, thus negating the usefulness of the subsequent planemask != ~0 check. Only do this if it's a less-than-32-bit per pixel format, in which case it will have the desired effect of setting the high bits.

---
  src/nv04_exa.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
src/nv04_exa.c +0 -0
index 7a58dd7..d5dec68 100644

src/nv04_exa.c NV04EXASetROP(PixmapPtr ppix, int subc, int mthd, int · line 56

Quoted 9 lines
src/nv04_exa.c +2 -0
@@ -49,7 +49,8 @@ NV04EXASetROP(PixmapPtr ppix, int subc, int mthd, int
 alu, Pixel planemask)
        NVPtr pNv = NVPTR(pScrn);
        struct nouveau_pushbuf *push = pNv->pushbuf;
  -     planemask |= ~0 << ppix->drawable.bitsPerPixel;
+       if (ppix->drawable.bitsPerPixel < 32)
+               planemask |= ~0 << ppix->drawable.bitsPerPixel;
        if (planemask != ~0 || alu != GXcopy) {
                if (ppix->drawable.bitsPerPixel == 32)
                        return FALSE;

Both patches look good to me. Thanks for tracking those bugs down :)

Quoted 1 line

Thanks! FWIW I just happened to notice this as I was reading the code, so it's untested and not in response to any bug. I have no idea if it actually affects things... I suspect planemask != ~0U is pretty rare to begin with, outside of things that test it explicitly.

-ilia
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau