Jump to content

ATI Framebuffer development


Slice
 Share

466 posts in this topic

Recommended Posts

One of my attempt

I2CWrite deviceAddress OK timeout=0
I2CWriteData 1
I2CReadData finished err=1
doI2CRequest 1
0x0000: 00000000000000000000000000000000
0x0010: 00000000000000000000000000000000
0x0020: 00000000000000000000000000000000
0x0030: 00000000000000000000000000000000
0x0040: 00000000000000000000000000000000
0x0050: 00000000000000000000000000000000
0x0060: 00000000000000000000000000000000
0x0070: 00000000000000000000000000000000

 

Try this one

RadeonDumpS.zip

Link to comment
Share on other sites

Test, please, ATILead,

RadeonPCI, and RadeonDump variants post 79, 86, 87

 

Windows driver have 4 methods for DDC

1. Hardware I2C with regs 90,94,98

2. Software I2C with regs 198,19c,1a0,1a4 data mask 200, clock 400

3. Software I2C with regs 198,19c,1a0,1a4 data mask 4000, clock 8000

4. Software I2C with regs 1a8,1ac,1b0,1b4 data mask 4000000, clock 8000000

I have all information except initializations. I am still not successful.

May be some mistake in my codes?

 

 

Ok... i install RadeonPCI and ATILead.kext. Now, system boot up and appears in System Properties 256mb lol lol lol lol

Now, what i have to do?

Here is what appears in Graphic/Monitors

 

Radeon XPRESS 200M (PCIE):

 

Modelo do Grupo de Circuitos Integrados: Radeon XPRESS 200M (PCIE)

Tipo: Monitor

Barramento: PCI

VRAM (Total): 256 MB

Fornecedor: ATI (0x1002)

ID do Dispositivo: 0x5975

ID da Revisão: 0x0000

Versão do Driver EFI: 01.00.068

Monitores:

LCD Colorido:

Resolução: 1280 x 800 @ 60 Hz

Profundidade: Cor de 32 bits

Core Image: Software

Monitor Principal: Sim (Yes)

Espelho: Desligado (Off)

On-line: Sim (Yes)

Quartz Extreme: Não Compatível (Not Compatible)

QuartzGL: Compatível (Compatible)

Link to comment
Share on other sites

Ok... i install RadeonPCI and ATILead.kext. Now, system boot up and appears in System Properties 256mb lol lol lol lol

Now, what i have to do?

Here is what appears in Graphic/Monitors

 

Radeon XPRESS 200M (PCIE):

 

Modelo do Grupo de Circuitos Integrados: Radeon XPRESS 200M (PCIE)

Tipo: Monitor

Barramento: PCI

VRAM (Total): 256 MB

Fornecedor: ATI (0x1002)

ID do Dispositivo: 0x5975

ID da Revisão: 0x0000

Versão do Driver EFI: 01.00.068

Monitores:

LCD Colorido:

Resolução: 1280 x 800 @ 60 Hz

Profundidade: Cor de 32 bits

Core Image: Software

Monitor Principal: Sim (Yes)

Espelho: Desligado (Off)

On-line: Sim (Yes)

Quartz Extreme: Não Compatível (Not Compatible)

QuartzGL: Compatível (Compatible)

This is OK except QE/CI.

What about testing of

./RadeonDump ?

Link to comment
Share on other sites

I'm about to test at least RadeonPCI and AtiLead as well (and if those work well, Radeondump)

Like Pericles I have X200M PCIE (5975).

Am I right in thinking I should disable Callisto for this?

No, ATILead may replace CallistoHAL.kext but you need Callisto.kext.

Or you may disable Callisto at all and use IONDRVSupport.kext (without resolution switch yet).

 

I'm using Callisto003 Fixed, and i don't disable nothing. Just put the RadeonPci and ATILead (changing the IOPCIFamily version), loaded and voilá.

 

