NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: xsrc/54167: Xorg wsfb server "Rotate" does not work on NetBSD 8.0



The following reply was made to PR xsrc/54167; it has been noted by GNATS.

From: Izumi Tsutsui <tsutsui%ceres.dti.ne.jp@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: macallan%netbsd.org@localhost, tsutsui%ceres.dti.ne.jp@localhost
Subject: Re: xsrc/54167: Xorg wsfb server "Rotate" does not work on NetBSD 8.0
Date: Wed, 18 Dec 2019 01:33:48 +0900

 >Synopsis:       Xorg wsfb server "Rotate" does not work on NetBSD 8.0
 
 I've confirmed xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c
 rev 1.29 causes this problem in rotate cases:
  http://cvsweb.netbsd.org/bsdweb.cgi/xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c#rev1.29
 
 >> support WSFB_VRAM_IS_SPLIT workaround for wildcat boards - use a shadow fb
 >> and copy dirty areas into both framebuffers
 >> now we can use X on Sun XVR-1200
 >> should work on XVR-500 and others as well
 
 ---
 @@ -957,8 +972,7 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
  #endif
  
  	if (fPtr->shadowFB) {
 -		fPtr->shadow = calloc(1, pScrn->virtualX * pScrn->virtualY *
 -		    pScrn->bitsPerPixel/8);
 +		fPtr->shadow = calloc(1, fPtr->fbi.fbi_stride * pScrn->virtualY);
  
  		if (!fPtr->shadow) {
  			xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 @@ -984,7 +998,9 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
  		    fPtr->shadowFB ? fPtr->shadow : fPtr->fbstart,
  		    pScrn->virtualX, pScrn->virtualY,
  		    pScrn->xDpi, pScrn->yDpi,
 -		    pScrn->displayWidth, pScrn->bitsPerPixel);
 +		    /* apparently fb wants stride in pixels, not bytes */
 +		    fPtr->fbi.fbi_stride / (pScrn->bitsPerPixel >> 3),
 +		    pScrn->bitsPerPixel);
  		break;
  	default:
  		xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 ---
 
 The following patch (use pScrn->virtualX instead of hardware fbi_stride
 in "rotate" cases) fixes CW case on Zaurus SL-C1000 and SL-C3000.
 
 Michael, could you confirm?
 
 Index: external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c
 ===================================================================
 RCS file: /cvsroot/xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c,v
 retrieving revision 1.35
 diff -u -p -d -r1.35 wsfb_driver.c
 --- external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c	23 Jul 2019 12:01:53 -0000	1.35
 +++ external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c	17 Dec 2019 16:10:40 -0000
 @@ -875,6 +875,7 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
  	int ret, flags, ncolors;
  	int wsmode = WSDISPLAYIO_MODE_DUMBFB;
  	int wstype;
 +	int width;
  	size_t len;
  
  	TRACE_ENTER("WsfbScreenInit");
 @@ -979,7 +980,17 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
  	fPtr->fbstart = fPtr->fbmem + fPtr->fbi.fbi_fboffset;
  
  	if (fPtr->shadowFB) {
 -		fPtr->shadow = calloc(1, fPtr->fbi.fbi_stride * pScrn->virtualY);
 +		if (fPtr->rotate) {
 +			len = pScrn->virtualX * pScrn->virtualY;
 +			if (pScrn->bitsPerPixel > 8) {
 +				len *= (pScrn->bitsPerPixel >> 3);
 +			} else {
 +				len /= (8 / pScrn->bitsPerPixel);
 +			}
 +		} else {
 +			len = fPtr->fbi.fbi_stride * pScrn->virtualY;
 +		}
 +		fPtr->shadow = calloc(1, len);
  
  		if (!fPtr->shadow) {
  			xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 @@ -988,13 +999,24 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
  		}
  	}
  
 +	if (fPtr->rotate) {
 +		width = pScrn->displayWidth;
 +	} else {
 +		if (pScrn->bitsPerPixel > 8) {
 +			width =
 +			    fPtr->fbi.fbi_stride / (pScrn->bitsPerPixel >> 3);
 +		} else {
 +			width =
 +			    fPtr->fbi.fbi_stride * (8 / pScrn->bitsPerPixel);
 +		}
 +	}
  	switch (pScrn->bitsPerPixel) {
  	case 1:
  		ret = fbScreenInit(pScreen,
  		    fPtr->fbstart,
  		    pScrn->virtualX, pScrn->virtualY,
  		    pScrn->xDpi, pScrn->yDpi,
 -		    fPtr->fbi.fbi_stride * 8, pScrn->bitsPerPixel);
 +		    width, pScrn->bitsPerPixel);
  		break;
  	case 4:
  	case 8:
 @@ -1005,8 +1027,7 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
  		    fPtr->shadowFB ? fPtr->shadow : fPtr->fbstart,
  		    pScrn->virtualX, pScrn->virtualY,
  		    pScrn->xDpi, pScrn->yDpi,
 -		    /* apparently fb wants stride in pixels, not bytes */
 -		    fPtr->fbi.fbi_stride / (pScrn->bitsPerPixel >> 3),
 +		    width,
  		    pScrn->bitsPerPixel);
  		break;
  	default:
 ---
 
 Thanks,
 ---
 Izumi Tsutsui
 


Home | Main Index | Thread Index | Old Index