Jump to content

ATI Framebuffer development


Slice
 Share

466 posts in this topic

Recommended Posts

I'm stopped at switch resolution part. RadeonHD source is already working for me. The linux switchResolution function is called and corresponding parameters (fBitsPerPixel, fRowBytes... etc.) are thought to be set, but results in a meshed screen upon choose a resolution other than the original booted one. If I use arrow key to change the resolution back (you can not see it), it's ok again. So linux function is working, just some important piece is missed in my code.

If you want to take a look, here is the code with linux source in it and named now as RadeonHD: http://www.mediafire.com/?um2d5t3gszu

The atombios part is not used yet because I want to solve the resolution problem first, only that until now still don't find the answer.

Link to comment
Share on other sites

I take a look to your new codes. You are far from me in the investigation.

Look into RadeonXF project. It is intended for AVIVO. May be you find some difference in registers use for switch resolution.

Mesh screen - it is timing problem. Or may be you have good timing but bad apply it to Radeon registers.

When I come here I can look into Caretta.asm to find similar codes.

About ATOMBIOS. It is a horrow. Previous codes were simple and understandable but new linux codes uses Radeon registers and I don't know why.

 

 

Where are our testers? I don't see any reports!

Link to comment
Share on other sites

Slice all the files you've put in your 1st post are rather confusing, we don't really know what does what, and what needs testing.

Please could you clarify using simple terms, this would probably bring more people for testing.

Link to comment
Share on other sites

I'm stopped at switch resolution part. RadeonHD source is already working for me. The linux switchResolution function is called and corresponding parameters (fBitsPerPixel, fRowBytes... etc.) are thought to be set, but results in a meshed screen upon choose a resolution other than the original booted one. If I use arrow key to change the resolution back (you can not see it), it's ok again. So linux function is working, just some important piece is missed in my code.

If you want to take a look, here is the code with linux source in it and named now as RadeonHD: http://www.mediafire.com/?um2d5t3gszu

The atombios part is not used yet because I want to solve the resolution problem first, only that until now still don't find the answer.

You can't set resolution without pll_info obtained from BIOS (or from Radeon regs?). cscSetDetailedTimings method.

 

Slice all the files you've put in your 1st post are rather confusing, we don't really know what does what, and what needs testing.

Please could you clarify using simple terms, this would probably bring more people for testing.

I hope advanced testers already know what is what. For others it's not a time.

I want to know are my and dong's half working kexts loadable for others.

And I want to see connections report as I did in posts 204, 213.

Link to comment
Share on other sites

Some interesting thing to discuss.

 

With native IONDRVSupport, only 1024x768, 1280x1024, 1400x1050 can be the boot resolution that displays correctly with my x1400. Well, 640x480 is also ok.

When boot with 800x600, it displayed like this:

post-75935-1216831609_thumb.png

I looked at this picture, thought it was a 832x577 displayed as 800x600. Then I wrote a little program to turn it back to 832x567. It now looks like this:

post-75935-1216831742_thumb.png

If you look at the new image carefully, it actually has been draw two times at different width offset(differed by 32 pixels). The -32 pixel one is not so obvious, but it may caused the extra white line everywhere.

Link to comment
Share on other sites

Some interesting thing to discuss.

 

With native IONDRVSupport, only 1024x768, 1280x1024, 1400x1050 can be the boot resolution that displays correctly with my x1400.

When boot with 800x600, it displayed like this:

 

I looked at this picture, thought it was a 832x577 displayed as 800x600. Then I wrote a little program to turn it back to 832x567. It now looks like this:

 

If you look at the new image carefully, it actually has been draw two times at different width offset(differed by 32 pixels). The -32 pixel one is not so obvious, but it may caused the extra white line everywhere.

You do not use your driver here?

If so BIOS uses VESA modes and VESA timings.

White lines are probably means vertical scan precision. Timings for 577 and 600. Apple(VESA?) mode is 832x624.

624=24*26 600=24*25 576=24*24. You have 24 white lines. So...

It's time to use

./RadeonDump -r 3000,7000 or else range where your Surface registers is located.

More difficult to dump PLL registers with indirect access but I think it is not impossible to you.

If you dump registers in each case you can understand how to write good values in it.

 

My delays related to join different naming from Joblo project, Linux project and Apple's one :D

Soon I can begin testing resolution switch.

Link to comment
Share on other sites

Some interesting thing to discuss.

 

If you look at the new image carefully, it actually has been draw two times at different width offset(differed by 32 pixels). The -32 pixel one is not so obvious, but it may caused the extra white line everywhere.

 

once in similar situation it was incorrect color depth, 24 instead of 32. give it a try )

Link to comment
Share on other sites