Now, i will learn how to make the RadeonDump

 

Tnahks for all!

Download RadeonDumpS from post 101.

type in terminal

./RadeonDumpS -d

-- to make your BIOS dump. The new binary file will appears at your folder. You can look inside in it by HexEdit or BBEdit. If you are not developer the file is not needed to you.

 

./RadeonDumpS -r 120,160

-- you see values of Radeon chip registers 120..160. It may be requested for test purpose.

 

./RadeonDumpS -i 0,a0,200

-- it is attempt to get EDID. I want to know your result.

you can try also

x,a0,y where

x=0 or 1

y=1,2,10,20,40,80,100,200,400,800,4000,8000,4000000 or else

values 4 and 8 are dangerous!

 

2 Dong

What is happen if you eject your real EDID into Callisto?

Are you interested in QE/CI problem?

Link to comment
Share on other sites

polar-bears-computer:~/Projects/framebuffer polarbear$ sudo kextload -v test/RadeonPCI.kext

kextload: kext /System/Library/Extensions/AppleThermal.kext is not valid

kextload: extension test/RadeonPCI.kext appears to be valid

kextload: loading extension test/RadeonPCI.kext

kextload: test/RadeonPCI.kext loaded successfully

kextload: loading personalities named:

kextload: FirstPersonality

kextload: sending 1 personality to the kernel

kextload: matching started for test/RadeonPCI.kext

polar-bears-computer:~/Projects/framebuffer polarbear$ ls

RadeonDumpS buildKext-sourceIncompatibility.png

RadeonDumpS.zip kextGuess.txt

RadeonPCI kextloadBeforeDump.txt

RadeonPCI.kext.zip loadingKext-precompiledTiger-2ndTrial.rtf

RadeonPCI_source.zip loadingKext-precompiledTigerOne.rtf

TigerCompiled radeonDump.txt

TigerCompiled.zip test

polar-bears-computer:~/Projects/framebuffer polarbear$ ./RadeonDumpS -d

 

Found a device of class RadeonPCI

it matched on name "display"

polar-bears-computer:~/Projects/framebuffer polarbear$ ./RadeonDumpS -r 120,160

 

Found a device of class RadeonPCI

it matched on name "display"

0x0120: 0x00000000

0x0124: 0x00000000

0x0128: 0x00000000

0x012C: 0x00000000

0x0130: 0x00800000

0x0134: 0x00007000

0x0138: 0x00000000

0x013C: 0x00000000

0x0140: 0x00000000

0x0144: 0x00000000

0x0148: 0x00000000

0x014C: 0x00000000

0x0150: 0x00000000

0x0154: 0x00000000

0x0158: 0x00000000

0x015C: 0x00000000

0x0160: 0x00000000

polar-bears-computer:~/Projects/framebuffer polarbear$ ./RadeonDumpS -i 0,a0,200

 

Found a device of class RadeonPCI

it matched on name "display"

Start I2C dump 0,a0,200

Test reg=0198, mask=200 addr=a0

Test I2C clock disable clk output

Test I2C clock init pause 0,-26

Test I2C clock wait 0 pause 1,-524077

Test I2C clock wait 1 pause 0,-26

Test I2C clock wait 0 pause 1,-33

Test I2C clock wait 1 pause 0,-22

Test bus

Test bus

1 data 0

1 clk 0

Test 1 passed

2 clk 0

Test 2 passed

3 data 0

3 clk 0

Test 3 passed

4 data 0

Test 4 passed

Test 5 timeout=0

5 data 0

5 clk 0

I2CWrite deviceAddress OK timeout=0

I2CWriteData 1

I2CRead data Err timeout=5

I2CRead data Err timeout=5

I2CRead data Err timeout=5

I2CRead data Err timeout=5

I2CRead data Err timeout=5

I2CRead data Err timeout=5

I2CRead data Err timeout=5

I2CRead data Err timeout=5

