Back in the late 90s to early 2000s, SiS graphics chips were fairly common and found in many low-end devices. Today, the chips are still capable enough for simple graphics needs, but the graphics cards were on PCI and AGP buses. They are not usable in modern computers.

However, there exist USB-based graphics cards with a SiS 315 graphics chip. Those are around on Ebay et al [1] and easily usable with current computers. I already do have a driver for the old PCI-based SiS drivers and have long been struggling to find something useful to do with it. Converting it to serve USB devices would finally make it useful.

The goal for Hackweek 20 is to dedust my SiS driver and make it work with the 315 chip. That might take a bit or not; I'm not sure yet. Afterwards, the PCI I/O needs to be replaced with corresponding USB operations.

There are quite a few resources. My PCI driver is at [2]. For the USB devices, there exists an old userspace driver at [3] and a kernel stub at [4]. A general description of the device can be found in the Wayback Machine. [5]

If successful, the driver is supposed to be included in the upstream kernel.

[1] https://www.amazon.com/Tritton-TRI-UV100-SEE2-SVGA-Adapter/dp/B0003NFY1E

[2] https://gitlab.freedesktop.org/tzimmermann/linux/tree/sisvga

[3] https://gitlab.freedesktop.org/xorg/driver/xf86-video-sisusb

[4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/misc/sisusbvga?h=v5.11

[5] https://web.archive.org/web/20100610174735/http://www.winischhofer.eu/linuxsisusbvga.shtml

Looking for hackers with the skills:

kernel graphics drm usb

This project is part of:

Hack Week 20

Activity

  • over 4 years ago: fos liked this project.
  • over 4 years ago: ptesarik liked this project.
  • over 4 years ago: tdz liked this project.
  • over 4 years ago: tdz started this project.
  • over 4 years ago: tdz added keyword "kernel" to this project.
  • over 4 years ago: tdz added keyword "graphics" to this project.
  • over 4 years ago: tdz added keyword "drm" to this project.
  • over 4 years ago: tdz added keyword "usb" to this project.
  • over 4 years ago: tdz originated this project.

  • Comments

    • tdz
      over 4 years ago by tdz | Reply

      Day 1: Today I returned to my old driver for SiS PCI devices, which used to work 3yrs ago. Admittedly, the driver has bit-rotted quite a bit. I since updated it and added atomic modesetting. But I never really tested these changes. I can get the modes from the monitor via EDID functionality and the driver now detects the VRAM size correctly. My monitor reports a signal error, which indicates a bug when programming display resolution or timing. Fixing the driver is what I currently do. I'll also have to update it for the 315 chip. My hope is that I can then replace the PCI-bus functionality with USB and have a semi-working USB driver later this week.

    • tdz
      over 4 years ago by tdz | Reply

      Day 2: I'm still working on getting the old PCI-based SiS driver to work correctly within the current kernel. I managed to get the display mode set and improved color-format settings. The display still looks wrong, but it's getting better. I give it one more day. No matter what the state is tomorrow, I'll push for USB support on Thursday.

    • tdz
      over 4 years ago by tdz | Reply

      Day 3: The old driver uses the device VRAM directly. Today I converted it to DRM's SHMEM helpers. This is necessary to work with the USB device. SHMEM buffers will serve as shadow framebuffers that the driver can copy over USB into the device's memory.

    • tdz
      about 4 years ago by tdz | Reply

      Day 4: I began to turn the PCI driver into a USB driver. Each PCI I/O operation has to be converted to a USB bulk message. The rsp code is already in the old kernel stub driver somewhere. The PCI device is a VGA card and therefore POSTed by the BIOS. For the USB device, I expect that there might be an additional POST process necessary. The old userspace driver should have the rsp code somewhere. No way I'll be able to finish all of this by the end of the week.

    • tdz
      about 4 years ago by tdz | Reply

      Day 5: After some back and forth, I'm able to communicate with the USB device. No mode setting yet, just basic communication. I extracted this form the old sisusb driver in the kernel. I'll probably continue this project during the next hackweek.

    Similar Projects

    early stage kdump support by mbrugger

    Project Description

    When we experience a early boot crash, we are not able to analyze the kernel dump, as user-space wasn't able to load the crash system. The idea is to make the crash system compiled into the host kernel (think of initramfs) so that we can create a kernel dump really early in the boot process.

    Goal for the Hackweeks

    1. Investigate if this is possible and the implications it would have (done in HW21)
    2. Hack up a PoC (done in HW22 and HW23)
    3. Prepare RFC series (giving it's only one week, we are entering wishful thinking territory here).

    update HW23

    • I was able to include the crash kernel into the kernel Image.
    • I'll need to find a way to load that from init/main.c:start_kernel() probably after kcsan_init()
    • I workaround for a smoke test was to hack kexec_file_load() systemcall which has two problems:
      1. My initramfs in the porduction kernel does not have a new enough kexec version, that's not a blocker but where the week ended
      2. As the crash kernel is part of init.data it will be already stale once I can call kexec_file_load() from user-space.

    The solution is probably to rewrite the POC so that the invocation can be done from init.text (that's my theory) but I'm not sure if I can reuse the kexec infrastructure in the kernel from there, which I rely on heavily.

    update HW24

    • Day1
      • rebased on v6.12 with no problems others then me breaking the config
      • setting up a new compilation and qemu/virtme env
      • getting desperate as nothing works that used to work
    • Day 2
      • getting to call the invocation of loading the early kernel from __init after kcsan_init()
    • Day 3

      • fix problem of memdup not being able to alloc so much memory... use 64K page sizes for now
      • code refactoring
      • I'm now able to load the crash kernel
      • When using virtme I can boot into the crash kernel, also it doesn't boot completely (major milestone!), crash in elfcorehdr_read_notes()
    • Day 4

      • crash systems crashes (no pun intended) in copy_old_mempage() link; will need to understand elfcorehdr...
      • call path vmcore_init() -> parse_crash_elf_headers() -> elfcorehdr_read() -> read_from_oldmem() -> copy_oldmem_page() -> copy_to_iter()
    • Day 5

      • hacking arch/arm64/kernel/crash_dump.c:copy_old_mempage() to see if crash system really starts. It does.
      • fun fact: retested with more reserved memory and with UEFI FW, host kernel crashes in init but directly starts the crash kernel, so it works (somehow) \o/
    • TODOs

      • fix elfcorehdr so that we actually can make use of all this...
      • test where in the boot __init() chain we can/should call kexec_early_dump()