Hello, I have to admit, I stumbled upon this thread looking for ideas to help with my hackintosh's backlight problem (it never turns off, even with RadeonTool).

 

Well I was very happy to find dong's RadeonDump app (thanks dong!!)! I was able to modify it so I can write to the Radeon registers. Well, actually, dong did most of the work since it's in the code already -- just commented out! I'm pleased to be able to control the backlight on my iBook at work by writing to the register! So now I'm hopeful to use this at home as well.

 

Anyway, enough of my problem. I'd be happy to help here if I can. Would a dump from a Mobility Radeon 9200 (iBook G4) or a Mobility Radeon 9600 Pro Turbo (hackintosh Dell Latitude D800) be useful at all?

Link to comment
Share on other sites

dong, when I run RadeonDump on my hackintosh (Tiger 10.4.11, 8.9.1) I get the same result as some others (exits with no message). On further testing, I've found the code skips your for loop in main(). Is it a problem with TIger? Callisto?

Link to comment
Share on other sites

drlarsen77, glad that you find a good utilize of the RadeonDump code.

I do not find a way to solve my problem yet, but Slice may need your testing.

If the for loop in main() is skipped, please check whether RadeonPCI.kext is still loaded. The kext is matched to name as "display" or "ATY*", maybe Callisto changed it to other name. But I have no problem on my Dell desktop with Callisto, so I'm not sure.

 

You can't set resolution without pll_info obtained from BIOS (or from Radeon regs?). cscSetDetailedTimings method.
The linux switchResolution function contains methods to reset pll, thus I guess it's already done. For cscSetDetailedTimings, the only reference to it is IONDRVFramebuffer:: SetDetailedTimings, but it's not a required method for IOFramebuffer and I did not find any references to it in IOGraphicsFamily.
Link to comment
Share on other sites

drlarsen77, glad that you find a good utilize of the RadeonDump code.

I do not find a way to solve my problem yet, but Slice may need your testing.

Yes, I always need any testings. More information - more good driver.

Previously I had the same problem: RadeonPCI loaded but RadeonDump do nothing.

Some system components was missing.

RadeonDump works is BSD subsystem and when I install X11, RadeonDump begins to work. :)

The linux switchResolution function contains methods to reset pll, thus I guess it's already done. For cscSetDetailedTimings, the only reference to it is IONDRVFramebuffer:: SetDetailedTimings, but it's not a required method for IOFramebuffer and I did not find any references to it in IOGraphicsFamily.

Don't forget that IOGraphics doesn't contain any hardware codes. It uses BIOS default settings for graphic chip.

Apple's code really do many unnecessory manipulations with internal variables and I don't know how it influence on, for example, SystemPreferencies.Display. Let it copy to and from its variables! (set vs get methods). Really working method is

IOReturn IONDRVFramebuffer::setDisplayMode( IODisplayModeID displayMode, IOIndex depth )
{
VDSwitchInfoRec	switchInfo;
VDPageInfo		pageInfo;
VDTimingInfoRec 	timingInfo;
...
err = _doStatus( this, cscGetModeTiming, &timingInfo );
...
err = _doControl( this, cscSwitchMode, &switchInfo);
...
_doControl( this, cscSetMode, &pageInfo);
...
}

That Joblo replace to

radeonfb_set_par(rinfo->info, &var);
...
struct radeon_regs *newmode;
int hTotal, vTotal, hSyncStart, hSyncEnd,
	hSyncPol, vSyncStart, vSyncEnd, vSyncPol, cSync;
UInt32 sync, h_sync_pol, v_sync_pol, dotClock, pixClock;
int i, freq;
...
	radeon_calc_pll_regs(rinfo, newmode, freq);
...
newmode->crtc_h_total_disp = ((((hTotal / 8) - 1) & 0x3ff) |
							 (((mode->xres / 8) - 1) << 16));

newmode->crtc_h_sync_strt_wid = ((hsync_start & 0x1fff) |
								(hsync_wid << 16) | (h_sync_pol << 23));

newmode->crtc_v_total_disp = ((vTotal - 1) & 0xffff) |
				((mode->yres - 1) << 16);

newmode->crtc_v_sync_strt_wid = (((vSyncStart - 1) & 0xfff) |
								(vsync_wid << 16) | (v_sync_pol  << 23));
...
	radeon_write_mode (rinfo, newmode, 0);

And so on.

I think Linux codes must include the same procedure. I'll look later.

 

I think universal driver must do

