dri3: remove bogus condition for creating pixmap
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 <[email protected]>
--- src/nouveau_dri2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
src/nouveau_dri2.c +4 -1
@@ -1076,13 +1076,16 @@ static PixmapPtr nouveau_dri3_pixmap_from_fd(ScreenPtr screen, int fd, CARD16 wistruct 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]
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 <[email protected]>
--- 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
@@ -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 4XF86AttributeRec 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
@@ -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
@@ -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