HackingVGAforFun: Unterschied zwischen den Versionen

Aus LaborWiki
Wechseln zu: Navigation, Suche
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
 
(31 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
== VGA ==
{{ProjektInfoBox
Video Grapbics Adapter
|name=HackingVGAforFun
|status=obsolete
|image=VGA.jpg
|description=How to fool around with the VGA Controller
|tags=Fun, VGA, Controller,
}}
== HackingVGAforFun ==
This site describes how to fool around with the VGA Controller.


== pinouts ==
== pinouts ==
[http://pinouts.ru/all/VGA15_pinout.shtml VGA pinouts]
[http://pinouts.ru/all/VGA15_pinout.shtml VGA pinouts]


== edid ==
== build a fake monitor ==
[http://de.wikipedia.org/wiki/EDID EDID]
* Terminate the color lines with 75ohms
* Attach a 24C02 serial eeprom to the specified pins (24c04 - 24c16 is possible to )
* if no eeprom is at hand, connect ID3 to GND
 
== Modesetting ==
To set a custom mode either use ''xrandr'' or ''xorg.conf'' or ''selfbuild eeprom VGA adapter''.
 
=== xrandr ===
To do so use xrandr:<br>
xrandr --newmode "MODE1"  64.00  1400 1400 1401 1401 700 700 702 702 -hsync -vsync
xrandr --addmode VGA-0 "MODE1"
xrandr --output VGA-0 --mode "MODE1" --right-of LVDS
 
note: VGA-0 may not apply, it could be VGA1 or VGA too, depending on the driver.<br>
note: the last command assumes LVDS to be your primary active connector, change depending on your system.
 
alternative arandr
 
=== Xorg.conf ===
Add a ModeLine to your Xorg.conf.
Section "Monitor"
        Identifier      "SyncMaster"
        Option          "VGA-0"
        HorizSync      30-96
        VertRefresh    50-160
        ModeLine        "MODE1" 64.00  1400 1400 1401 1401 700 700 702 702
EndSection
 
=== monitor edid ===
Add a 24C02 EEPROM to a VGA connector. This EEPROM contains the [http://de.wikipedia.org/wiki/EDID EDID].
 
I used EDID 1.3<br>
I used EDID 1.3<br>
'''Windows'''
'''Windows Xp'''
* standart timings
* ''accepts''
* established timings
** standart timings
* it looks like Windows XP doesnt like "prefered timings"
** established timings
*''regrets''
** prefered timings
 
'''Windows Vista and newer'''
* ''accepts''
** standart timings
** established timings
*''regrets''
** TODO


'''Linux'''
'''Linux'''
Zeile 20: Zeile 66:
** prefered timings
** prefered timings


== build a fake monitor ==
=== hack the kernel module drm for custom edid ===
* Terminate the color lines with 75ohms
This is only neccesarry for custom EDIDs inside the "monitors" EEPROM. Using either the ''Xorg.conf'' method or the ''xrandr'' method doesn't need modification to the drm kernel module. It is only neccessary if you specify hsync < 1 or vsync < 1 in your EDID.
* Attach a 24C02 serial eeprom to the specified pins (24c04 - 24c16 is possible to )
 
* on debian
** install linux-source
** install linux-kernel-headers
** append to the drm Makefile and run make
all:
$(MAKE) -C $(KDIR) M=$(PWD) modules
cp *.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm
cp nouveau/*.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/nouveau
cp radeon/*.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/radeon
cp via/*.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/via
cp gma500/*.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/gma500
cp i915/*.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/i915
chmod 755 /lib/modules/`uname -r`/kernel/drivers/gpu/drm
update-initramfs -u
 
* on fedora
** install kernel-sources
** append to the drm Makefile and run make
KDIR    := /lib/modules/$(shell uname -r)/build
all:
$(MAKE) -C $(KDIR) M=$(PWD) modules
cp *.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm
cp nouveau/*.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/nouveau
cp radeon/*.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/radeon
cp via/*.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/via
cp gma500/*.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/gma500
cp i915/*.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/i915
chmod 755 /lib/modules/`uname -r`/kernel/drivers/gpu/drm
dracut -f /boot/initramfs-currentimage
 
* patch ''drm_edid.c'' , it doesn't accept vsync_width OR hsync_width to be 0
 
== how to flash a new edid into monitor eeprom ==


== flash a new edid ==
* remove fglrx or fglrx-legacy, make sure mesa is running !
* Load the kernelmodule i2c-dev
* Load the kernelmodule i2c-dev
* Get [http://www.lm-sensors.org/wiki/I2CTools i2c-tools]
* Get [http://www.lm-sensors.org/wiki/I2CTools i2c-tools]
Zeile 34: Zeile 113:
* Note the input file is plain/text with hexvalues, spaces and newlines only
* Note the input file is plain/text with hexvalues, spaces and newlines only


== create custom edid ==
== how to build custom edid ==
* download edid from monitor
** Linux: use i2c-get
** Windows: Registry or [http://www.tucows.com/preview/329441 Phoenix EDID Designer]
* use [http://www.tucows.com/preview/329441 Phoenix EDID Designer] to create custom EDIDs
* use [http://www.tucows.com/preview/329441 Phoenix EDID Designer] to create custom EDIDs
** Note: it runs under WINE
'''Note'''
'''Note'''
* the tool outputs .dat-files, that need to be editet by hand, it contains invalid symbols
* the tool outputs .dat-files, that need to be editet by hand, it contains invalid symbols
* you can use the export function to generate .raw files and use hexdump to convert them to plain/text hex
* you can use the export function to generate .raw files and use hexdump to convert them to plain/text hex


== hack the kernel module drm ==
 
* get the sourcecode, e.g. From kernel.org
== Tests ==
* install linux-kernel-headers
=== Test system ===
* modify the Makefile
* Linux 3.11.6 x86_64
Todo
* Mesa 9.2.0
Edited makefile goes here
* Intel(R) Core(TM)2 Quad  CPU  Q9300  @ 2.50GHz
* patch todo.c , it doesn't accept vsync_width OR hsync_width to be 0
* 4GByte DDR2 Memory
* copy the newly built .ko files to /lib/modules/+kernelversion+/kernel/drivers/gpu/drm/
 
* depmod -a
=== tips & tricks ===
* updateinitramfs -u
'''activate vsync'''
* mesa
** $ swapbufferswait=1 vblank_mode=3 <command>
* nvidia
** __GL_SYNC_TO_VBLANK=1 <command>
 
'''on xfce glutfullscreen might be broken, kill your X and run'''
swapbufferswait=1 vblank_mode=3 xinit ./vgatoiqbaseband -t -v -n :0
 
=== Results ===
* bandwidth is measured with vsync off using GL_ARB_pixel_buffer_object. This extensions allows asynchronous CPU MEM -> GPU MEM DMA transfers.
 
{| {{Prettytable}}
! Vendor !! Name !! Codename !! Driver !! VRAM [MB]!! max bandwidth [MB/s]!! min vsync !! min hsync !! min vblank !! min hblank !! Optional
|-
| Nvidia
| Geforce 8600GTS
| NV84
| Mesa 9.2.0
| 256
| 310
| 1*
| 1*
| 1*
| 1*
| hsync + hblank > 1, vsync + vblank > 1, every second frame is blank if  (vsync + vblank) = 1 or (hsync + hblank) = 1
|-
| ATI
| Radeon HD4850
| RV770
| Mesa 9.2.0
| 512
| 390
| 2
| 1*
| 0
| 1*
| hsync + hblank > 0
|-
| ATI
| Radeon HD4350 mobility
| RV710
| fglrx 8.92
| 512
| -
| 2
| 1*
| 0
| 1*
|
|-
| Intel(R)
| Ivybridge Desktop
| GT1
| Mesa 9.2.0
| 2048 ?
| 1400
| 0*
| 0*
| 4*
| 12*
| hsync + hblank >= 12, vsync + vblank >= 4, frontporch > 0, backporch > 0
|-
| ATI
| Radeon HD6870
| Barts
| Mesa 9.2.0
| 1024
| 530
| 2
| 1*
| 0
| 1*
| hsync + hblank > 0, either of one can be zero
|-
| Nvidia
| Geforce 8600GTS
| NV84
| Nvidia 331.20
| 256
| 1050
| 1
| 0
| 2
| 2
| vfrontporch > 0, vbackporch > 0, display connector changes to "disconnected" on "wrong" modelines appended, resulting in unusable xrandr
|-
| Nvidia
| Geforce 8400GT
| NV50
| Mesa 9.2.0
| 256
| 400
| 1*
| 0*
| 1*
| 1*
| hsync + hblank > 0, vsync + vblank > 1, every second frame is blank if (hsync + hblank) = 1
|-
| Ati
| X1650
| RV5xx
| Mesa 9.2.0
| 256
| 470
| 0*
| 1*
| 1*
| 1*
| hsync + hblank > 0, vsync + vblank > 1
|-
| Nvidia
| Quadro NVS 280
| NV34
| Mesa 9.2.0
| 64
| -
| 0
| 1
| 1
| 8
| '''sponsored by Jonke''', OpenGL 1.5, only Power-of-Two Textures, ''vgatobaseband doesnt work''
|-
| Intel
| Q45/Q43
| 4 Series Chipset Integrated Graphics Controller
| Mesa 9.2.0
| 2048
| -
| 0
| 0
| 1
| 1
|
|-
| Intel
| Q35
| 82Q35 Express Integrated Graphics Controller
| Mesa 9.2.0
| 512
| -
| 0
| 0
| 1
| 1
|
|-
|}
 
== Recommended Modelines ==
* Nvidia NV84 56.00 1024 1025 1025 1026 768 766 767 769
* Nvidia NV50 56.00 1024 1024 1024 1025 768 769 770 771
* Intel GT1 56.00  1400 1412 1412 1412 700 701 701 704
* Intel Q35 56.00 1023 1024 1024 1024 1023 1024 1024 1024
== Links ==
* http://www.nathandumont.com/node/241
 
[[Category:HowTo]]

Aktuelle Version vom 8. April 2017, 21:55 Uhr

 
HackingVGAforFun

Release status: obsolete [box doku]

VGA.jpg
Description How to fool around with the VGA Controller



HackingVGAforFun[Bearbeiten | Quelltext bearbeiten]

This site describes how to fool around with the VGA Controller.

pinouts[Bearbeiten | Quelltext bearbeiten]

VGA pinouts

build a fake monitor[Bearbeiten | Quelltext bearbeiten]

  • Terminate the color lines with 75ohms
  • Attach a 24C02 serial eeprom to the specified pins (24c04 - 24c16 is possible to )
  • if no eeprom is at hand, connect ID3 to GND

Modesetting[Bearbeiten | Quelltext bearbeiten]

To set a custom mode either use xrandr or xorg.conf or selfbuild eeprom VGA adapter.

xrandr[Bearbeiten | Quelltext bearbeiten]

To do so use xrandr:

xrandr --newmode "MODE1"   64.00  1400 1400 1401 1401 700 700 702 702 -hsync -vsync
xrandr --addmode VGA-0 "MODE1"
xrandr --output VGA-0 --mode "MODE1" --right-of LVDS

note: VGA-0 may not apply, it could be VGA1 or VGA too, depending on the driver.
note: the last command assumes LVDS to be your primary active connector, change depending on your system.

alternative arandr

Xorg.conf[Bearbeiten | Quelltext bearbeiten]

Add a ModeLine to your Xorg.conf.

Section "Monitor"
       Identifier      "SyncMaster"
       Option          "VGA-0"
       HorizSync       30-96
       VertRefresh     50-160
       ModeLine        "MODE1" 64.00  1400 1400 1401 1401 700 700 702 702
EndSection

monitor edid[Bearbeiten | Quelltext bearbeiten]

Add a 24C02 EEPROM to a VGA connector. This EEPROM contains the EDID.

I used EDID 1.3
Windows Xp

  • accepts
    • standart timings
    • established timings
  • regrets
    • prefered timings

Windows Vista and newer

  • accepts
    • standart timings
    • established timings
  • regrets
    • TODO

Linux

  • The kernel module drm handels all the display stuff
  • it accepts:
    • established timings
    • standart timings
    • prefered timings

hack the kernel module drm for custom edid[Bearbeiten | Quelltext bearbeiten]

This is only neccesarry for custom EDIDs inside the "monitors" EEPROM. Using either the Xorg.conf method or the xrandr method doesn't need modification to the drm kernel module. It is only neccessary if you specify hsync < 1 or vsync < 1 in your EDID.

  • on debian
    • install linux-source
    • install linux-kernel-headers
    • append to the drm Makefile and run make
all:
	$(MAKE) -C $(KDIR) M=$(PWD) modules
	cp *.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm
	cp nouveau/*.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/nouveau
	cp radeon/*.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/radeon
	cp via/*.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/via
	cp gma500/*.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/gma500
	cp i915/*.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/i915
	chmod 755 /lib/modules/`uname -r`/kernel/drivers/gpu/drm
	update-initramfs -u
  • on fedora
    • install kernel-sources
    • append to the drm Makefile and run make
KDIR    := /lib/modules/$(shell uname -r)/build
all:
	$(MAKE) -C $(KDIR) M=$(PWD) modules
	cp *.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm
	cp nouveau/*.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/nouveau
	cp radeon/*.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/radeon
	cp via/*.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/via
	cp gma500/*.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/gma500
	cp i915/*.ko /lib/modules/`uname -r`/kernel/drivers/gpu/drm/i915
	chmod 755 /lib/modules/`uname -r`/kernel/drivers/gpu/drm
	dracut -f /boot/initramfs-currentimage
  • patch drm_edid.c , it doesn't accept vsync_width OR hsync_width to be 0

how to flash a new edid into monitor eeprom[Bearbeiten | Quelltext bearbeiten]

  • remove fglrx or fglrx-legacy, make sure mesa is running !
  • Load the kernelmodule i2c-dev
  • Get i2c-tools
  • build the i2c-tools
  • Become root: Sudo -s
  • Add the tools folder to the PATH: PATH=$PATH:< ... >/i2c-tools/tools
  • Run i2cdump to find the correct BUSID (device at 0x50 and 0x51)
  • Flash new EDID with write-edid.sh
  • Note the input file is plain/text with hexvalues, spaces and newlines only

how to build custom edid[Bearbeiten | Quelltext bearbeiten]

Note

  • the tool outputs .dat-files, that need to be editet by hand, it contains invalid symbols
  • you can use the export function to generate .raw files and use hexdump to convert them to plain/text hex


Tests[Bearbeiten | Quelltext bearbeiten]

Test system[Bearbeiten | Quelltext bearbeiten]

  • Linux 3.11.6 x86_64
  • Mesa 9.2.0
  • Intel(R) Core(TM)2 Quad CPU Q9300 @ 2.50GHz
  • 4GByte DDR2 Memory

tips & tricks[Bearbeiten | Quelltext bearbeiten]

activate vsync

  • mesa
    • $ swapbufferswait=1 vblank_mode=3 <command>
  • nvidia
    • __GL_SYNC_TO_VBLANK=1 <command>

on xfce glutfullscreen might be broken, kill your X and run

swapbufferswait=1 vblank_mode=3 xinit ./vgatoiqbaseband -t -v -n :0

Results[Bearbeiten | Quelltext bearbeiten]

  • bandwidth is measured with vsync off using GL_ARB_pixel_buffer_object. This extensions allows asynchronous CPU MEM -> GPU MEM DMA transfers.
Vendor Name Codename Driver VRAM [MB] max bandwidth [MB/s] min vsync min hsync min vblank min hblank Optional
Nvidia Geforce 8600GTS NV84 Mesa 9.2.0 256 310 1* 1* 1* 1* hsync + hblank > 1, vsync + vblank > 1, every second frame is blank if (vsync + vblank) = 1 or (hsync + hblank) = 1
ATI Radeon HD4850 RV770 Mesa 9.2.0 512 390 2 1* 0 1* hsync + hblank > 0
ATI Radeon HD4350 mobility RV710 fglrx 8.92 512 - 2 1* 0 1*
Intel(R) Ivybridge Desktop GT1 Mesa 9.2.0 2048 ? 1400 0* 0* 4* 12* hsync + hblank >= 12, vsync + vblank >= 4, frontporch > 0, backporch > 0
ATI Radeon HD6870 Barts Mesa 9.2.0 1024 530 2 1* 0 1* hsync + hblank > 0, either of one can be zero
Nvidia Geforce 8600GTS NV84 Nvidia 331.20 256 1050 1 0 2 2 vfrontporch > 0, vbackporch > 0, display connector changes to "disconnected" on "wrong" modelines appended, resulting in unusable xrandr
Nvidia Geforce 8400GT NV50 Mesa 9.2.0 256 400 1* 0* 1* 1* hsync + hblank > 0, vsync + vblank > 1, every second frame is blank if (hsync + hblank) = 1
Ati X1650 RV5xx Mesa 9.2.0 256 470 0* 1* 1* 1* hsync + hblank > 0, vsync + vblank > 1
Nvidia Quadro NVS 280 NV34 Mesa 9.2.0 64 - 0 1 1 8 sponsored by Jonke, OpenGL 1.5, only Power-of-Two Textures, vgatobaseband doesnt work
Intel Q45/Q43 4 Series Chipset Integrated Graphics Controller Mesa 9.2.0 2048 - 0 0 1 1
Intel Q35 82Q35 Express Integrated Graphics Controller Mesa 9.2.0 512 - 0 0 1 1

Recommended Modelines[Bearbeiten | Quelltext bearbeiten]

  • Nvidia NV84 56.00 1024 1025 1025 1026 768 766 767 769
  • Nvidia NV50 56.00 1024 1024 1024 1025 768 769 770 771
  • Intel GT1 56.00 1400 1412 1412 1412 700 701 701 704
  • Intel Q35 56.00 1023 1024 1024 1024 1023 1024 1024 1024

Links[Bearbeiten | Quelltext bearbeiten]