if(chipset

radeon_write_mode (rinfo, newmode, 0);

else

radeonHD_write_mode(rinfo, newmode, 0);

Link to comment
Share on other sites

Thanks for the advice!

 

I'm not sure which of these fixed the problem:

- moved RadeonPCI.kext to /System/Library/Extensions (instead of doing manual kextload)

- diskutil repairpermissions /

- reboot

And RadeonDump works!

 

I was even able to turn off the backlight by writing to bit 0 at 0x02d0! Now to have my system do it automatically while idle. Maybe I'll write a screensaver...

 

Anyway, here's some dumps. This is from my Dell Latitude D800, Tiger 10.4.11 with 8.9.1 kernel (and a few modified kexts), Mobility Radeon 9600 Pro Turbo. The archive contains BIOS, regs, EDID and ioreg. If you need more, just let me know. I'll try to get the iBook dumped later today.

drlarsen77.zip

Link to comment
Share on other sites

Some interesting in your results

BIOS_4_SCRATCH=0x0020: 0x01000006 = VGA + CRT. But active only one.

I see CRT only when connected!

LCD DDC Info Table found!
Bios Connector table: 
Port0: DDCType-0x60, DACType-1, TMDSType-1, ConnectorType-1  //VGA
Port1: DDCType-0x64, DACType-1, TMDSType-2, ConnectorType-3  //DVI-D
Port4: DDCType-0x1b0, DACType-0, TMDSType-0, ConnectorType-7//LVDS
Port5: DDCType-0x0, DACType-2, TMDSType-0, ConnectorType-5  //S-Video

and you are able to get EDID for LVDS. Grates!

It may be interesting for you to change EDID in Callisto.

Now you have Callisto's EDID

	| |   |	 |   |   "DFP,EDID" = <00ffffffffffff005a631169010101012a0d010380291f782a4e95a1574c94261c5054bfef80
94081808140714f615945593159310a483f403062b0324040c0130098321100001e000000ff00413
313033343230303139350a000000fd0032551e5c11000a202020202020000000fc00565032303162
a2020202020200099>

which is not the same as you obtain. Try to change?

Link to comment
Share on other sites

I was even able to turn off the backlight by writing to bit 0 at 0x02d0! Now to have my system do it automatically while idle. Maybe I'll write a screensaver...

Did you see LaptopDisplay project?

It is exactly for your purpose. If you would some success with it let me know. I also want to have it working!

Link to comment
Share on other sites

Well on the Dell D800 I use the built-in LCD display, but I do have a CRT connected to the VGA port. The CRT is powered off though and I can't get any display on there (although I haven't really tried). I'll see if I can get the real EDID into Callisto later tonight.

 

As for the iBook G4, Leopard 10.5.4, Mobility Radeon 9200, here are the results attached. Not much to show though as the card isn't supported by RadeonDump.

 

Did you see LaptopDisplay project?

It is exactly for your purpose. If you would some success with it let me know. I also want to have it working!

 

Oh that's excellent! I'll test it tonight and report back. Thanks for the link. :)

iBookG4.zip

Link to comment
Share on other sites

As for the iBook G4, Leopard 10.5.4, Mobility Radeon 9200, here are the results attached. Not much to show though as the card isn't supported by RadeonDump.

Dong, your opinion?

I think on real Mac VGA ROM located in different place.

Link to comment
Share on other sites

which file do i need to compile to test your work? I can use radeondump but i want to actually try out the framebuffer. I can't seem to compile any of the files in the first post without many errors.

 

Also, when I use ATILead.kext, i get a kernel panic if it is run with ATI.kext, or it just hangs at the apple logo (or verbose screen) if ati.kext is not present.

 

Sorry for the uninformed question, but i've become stuck.

Link to comment
Share on other sites

and you are able to get EDID for LVDS. Grates!

It may be interesting for you to change EDID in Callisto.

Now you have Callisto's EDID

	| |   |	 |   |   "DFP,EDID" = <00ffffffffffff005a631169010101012a0d010380291f782a4e95a1574c94261c5054bfef80
94081808140714f615945593159310a483f403062b0324040c0130098321100001e000000ff00413
313033343230303139350a000000fd0032551e5c11000a202020202020000000fc00565032303162
a2020202020200099>

which is not the same as you obtain. Try to change?

 

Well, I tried changing the DFP,EDID in Callisto. The only effect I can see is RadeonDump no longer reports any values for EDID. :huh: Strange!

Link to comment
Share on other sites

Really interesting, what it reports now?

 

Here's what it reports:

Found a device of class RadeonPCI: IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/AGP@1/AGPGart/VID@0/RadeonPCI
it matched on name "display"
Detected ATI Radeon Mobility 9600/9700 (M10/M11) NP (AGP) (device id: 0x4e50)
Start I2C dump
Legacy BIOS detected
LCD DDC Info Table found!
Bios Connector table: 
Port0: DDCType-0x60, DACType-1, TMDSType-1, ConnectorType-1
Port1: DDCType-0x64, DACType-1, TMDSType-2, ConnectorType-3
Port4: DDCType-0x1b0, DACType-0, TMDSType-0, ConnectorType-7
Port5: DDCType-0x0, DACType-2, TMDSType-0, ConnectorType-5
EDID for connector 0:
Read data failed
EDID for connector 1:
Read data failed
EDID for connector 4:
Read data failed

