Bug 35763 - X.org with the sis driver fails to start with a Segmentation Fault if EXA acceleration is selected
Summary: X.org with the sis driver fails to start with a Segmentation Fault if EXA acc...
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/SiS (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
Depends on:
Blocks: 60891
  Show dependency treegraph
Reported: 2011-03-29 05:33 UTC by rm+bfo
Modified: 2015-09-05 14:48 UTC (History)
5 users (show)

See Also:
i915 platform:
i915 features:

Xorg.0.log (30.76 KB, text/plain)
2011-03-29 05:36 UTC, rm+bfo
no flags Details
Xorg hangs on SIS(0): initializing int10 (29.10 KB, text/plain)
2013-05-06 12:46 UTC, Eugenij Shkrigunov
no flags Details

Description rm+bfo 2011-03-29 05:33:01 UTC
X.org fails to start with Segmentation Fault if EXA acceleration is selected with the "sis" driver using a SiS 315 PRO video device.

It works fine with XAA in both 16 and 24 bit modes.

The hardware is Lemote Fuloong2F (Loongson2 little-endian MIPS CPU).
So it is possible the bug can be MIPS-specific.

According to a comment in https://bugs.freedesktop.org/show_bug.cgi?id=9611, SiS driver EXA support was broken at some point. Is it still not supposed to be working?
Comment 1 rm+bfo 2011-03-29 05:36:17 UTC
Created attachment 44994 [details]
Comment 2 Assen Totin 2013-01-24 14:55:35 UTC
Just tried to install Fedora 18 which has X.Org 1.13 (whatever it may be, as the X.Org site has no such release) and it fell miserably with SIGSEGV. As some investigation showed, in 1.12 releases the X.Org has dropped XAA whatsoever and now the SiS driver is trying to use EXA... which is broken... and it fails. 

Can't believe this has been reported 2 years ago and there isn't even a single comment from X.org/Freedesktop... Obviously, they're good in dropping things out and not so good in creating working things. 

So, this is to confirm: the bug is still there, wild and furious.
Comment 3 linuxert 2013-03-15 13:24:13 UTC
The Bug also exists ins Opensuse 12.3
Comment 4 nihui 2013-05-05 14:13:27 UTC
I have actually fixed this issue sometime ago.

diff -Nuarp xf86-video-sis-0.10.7/src/sis310_accel.c xf86-video-sis-0.10.7.exautsdfs/src/sis310_accel.c
--- xf86-video-sis-0.10.7/src/sis310_accel.c 2012-06-06 16:47:03.000000000 +0800
+++ xf86-video-sis-0.10.7.exautsdfs/src/sis310_accel.c 2012-09-15 13:42:59.535124999 +0800
@@ -1874,7 +1874,7 @@ SiSUploadToScreen(PixmapPtr pDst, int x,
  ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
  SISPtr pSiS = SISPTR(pScrn);
- unsigned char *dst = pDst->devPrivate.ptr;
+ unsigned char *dst = ((unsigned char *) pSiS->FbBase) + exaGetPixmapOffset(pDst);
  int dst_pitch = exaGetPixmapPitch(pDst);
@@ -1882,7 +1882,7 @@ SiSUploadToScreen(PixmapPtr pDst, int x,
  if(pDst->drawable.bitsPerPixel < 8)
     return FALSE;
- dst += (x * pDst->drawable.bitsPerPixel / 8) + (y * src_pitch);
+ dst += (x * pDst->drawable.bitsPerPixel / 8) + (y * dst_pitch);
  while(h--) {
     SiSMemCopyToVideoRam(pSiS, dst, (unsigned char *)src,
     (w * pDst->drawable.bitsPerPixel / 8));
@@ -1953,9 +1953,8 @@ SiSDownloadFromScreen(PixmapPtr pSrc, in
  ScrnInfoPtr pScrn = xf86ScreenToScrn(pSrc->drawable.pScreen);
  SISPtr pSiS = SISPTR(pScrn);
- unsigned char *src = pSrc->devPrivate.ptr;
+ unsigned char *src = ((unsigned char *) pSiS->FbBase) + exaGetPixmapOffset(pSrc);
  int src_pitch = exaGetPixmapPitch(pSrc);
- int size = src_pitch < dst_pitch ? src_pitch : dst_pitch;
@@ -1964,7 +1963,8 @@ SiSDownloadFromScreen(PixmapPtr pSrc, in
  src += (x * pSrc->drawable.bitsPerPixel / 8) + (y * src_pitch);
  while(h--) {
-    SiSMemCopyFromVideoRam(pSiS, (unsigned char *)dst, src, size);
+    SiSMemCopyFromVideoRam(pSiS, (unsigned char *)dst, src,
+      (w * pSrc->drawable.bitsPerPixel / 8));
     src += src_pitch;
     dst += dst_pitch;

reference page(chinese)
Comment 5 Eugenij Shkrigunov 2013-05-06 12:46:05 UTC
(In reply to comment #4)

This patch does not work.
Xorg hangs on SIS(0): initializing int10
Xorg.log in the attacment (next comment).
Comment 6 Eugenij Shkrigunov 2013-05-06 12:46:54 UTC
Created attachment 78923 [details]
Xorg hangs on SIS(0): initializing int10
Comment 7 nihui 2013-05-06 15:11:17 UTC
(In reply to comment #5)
> (In reply to comment #4)
> This patch does not work.
> Xorg hangs on SIS(0): initializing int10
> Xorg.log in the attacment (next comment).

my patch was only tested on my old box, sis661 chip.
xorg server 1.13.0
X crashed on exa code at startup, and the patch just fixed it.
I don't have any other sis chip machines, so I can not test it more.
anyway, I think my patch may be helpful here.

btw: the motherboard of my old box was broken some months ago. any deeper investigation is now impossible for me  :(
Comment 8 Keeborg 2014-09-03 11:32:54 UTC
Just in case someone hits this bug.

There exists a patch solving the issue for most modern SiS and XGI chips, and the bug is fixed for Ubuntu Trusty. See the discussion here: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-sis/+bug/1066464.
Comment 9 Keeborg 2014-09-03 11:37:38 UTC
Oh, missed #4 somehow. But that patch is working for me and many others using XGI cards, according to comments in launchpad discussion.
Comment 10 Adrian Nowicki 2015-01-18 12:18:51 UTC
Patch from #4 (the one used in Ubuntu Trusty) works for me too. I use Travelmate 2310.

lspci output:
00:00.0 Host bridge: Silicon Integrated Systems [SiS] 661FX/M661FX/M661MX Host (rev 11)
00:01.0 PCI bridge: Silicon Integrated Systems [SiS] AGP Port (virtual PCI-to-PCI bridge)
00:02.0 ISA bridge: Silicon Integrated Systems [SiS] SiS963 [MuTIOL Media IO] LPC Controller (rev 25)
00:02.1 SMBus: Silicon Integrated Systems [SiS] SiS961/2/3 SMBus controller
00:02.5 IDE interface: Silicon Integrated Systems [SiS] 5513 IDE Controller
00:02.6 Modem: Silicon Integrated Systems [SiS] AC'97 Modem Controller (rev a0)
00:02.7 Multimedia audio controller: Silicon Integrated Systems [SiS] SiS7012 AC'97 Sound Controller (rev a0)
00:03.0 USB controller: Silicon Integrated Systems [SiS] USB 1.1 Controller (rev 0f)
00:03.1 USB controller: Silicon Integrated Systems [SiS] USB 1.1 Controller (rev 0f)
00:03.3 USB controller: Silicon Integrated Systems [SiS] USB 2.0 Controller
00:04.0 Ethernet controller: Silicon Integrated Systems [SiS] SiS900 PCI Fast Ethernet (rev 91)
00:06.0 CardBus bridge: Texas Instruments PCI1410 PC card Cardbus Controller (rev 02)
Comment 11 Matt Turner 2015-09-05 06:29:46 UTC
Connor removed these functions in this commit [1]. He can probably confirm that this bug should be fixed.

[1] http://cgit.freedesktop.org/xorg/driver/xf86-video-sis/commit/?id=e834b2cdaedccff5e13cef86af23e46992c2530a
Comment 12 Connor Behan 2015-09-05 14:48:01 UTC
Yes, removing them is essentially the same as nihui's fix since Upload / Download stuff will now be done by EXA itself. Eugenij should open a sparate bug if needed because I don't see how int10 and EXA are related.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.