I2CRead data Err timeout=5

I2CRead data Err timeout=5

I2CReadData finished err=0

doI2CRequest 0

polar-bears-computer:~/Projects/framebuffer polarbear$

Link to comment
Share on other sites

2 Dong

What is happen if you eject your real EDID into Callisto?

Are you interested in QE/CI problem?

To make it clear, Callisto is like something you try to do (based on the linux source you select), it's only for old ATI cards.

 

For x1300/x1400 mobility cards, the vanilla ATI framebuffer driver can not be used as it lacks the ability to detect our panel LCD. With IONDRVSupport, our laptop boot with a fixed resolution which can not be changed at run time.

 

My goal is create a Callisto countpart for x1300/x1400 mobiltiy by using linux RadeonHD source.

 

Now, as you know, the EDID is read and available resolutions did show in Display preference.

The kenel panic did not happen again after I found out it came from some IOLog's bad format.

Linux switch_resolution function can also be called without problem.

Things left for me is to find out how to provide correct information of the new resolution to the system.

My initial several tries failed with the screen becoming a mesh after changed to a new resolution.

Need to get more information on this.

Link to comment
Share on other sites

I still can't get EDID neither in MacOSX nor in Windows. May be I shall inject some EDID and continue work with it. Linux sources is not very good. I have no switch resolution in Ubuntu. Moreover Linux DDC method is not work for me. Problems...

 

Upload please

./RadeonPCI -r 0,1000 >registers.txt

 

From Ole2 I see strange @148=0, @14c=0

Link to comment
Share on other sites

New progress!

RadeonDump.c.zip

 

not for me yet:

 

Welcome to Darwin!

polar-bears-computer:~ polarbear$ cd Projects/framebuffer/

polar-bears-computer:~/Projects/framebuffer polarbear$ less RadeonDump.c

polar-bears-computer:~/Projects/framebuffer polarbear$ cp RadeonDump.c RadeonPCI

polar-bears-computer:~/Projects/framebuffer polarbear$ cd RadeonPCI

polar-bears-computer:~/Projects/framebuffer/RadeonPCI polarbear$ less RadeonDump.c

polar-bears-computer:~/Projects/framebuffer/RadeonPCI polarbear$ cc ./RadeonDump.c -o ./RadeonDump -framework IOKit -framework CoreFoundation -Wno-four-char-constants -Wall -g -arch i386

polar-bears-computer:~/Projects/framebuffer/RadeonPCI polarbear$ ls -l

total 160

drwxr-xr-x 3 polarbea polarbea 102 Apr 17 14:53 English.lproj

-rw-r--r-- 1 polarbea polarbea 1482 Apr 24 19:45 Info.plist

-rwxr-xr-x 1 polarbea polarbea 33072 Jun 26 18:36 RadeonDump

-rw------- 1 polarbea polarbea 17131 Jun 26 18:35 RadeonDump.c

-rw-r--r-- 1 polarbea polarbea 4905 Apr 24 13:47 RadeonPCI.cpp

-rw-r--r-- 1 polarbea polarbea 1579 Apr 22 23:29 RadeonPCI.h

drwxr-xr-x 7 polarbea polarbea 238 Jun 26 16:41 RadeonPCI.xcodeproj

-rw-r--r-- 1 polarbea polarbea 754 Apr 24 13:48 RadeonPCIShared.h

-rw-r--r-- 1 polarbea polarbea 3420 Apr 22 23:29 RadeonPCIUserClient.cpp

drwxr-xr-x 5 polarbea polarbea 170 Jun 26 16:37 build

polar-bears-computer:~/Projects/framebuffer/RadeonPCI polarbear$ ./RadeonDump -i

polar-bears-computer:~/Projects/framebuffer/RadeonPCI polarbear$ sudo kextload ../

.DS_Store RadeonPCI.kext.zip kextloadBeforeDump.txt