Really strange! I just rebooted and now it works again!

Found a device of class RadeonPCI: IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/AGP@1/AGPGart/VID@0/RadeonPCI
it matched on name "display"
Detected ATI Radeon Mobility 9600/9700 (M10/M11) NP (AGP) (device id: 0x4e50)
Start I2C dump
Legacy BIOS detected
LCD DDC Info Table found!
Bios Connector table: 
Port0: DDCType-0x60, DACType-1, TMDSType-1, ConnectorType-1
Port1: DDCType-0x64, DACType-1, TMDSType-2, ConnectorType-3
Port4: DDCType-0x1b0, DACType-0, TMDSType-0, ConnectorType-7
Port5: DDCType-0x0, DACType-2, TMDSType-0, ConnectorType-5
EDID for connector 0:
Read data failed
EDID for connector 1:
Read data failed
EDID for connector 4:
0x0000: 00FFFFFFFFFFFF004CA3583100000000
0x0010: 000D0103802115780A87F594574F8C27
0x0020: 27505400000001010101010101010101
0x0030: 010101010101D51B00A0502017303020
0x0040: 26004BCF100000190000000F00000000
0x0050: 00000000002387026400000000FE0059
0x0060: 303331360731353458310A20000000FE
0x0070: 00C5AF9E8E72604000010A2020200052

Link to comment
Share on other sites

Did you see LaptopDisplay project?

It is exactly for your purpose. If you would some success with it let me know. I also want to have it working!

I tried this. The kext loads and I can see LaptopDisplay, Backlight, etc attached in ioreg, but it doesn't seem to do anything else. You had the same result?

Link to comment
Share on other sites

I tried this. The kext loads and I can see LaptopDisplay, Backlight, etc attached in ioreg, but it doesn't seem to do anything else. You had the same result?

Yes, this is empty project. I think we need to add some hardware settings.

 

About your reports with RadeonDump it may be

1. Interference between RadeonPCI and Callisto

2. Too short timings in I2C readings.

3. Dunno

 

Did you compile RadeonPCI and RadeonDump to RowerPC codes?

They use OSWriteLittleEndian but you need BigEndian.

Link to comment
Share on other sites

I made cosmetic changes to output in RadeonDump (Dong's version)

Detected ATI Radeon Mobility 9100 IGP (U3) 5835 (device id: 0x5835)

Start I2C dump

Legacy BIOS detected

Bios Connector table:

Port0: DDCType-0x60, DACType-2, TMDSType-1, ConnectorType-CRT

Port4: DDCType-0x0, DACType-0, TMDSType-0, ConnectorType-LCD

Port5: DDCType-0x0, DACType-2, TMDSType-0, ConnectorType-STV

EDID for connector 0:

Read data failed

and

it matched on name "display"

0x0000: 0000022C 00000080 00000308 000000C3 0000000C 0128C000 10040400 02010000

0x0020: 01000004 01000001 00010F00 00000000 5133A3B0 84000000 00010000 00010000

0x0040: 00000000 00080007 00000000 00000000 03000600 00080048 FF604102 00000002

 

I see card name here taking from table. For legacy BIOS it is better got it from BIOS.

See CardDetect.cpp in my last project. But I see ATOMBIOS doesn't contain a name.

00000160: 00 00 E1 01 00 00 00 00 00 00 00 00 50 43 49 52 	............PCIR
00000170: 02 10 35 58 00 00 18 00 00 00 00 03 80 00 11 08 	..5X............
00000180: 00 80 00 00 41 54 49 20 4D 4F 42 49 4C 49 54 59 	....ATI MOBILITY
00000190: 20 52 41 44 45 4F 4E 20 39 30 30 30 20 49 47 50 	 RADEON 9000 IGP
000001A0: 00 31 D8 D9 5E FF FF FF FF 54 4A 01 02 FF FF FF 	.1..^....TJ.....

Just more correct name.

 

My ATILead must work for any. But correct info.plist

				<key>@0,address</key>
			<integer>-805306368</integer>  -- this is my VideoRAM address. Remove it at all!
			<key>@0,display-type</key>
			<string>LCD</string>  -- as you?
			<key>@0,model</key>
			<string>ATY,RS300</string>  -- my chip
			<key>chipset-model</key>
			<string>ATY,RS300</string>  -- once more
			<key>F8,size</key>
			<integer>3145728</integer> -- my hack. Remove the key

RadeonDumpL.zip

Link to comment
Share on other sites

 Share

×
×
  • Create New...