Ilia Mirkin
2018-Feb-04 18:58 UTC
[Nouveau] [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. Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu> --- src/nouveau_dri2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/nouveau_dri2.c b/src/nouveau_dri2.c index cbb7b2a..ac0ca09 100644 --- a/src/nouveau_dri2.c +++ b/src/nouveau_dri2.c @@ -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; -- 2.13.6
Ilia Mirkin
2018-Feb-04 18:58 UTC
[Nouveau] [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. Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu> --- src/nouveau_xv.c | 11 +++++++++-- src/nv50_xv.c | 3 ++- src/nvc0_xv.c | 3 ++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/nouveau_xv.c b/src/nouveau_xv.c index 0b6c4d4..2f1979a 100644 --- a/src/nouveau_xv.c +++ b/src/nouveau_xv.c @@ -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]); diff --git a/src/nv50_xv.c b/src/nv50_xv.c index b2541b9..ba01c99 100644 --- a/src/nv50_xv.c +++ b/src/nv50_xv.c @@ -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; diff --git a/src/nvc0_xv.c b/src/nvc0_xv.c index 5cecbf5..8842148 100644 --- a/src/nvc0_xv.c +++ b/src/nvc0_xv.c @@ -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; -- 2.13.6
Seemingly Similar Threads
- [PATCH 2/2] nv50/xv: add support for depth 30 xv output
- [PATCH 1/2] exa: Pre-G80 tiling support.
- NV50: xv fullscreen issues
- VNC 'fix' for 256 colour game only shows 2 colours?
- [PATCH v2 03/14] drm/fb-helper: do a generic fb_setcmap helper in terms of crtc .gamma_set