Skip to contentSkip to conversation

dri3: remove bogus condition for creating pixmap

PATCH New Ilia Mirkin 1 participant 2 messages Feb 4, 2018 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dri3: remove bogus condition for creating pixmap

Not clear what the depth % 8 was trying to protect against, but it was breaking 30bpp visuals with DRI3. Add it in to ensure that bitsPerPixel % 8 is 0, since there is plenty of bpp/8 math in the driver.

---
 src/nouveau_dri2.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
src/nouveau_dri2.c +4 -1
index cbb7b2a..ac0ca09 100644
@@ -1076,13 +1076,16 @@ static PixmapPtr nouveau_dri3_pixmap_from_fd(ScreenPtr screen, int fd, CARD16 wi
 	struct nouveau_bo *bo = NULL;
 	struct nouveau_pixmap *nvpix;
 
-	if (depth < 8 || depth > 32 || depth % 8)
+	if (depth < 8 || depth > 32)
 		return NULL;
 
 	pixmap = screen->CreatePixmap(screen, 0, 0, depth, 0);
 	if (!pixmap)
 		return NULL;
 
+	if (pixmap->drawable.bitsPerPixel % 8)
+		goto free_pixmap;
+
 	if (!screen->ModifyPixmapHeader(pixmap, width, height, 0, 0, stride, NULL))
 		goto free_pixmap;
 
Signature · 6 lines
2.13.6

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

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

#2 lore raw

PATCH 2/2 nv50/xv: add support for depth 30 xv output

Ostensibly it should probably be looking at the pixmap format. However it's always the window pixmap, so we can assume it's what we expect.

---
 src/nouveau_xv.c | 11 +++++++++--
 src/nv50_xv.c    |  3 ++-
 src/nvc0_xv.c    |  3 ++-
 3 files changed, 13 insertions(+), 4 deletions(-)
src/nouveau_xv.c +9 -2
index 0b6c4d4..2f1979a 100644
@@ -112,6 +112,13 @@ XF86VideoFormatRec NVFormats[NUM_FORMATS_ALL] =
 	{15, DirectColor}, {16, DirectColor}, {24, DirectColor}
 };
 
+#define NUM_FORMATS_NV50 8
+XF86VideoFormatRec NV50Formats[NUM_FORMATS_NV50] =
+{
+	{15, TrueColor}, {16, TrueColor}, {24, TrueColor}, {30, TrueColor},
+	{15, DirectColor}, {16, DirectColor}, {24, DirectColor}, {30, DirectColor}
+};
+
 #define NUM_NV04_OVERLAY_ATTRIBUTES 4
 XF86AttributeRec NV04OverlayAttributes[NUM_NV04_OVERLAY_ATTRIBUTES] =
 {
@@ -2042,8 +2049,8 @@ NV50SetupTexturedVideo (ScreenPtr pScreen)
 	adapt->name		= "Nouveau GeForce 8/9 Textured Video";
 	adapt->nEncodings	= 1;
 	adapt->pEncodings	= &DummyEncodingNV50;
-	adapt->nFormats		= NUM_FORMATS_ALL;
-	adapt->pFormats		= NVFormats;
+	adapt->nFormats		= NUM_FORMATS_NV50;
+	adapt->pFormats		= NV50Formats;
 	adapt->nPorts		= NUM_TEXTURE_PORTS;
 	adapt->pPortPrivates	= (DevUnion*)(&adapt[1]);
 
src/nv50_xv.c +2 -1
index b2541b9..ba01c99 100644
@@ -91,8 +91,9 @@ nv50_xv_image_put(ScrnInfoPtr pScrn,
 	BEGIN_NV04(push, NV50_3D(RT_ADDRESS_HIGH(0)), 5);
 	PUSH_DATA (push, dst->offset >> 32);
 	PUSH_DATA (push, dst->offset);
-	switch (ppix->drawable.bitsPerPixel) {
+	switch (ppix->drawable.depth) {
 	case 32: PUSH_DATA (push, NV50_SURFACE_FORMAT_BGRA8_UNORM); break;
+	case 30: PUSH_DATA (push, NV50_SURFACE_FORMAT_RGB10_A2_UNORM); break;
 	case 24: PUSH_DATA (push, NV50_SURFACE_FORMAT_BGRX8_UNORM); break;
 	case 16: PUSH_DATA (push, NV50_SURFACE_FORMAT_B5G6R5_UNORM); break;
 	case 15: PUSH_DATA (push, NV50_SURFACE_FORMAT_BGR5_X1_UNORM); break;
src/nvc0_xv.c +2 -1
index 5cecbf5..8842148 100644
@@ -89,8 +89,9 @@ nvc0_xv_image_put(ScrnInfoPtr pScrn,
 	PUSH_DATA (push, dst->offset);
 	PUSH_DATA (push, ppix->drawable.width);
 	PUSH_DATA (push, ppix->drawable.height);
-	switch (ppix->drawable.bitsPerPixel) {
+	switch (ppix->drawable.depth) {
 	case 32: PUSH_DATA (push, NV50_SURFACE_FORMAT_BGRA8_UNORM); break;
+	case 30: PUSH_DATA (push, NV50_SURFACE_FORMAT_RGB10_A2_UNORM); break;
 	case 24: PUSH_DATA (push, NV50_SURFACE_FORMAT_BGRX8_UNORM); break;
 	case 16: PUSH_DATA (push, NV50_SURFACE_FORMAT_B5G6R5_UNORM); break;
 	case 15: PUSH_DATA (push, NV50_SURFACE_FORMAT_BGR5_X1_UNORM); break;
Signature · 6 lines
2.13.6

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