7942.0000.0000.vga.rom RadeonPCI_source.zip loadingKext-precompiledTiger-2ndTrial.rtf

RadeonDump.c TigerCompiled loadingKext-precompiledTigerOne.rtf

RadeonDump.c.zip TigerCompiled.zip radeonDump.txt

RadeonDumpS buildKext-sourceIncompatibility.png test

RadeonDumpS.zip executionResult-radeonDump-v1.rtf

RadeonPCI kextGuess.txt

polar-bears-computer:~/Projects/framebuffer/RadeonPCI polarbear$ sudo kextload ../test/RadeonPCI.kext

Password:

kextload: ../test/RadeonPCI.kext loaded successfully

polar-bears-computer:~/Projects/framebuffer/RadeonPCI polarbear$ ./RadeonDump -i

Found a device of class RadeonPCI: IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/AGP@1/IOPCI2PCIBridge/VGA@5/RadeonPCI

it matched on name "display"

Start I2C dump

Read EDID at bus 0 failed

Read EDID at bus 1 failed

Read EDID at bus 2 failed

polar-bears-computer:~/Projects/framebuffer/RadeonPCI polarbear$

Link to comment
Share on other sites

May be it is interesting for our investigation for switch resolution

loc_14532:				; CODE XREF: __ZN13ATIRadeon850025set_display_mode_and_vramEv+47Cj
	test	byte ptr [ebx+9Ah], 1
	jz	loc_146C2
	cmp	dword ptr [ebx+0CCh], 1
	jbe	loc_146C2
	mov	edx, [ebx+634h]
	mov	ecx, [edx+3F8h]  //RADEON_CRTC2_GEN_CNTL
	mov	eax, ecx
	and	eax, 0F00h		//RADEON_CRTC2_PIX_WIDTH_MASK  (0xf << 8)
	shr	eax, 8
	mov	[ebp+var_2C], eax
	mov	byte ptr [ebx+66Ch], 0
	mov	esi, [edx+324h] //RADEON_CRTC2_OFFSET
	and	esi, 7FFFFFFh
	mov	eax, [edx+32Ch] //RADEON_CRTC2_PITCH 
	and	eax, 7FFh
	shl	eax, 3
	mov	[ebp+var_38], eax
	test	ecx, 2000000h
	jz	loc_1485B
	mov	eax, [ebp+var_2C]
	test	eax, eax
	jz	loc_1485B
	cmp	esi, [ebx+9Ch]
	jnb	loc_1485B
	mov	eax, [edx+300h]  //CRTC2_H_TOTAL_DISP
	mov	edx, [edx+308h]  //RADEON_CRTC2_V_TOTAL_DISP
	and	edx, 0FFF0000h  //RADEON_CRTC2_V_DISP (0x07ff << 16)
	shr	edx, 10h
	and	eax, 1FF0000h  //RADEON_CRTC2_H_DISP  (0x01ff << 16)
	shr	eax, 10h
	lea	eax, ds:8[eax*8]
	mov	[ebp+var_24], eax
	add	edx, 1
	and	cl, 2
	setnz	byte ptr [ebx+66Eh]
	cmp	[ebp+var_2C], 5
	jz	loc_14AA6

And all others codes

Link to comment
Share on other sites

not for me yet:

Your card does not fall in R5XX.

Try again with this that for both R5xx and R6xx except RS620, RS690: RadeonDump.c.zipNothing new here, just add in R6xx source.

may be it is interesting for our investigation for switch resolution

