X11DRV-Patch

Jarmo <[email protected]>
Newsgroups gmane.comp.emulators.winex.devel
Message-ID <[email protected]>
Hi,

Here is a patch, again. I was working with the Orbiter 
http://www.orbitersim.com and it stoped running after I updated SuSE linux 
8.2 and new GeForce FX display card. This patch will fix the problem for now. 
There is something wrong with the surface pitch values. This should be 
checked out that we are not compensating an error with an other error. The 
game is running fine with textures and HW acceleration but the frame rate is 
kinda poor.

Regards,
Jarmo
patch2.diff (text/x-diff, 1.5 KB)
--- wine/graphics/x11drv/dib.c	2003-05-29 05:23:54.000000000 +0300
+++ wine_patch/graphics/x11drv/dib.c	2003-07-24 00:07:04.000000000 +0300
@@ -6035,8 +6035,9 @@
   TRACE("attempting to create shared memory pixmap\n");
 
   wine_tsx11_lock();
+  int bitmap_pitch = bm->bmWidthBytes * 8 / bm->bmBitsPixel;
 
-  tmpXImage = XShmCreateImage (gdi_display, visual, depth, ZPixmap, NULL, shminfo, bm->bmWidth, bm->bmHeight);
+  tmpXImage = XShmCreateImage (gdi_display, visual, depth, ZPixmap, NULL, shminfo, bitmap_pitch, bm->bmHeight);
   pitch = tmpXImage->bytes_per_line;
   imgsize = pitch * tmpXImage->height;
   shminfo->shmid = shmget(IPC_PRIVATE, imgsize, IPC_CREAT|0777);
@@ -6066,7 +6067,7 @@
                bm->bmWidth, bm->bmHeight, bm->bmBitsPixel );
         TRACE( "pitch=%d, imgsize=%d\n", pitch, imgsize);
         sharedPixmap = XShmCreatePixmap( gdi_display, root_window, shminfo->shmaddr,
-		                         shminfo, bm->bmWidth, bm->bmHeight, depth );
+		                         shminfo, bitmap_pitch, bm->bmHeight, depth );
 
         /* register shared memory so DIB protections work */
         if (protectable) VirtualAlloc(shminfo->shmaddr, imgsize, MEM_RESERVE | MEM_SYSTEM, PAGE_READWRITE);
@@ -6183,7 +6184,7 @@
   bm.bmWidth = bi->biWidth;
   bm.bmHeight = effHeight;
   bm.bmWidthBytes = ovr_pitch ? ovr_pitch
-			      : DIB_GetDIBWidthBytes(bm.bmWidth, bi->biBitCount);
+			      : DIB_GetDIBWidthBytes(bi->biWidth, bi->biBitCount);
   bm.bmPlanes = bi->biPlanes;
   bm.bmBitsPixel = bi->biBitCount;
   bm.bmBits = NULL;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.