Not familiar with assembly. :(

Link to comment
Share on other sites

Not familiar with assembly. :(

It is very simple

mov eax,[edx+224h] means

eax=INREG(0x224) ;)

I can upload to you diassembled sources of ATIRadeonX1000.kext if you want.

It may be helpful to look what registers uses ATI instead of Linux sources.

And I can give some comments...

Link to comment
Share on other sites

It is very simple

mov eax,[edx+224h] means

eax=INREG(0x224) :D

I can upload to you diassembled sources of ATIRadeonX1000.kext if you want.

It may be helpful to look what registers uses ATI instead of Linux sources.

And I can give some comments...

Well, I guess you picked a wrong object to dig for switch resolution information. Stuff like ATIRadeonX1000.kext and ATIRadeon8500.kext are acceleration modules. All ATI framebuffer drivers are located in ATINDRV.kext/Contents/Plugins/. ATIRNDRV.kext maybe a new one for this.

Link to comment
Share on other sites

Well, I guess you picked a wrong object to dig for switch resolution information. Stuff like ATIRadeonX1000.kext and ATIRadeon8500.kext are acceleration modules. All ATI framebuffer drivers are located in ATINDRV.kext/Contents/Plugins/. ATIRNDRV.kext maybe a new one for this.

Yes, you are right

useful codes

Link to comment
Share on other sites

Framebuffer code for pre X1000 boards isn't present, but as I had told in an older post, I suspect it's directly embedded inside the ROM, so if that might be usefull with disassembly, I join the ROM of an ATI 9200 (codename bugsy) and ATI 9800XT (codename Elan).

Also, if you need a brief list of the current plugins I made one here (latest ones are missing).

9200_9600XT_roms.zip

Link to comment
Share on other sites

Framebuffer code for pre X1000 boards isn't present, but as I had told in an older post, I suspect it's directly embedded inside the ROM, so if that might be usefull with disassembly, I join the ROM of an ATI 9200 (codename bugsy) and ATI 9800XT (codename Elan).

Is it PowerPC ROMs? Is so I can't apply its.

If Intel then why it can contain Apple's framebuffer?

For PowerPC there are low-end ATI framebuffer drivers in folder AppleNDRV in extensions. And also it contain "ATI ROM Update". Don't know how it works because PowerPC only.

Link to comment
Share on other sites

Yeah PPC, however the GPU registers or things like this should be "tracable" too (I guess IDA pro can disassemble this). If you open it with a kext or hex editor, you'll see many similiarities in the ROM and the nowadays used plugins. I checked in intel ROMs too, and they don't have this stuff (hence my conclusion about the framebuffer being stored in the ROM)

Link to comment
Share on other sites

How to analyze the wormy codes

loc_235BD:			; CODE XREF: _HW_TMDS1OnOff+407j
....
	mov	[esp+58h+var_50], 101h
	mov	[esp+58h+var_54], 78D8h //TMDSA_DATA_SYNCHRONIZATION_R500
	mov	eax, [ebp+arg_0]
	mov	[esp+58h+var_58], eax
	call	_regw32

It means

RegWrite32(0x78D8, 0x101);

 

Found DDC/EDID codes

		public _DDCSetClock
_DDCSetClock	proc near	; CODE XREF: _DDCInit+14p
...
	movzx	eax, ds:_ddc_io
	mov	[ebp+var_9], al
	lea	eax, [ebp+var_9]
	or	byte ptr [eax],	10h  //Clock enable
...
	lea	eax, [ebp+var_9]
	or	byte ptr [eax],	2  //ClockOut=1
...
	mov	edx, [eax+16Ch]			// address of RegWrite
	movzx	eax, [ebp+var_9]	// data to write
	mov	[esp+38h+var_34], eax  // argument 2
	mov	eax, [ebp+arg_0]		   // iomap
	mov	[esp+38h+var_38], eax  // argument 1 
	call	edx							   // call RegWrite
	mov	[esp+38h+var_38], 0FFFFFFFBh
	call	_kdelay   // kind of IODelay(0x0FFFFFFFB)

Here I see

Clock enable bit = 0x10

Data enable bit = 0x20

Clock out bit = 0x2

Data out bit = 0x4

It is differ from all previous sources.

I don't see DDC registers.

 

What is the registers?

	R5XX_CONFIG_MEMSIZE			= 0x00F8,
R5XX_FB_INTERNAL_ADDRESS	   = 0x0134,

It is a key for me to get QE/CI!!! R200-R400 has the same registers.

Link to comment
Share on other sites

Guys,

Now a new RadeonDump.zip for EDID dumping.

I've test it on my T60 as well as on my Dell. In both cases, it works.

myE510:~/Desktop/RadeonPCI dong$ ./RadeonDump -i
Found a device of class RadeonPCI: IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/PCI1@1/IOPCI2PCIBridge/display@0,1/RadeonPCI
it matched on name "display"
Start I2C dump
Read EDID at position 0 failed
EDID at position 1:
0x0000: 00FFFFFFFFFFFF0010AC15A053524D34
0x0010: 240F010368221B78EECAF6A357479E23
0x0020: 114F54A54B00714F8180010101010101
0x0030: 010101010101302A009851002A403070
0x0040: 1300520E1100001E000000FD00384B1F
0x0050: 500E000A202020202020000000FF0047
0x0060: 43383131353855344D52530A000000FC
0x0070: 0044454C4C204531393646500A20004D

Slice, I now think you are not using source code from radeon-ati.

The new RadeonDump is adapted from radeon-ati and it's supposed to work for most radeon cards.

 

People please test it. Download and put all the files in the RadeonPCI project (get from post#28) folder. Read the header of RadeonDump.c for compiling instruction.

 

In this source, I can not tell the exact bus line number as the i2c structure is manually created without line information.

Link to comment
Share on other sites

Thanks Dong. I'll try your RadeonDump as soon as possible.

 

New idea.

Why ATINDRV.kext is not working for you? It is intended for R5xx.

But different I2C methods! So it simply can't get EDID for your card!

If so you need ONLY to rewrite getEDID in IONDRVSupport as you already done and leave all other methods doStatus/doControl by default to be performed by ATINDRV.

Thus your working configuration (I hope :) ):

ATILead.kext to inject name "ATY,Wormy" (or other?)

IONDRVSupport.kext with corrected getEDID

ATINDRV.kext as is.

To check you need not more then one hour.

Victory? :hysterical:

 

The same for OLE2.

Not for me. I will go by Joblo's way. Callisto003 works for me but without AGP acceleration - old story.

Link to comment
Share on other sites

New idea.

Why ATINDRV.kext is not working for you? It is intended for R5xx.

But different I2C methods! So it simply can't get EDID for your card!

If so you need ONLY to rewrite getEDID in IONDRVSupport as you already done and leave all other methods doStatus/doControl by default to be performed by ATINDRV.

Thus your working configuration (I hope :wacko: ):

ATILead.kext to inject name "ATY,Wormy" (or other?)

IONDRVSupport.kext with corrected getEDID

ATINDRV.kext as is.

To check you need not more then one hour.

Victory? :P

I hope it will work cause that will be really nice. But how if ATINDRV overwrites and only uses its own version of getEDID?

Link to comment
Share on other sites

I'm using Callisto003 Fixed, and i don't disable nothing. Just put the RadeonPci and ATILead (changing the IOPCIFamily version), loaded and voilá.

 

 

Changed anything in ATILead?

 

I lost the ability to change resolution, and it detects my X200M as "Display". also says it has 256 RAM, while I only have 128.

 

EDIT: adding this from Sys Profiler. Before I installed ATILead and RadeonPCI, it always gave me 5975 as device ID.

 

Display:

 

Type: Display

Bus: PCI

VRAM (Total): 256 MB

Vendor: ATI (0x1002)

Device ID: 0x5955

Revision ID: 0x0000

Displays:

Display:

Resolution: 1024 x 768

Depth: 32-bit Color

Core Image: Software

Main Display: Yes

Mirror: Off

Online: Yes

Quartz Extreme: Not Supported

Link to comment
Share on other sites

 Share

×
×
  • Create New...