Jump to content

ATI Framebuffer development


  • Please log in to reply
465 replies to this topic

#161
shadeskyline

shadeskyline

    InsanelyMac Protégé

  • Members
  • Pip
  • 6 posts
Thank you all for all your hard work.
I tested your files on my IBM T43 with ATI Radeon X300, 64 MB + 64MB Shared
Loaded RadeonPCI.kext

With Dong's RadeonDump I got following:

[codebox]sh-3.2# ./RadeonDump -i
Found a device of class RadeonPCI: IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/AGP@1/IOPCI2PCIBridge/VID@0/RadeonPCI
it matched on name "display"
Detected ATI Radeon Mobility X300 (M22) 5460 (PCIE) (device id: 0x5460)
Start I2C dump
Legacy BIOS detected
Bios Connector table:
Port0: DDCType-0x60, DACType-1, TMDSType-1, ConnectorType-1
Port1: DDCType-0x64, DACType-1, TMDSType-1, ConnectorType-3
Port4: DDCType-0x0, 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
[/codebox]

If I connect LCD display on the VGA port:

[codebox]sh-3.2# ./RadeonDump -i
Found a device of class RadeonPCI: IOService:/AppleACPIPlatformExpert/PCI0@0/AppleACPIPCI/AGP@1/IOPCI2PCIBridge/VID@0/RadeonPCI
it matched on name "display"
Detected ATI Radeon Mobility X300 (M22) 5460 (PCIE) (device id: 0x5460)
Start I2C dump
Legacy BIOS detected
Bios Connector table:
Port0: DDCType-0x60, DACType-1, TMDSType-1, ConnectorType-1
Port1: DDCType-0x64, DACType-1, TMDSType-1, ConnectorType-3
Port4: DDCType-0x0, DACType-0, TMDSType-0, ConnectorType-7
Port5: DDCType-0x0, DACType-2, TMDSType-0, ConnectorType-5
EDID for connector 0:
0x0000: 00FFFFFFFFFFFF001E6D4D56E4F20000
0x0010: 051101036A312078EAAEC5A2574A9C25
0x0020: 125054A76B80950F950081808140714F
0x0030: 0101010101017C2E90A0601A1E403020
0x0040: 3600DA281100001A21399030621A2740
0x0050: 68B03600DA281100001C000000FD0038
0x0060: 4B1C530F000A202020202020000000FC
0x0070: 004C3232365754510A2020202020001C
EDID for connector 1:
Read data failed
[/codebox]

So it gives me the EDID only for the external display

I send you the video rom dump and another file obtained with RadeonDump -r 100,200

Attached Files



#162
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 2,893 posts
  • Gender:Male
  • Location:Moscow
2 dong
Users can't get EDID for internal LCD with any methods. May be it simply busy? I shall try again in single user mode.

My project RadNDRV is wrong. OSObject can't be separate kext. ATY_Wormy is a subclass of IONDRVFramebuffer. So I return to very old project openati.sf.net.
It is the subclass. Very simple project. Again, I need to rewrite only doStatus and doControl.

I still don't understand how to attach three nubs to my three connectors CRT1, LCD and TVO. And why my internal LCD seems to connected to CRT1 port?
Display_Base_Address for CRT1 = @0x023c
for CRT2 = @0x033c by default the same address.
so second Framebuffer must to rewrite 33c to the new value if I want to have second monitor with own desktop.
Framebuffer.base_addr = INREG(connectors_info[index].out_reg); or vice versa ?
And what is
#define RADEON_OV0_BASE_ADDR 0x043c
Is it address for TVOut?

And register 0x00f8.
Default value from BIOS = VRAM_SIZE / 4 - 1Mb.
Why? I have three connectors - three framebuffers with own addresses. And 1Mb for each RingBuffer. It is better to divide by 3 but more simple by 4. Simple calculation!
But I have 128Mb VRAM. f8=31Mb and I can't have QE! 64Mb is a minimum value!
So if I want to have QE I must make other memory assingment!

Interesting document about using Radeon with non-DDC monitors.

#163
dong

dong

    InsanelyMac Sage

  • Retired Developers
  • 366 posts
  • Gender:Male

2 dong
Users can't get EDID for internal LCD with any methods. May be it simply busy? I shall try again in single user mode.
Interesting document about using Radeon with non-DDC monitors.

Hope I can do something here with non-DDC monitors, then EDID problem will be solved.

My project RadNDRV is wrong. OSObject can't be separate kext. ATY_Wormy is a subclass of IONDRVFramebuffer. So I return to very old project openati.sf.net.
It is the subclass. Very simple project. Again, I need to rewrite only doStatus and doControl.

Now you see, ATI native driver can overwrite any methods of IONDRVFramebuffer through doStatus and doControl. Therefore, using modified IONDRVSupport.kext with ATY kext is not enough.

#164
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 2,893 posts
  • Gender:Male
  • Location:Moscow

Hope I can do something here with non-DDC monitors, then EDID problem will be solved.

I am going to use injected EDID

Now you see, ATI native driver can overwrite any methods of IONDRVFramebuffer through doStatus and doControl. Therefore, using modified IONDRVSupport.kext with ATY kext is not enough.

I understand your fault ;)
So we would write a whole Framebuffer. But I hate previous project as Joblo do because it replace IONDRVSupport at all. I want to make separate kext working together with default IONDRVSupport.

EDITED
What about to subclass ATY_Wormy B)

#165
dong

dong

    InsanelyMac Sage

  • Retired Developers
  • 366 posts
  • Gender:Male

I want to make separate kext working together with default IONDRVSupport.

That's what I've been trying to do.

What about to subclass ATY_Wormy :blink:

Can you create the ATY_Wormy.h by reverse engineering? For my card, it's actually ATY_Carreta.h.

#166
dong

dong

    InsanelyMac Sage

  • Retired Developers
  • 366 posts
  • Gender:Male

(II) fglrx(0): Connected Display1: LCD on internal LVDS [lvds]
(II) fglrx(0): Display1 EDID data ---------------------------
(II) fglrx(0): Manufacturer: AUO Model: 3214 Serial#: 0
(II) fglrx(0): Year: 2006 Week: 1
(II) fglrx(0): EDID Version: 1.3
(II) fglrx(0): Digital Display Input
(II) fglrx(0): Max H-Image Size [cm]: horiz.: 26 vert.: 16
(II) fglrx(0): Gamma: 2.20
(II) fglrx(0): No DPMS capabilities specified; RGB/Color Display
(II) fglrx(0): First detailed timing is preferred mode
(II) fglrx(0): redX: 0.580 redY: 0.340 greenX: 0.310 greenY: 0.550
(II) fglrx(0): blueX: 0.155 blueY: 0.155 whiteX: 0.315 whiteY: 0.330
(II) fglrx(0): Manufacturer's mask: 0
(II) fglrx(0): Supported additional Video Mode:
(II) fglrx(0): clock: 68.9 MHz Image Size: 261 x 163 mm
(II) fglrx(0): h_active: 1280 h_sync: 1301 h_sync_end 1333 h_blank_end 1408 h_border: 0
(II) fglrx(0): v_active: 800 v_sync: 804 v_sync_end 808 v_blanking: 816 v_border: 0
(II) fglrx(0): AUO
(II) fglrx(0): B121EW03 V2
(II) fglrx(0): EDID (in hex):
(II) fglrx(0): 00ffffffffffff0006af143200000000
(II) fglrx(0): 01100103801a10780a87fe94574f8c27
(II) fglrx(0): 27505400000001010101010101010101
(II) fglrx(0): 010101010101ea1a0080502010301520
(II) fglrx(0): 440005a3100000180000000f00000000
(II) fglrx(0): 00000000000000000020000000fe0041
(II) fglrx(0): 554f0a202020202020202020000000fe
(II) fglrx(0): 004231323145573033205632200a001f
(II) fglrx(0): End of Display1 EDID data --------------------

I just looked at your BIOS rom and find that the EDID data is located in it (offset: 0x75DB). So your LVDS really has no DDC/I2C access. My code is for sure not working for this LVDS. Some code need be added to handle such case.

#167
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 2,893 posts
  • Gender:Male
  • Location:Moscow

That's what I've been trying to do.
Can you create the ATY_Wormy.h by reverse engineering? For my card, it's actually ATY_Carreta.h.

Here is Caretta.codes. Open and search ATY_Caretta::. It is members that new class override. I found only probe, start, doDriverIO.
You can create class definition
class ATY_Caretta : public IONDRVFramebuffer
and write only those methods that you want to override.
Then you create your class
class MY_Caretta : public ATY_Caretta
and write implementations.... :D

I just looked at your BIOS rom and find that the EDID data is located in it (offset: 0x75DB). So your LVDS really has no DDC/I2C access. My code is for sure not working for this LVDS. Some code need be added to handle such case.

I saw no EDID in my BIOS. :unsure:
000075D0: 00 06 64 00 80 06 96 00 06 64 00 80 04 96 00 05 	..d......d......
000075E0: 64 00 80 03 96 00 04 80 00 80 09 DC 00 06 80 00 	d...............
000075F0: 80 07 DC 00 05 80 00 80 05 DC 00 04 80 00 80 03 	................


#168
dong

dong

    InsanelyMac Sage

  • Retired Developers
  • 366 posts
  • Gender:Male
Slice, thanks for the asm file. Now hope it's not too late to learn some reverse engineering.

#169
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 2,893 posts
  • Gender:Male
  • Location:Moscow
Dong

Did you see /IOGraphics/tools/itvview?
It get TV information from I2C :) !!!
May be you try the codes with your working I2C bus?

#170
dong

dong

    InsanelyMac Sage

  • Retired Developers
  • 366 posts
  • Gender:Male
Yes, I can test it on my Dell machine which has tv out. But, what kind of information is expected?
Oh, I forgot that my TV is broken. Nothing can be retrieved I guess.

#171
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 2,893 posts
  • Gender:Male
  • Location:Moscow

Yes, I can test it on my Dell machine which has tv out. But, what kind of information is expected?
Oh, I forgot that my TV is broken. Nothing can be retrieved I guess.

I don't know what is expected. Later I'll try by some RadeonDump variant despite nonDDC LCD.

I prepare new project but KP at METACLASSRESERVEDUSED. What it is?
This kext made as ATINDRV. Loaded if NameMatch. It contains Radeon codes all in one class ATIDriver. Without calling the class it works.

Yes, the most radeon codes is for R200-R400 but not for R500,600. But these codes is not used now except maybe initialization.

#172
dong

dong

    InsanelyMac Sage

  • Retired Developers
  • 366 posts
  • Gender:Male
I saw you have ATIDriver class methods implemented in RadeonFB.cpp instead of in ATIDriver.cpp. Can you avoid that? It may cause problem though I'm still not very clear of correct way to implement class in IOKit.

#173
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 2,893 posts
  • Gender:Male
  • Location:Moscow
Class methods may be described in different files. Only need to include "class.h".
I am not sure that it is a best way. But I think that when I want to have two monitors each of them having own framebuffer it would be better to have two instances of all variables and methods to work with its.
Probably I understand my mistake. The class ATIDriver is called before create it while I copy codes from working drivers. Some hidden relations that I didn't understand yet.

#174
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 2,893 posts
  • Gender:Male
  • Location:Moscow
Attention! Linux sources changed!
:jerry:

With new codes my I2C must be 6c vs 60 in previous.

#175
dong

dong

    InsanelyMac Sage

  • Retired Developers
  • 366 posts
  • Gender:Male
Waiting for your good news. :P
itvview.c contains i2c subaddress, don't know how to handle it yet. But, I happenly found that IONDRVSupport has no problem with output to TV in mirror mode, though display preference has no information of multilple displays. IORegistry contains: display@0 and display@0,1
If use Callisto patch, it will cause a KP if TV is connected.

#176
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 2,893 posts
  • Gender:Male
  • Location:Moscow

Waiting for your good news. ;)

Still no :P

itvview.c contains i2c subaddress, don't know how to handle it yet.

Here
DDCRead_DDC2(CARD8 line, void* map, int start, int len)
{
	unsigned char W_Buffer[2];
	int w_bytes;
	unsigned char *R_Buffer = &EDID[0];
	int i;

	I2CSlaveAddr SlaveAddr = 0xA0;   -- i2c subaddress
	int prescale = rhdGetI2CPrescale();

But, I happenly found that IONDRVSupport has no problem with output to TV in mirror mode, though display preference has no information of multilple displays. IORegistry contains: display@0 and display@0,1

It is a non-useful device with class code 0x038000. Don't attach them!
You can get multiple displays if write into natit (or else..) strings like
@0,name
@1,name
Thus you will have two framebuffers differing in ioreg
"IOFBDependentIndex" = 0x0 or 0x1
And there might be information about real connections
"connector-type" = <04000000>
"display-connect-flags" = <00000000>
I propose that the property
"AAPL,vram-memory" = <0000004000000008>
must be different for two framebuffers to have different pictures but I can't check.

Did you have ATITVOut.kext with Intel flavour? Thanks to Krazubu!

If use Callisto patch, it will cause a KP if TV is connected.

One more stone thrown into Callisto :P

#177
dong

dong

    InsanelyMac Sage

  • Retired Developers
  • 366 posts
  • Gender:Male
I2CSlaveAddr SlaveAddr = 0xA0;   -- i2c subaddress
SlaveAddr is sendAddress, but not subaddress as you can see in i2cexample.c (also in tools folder).
void EDIDRead( IOI2CConnectRef connect, Boolean save )
{
	kern_return_t	kr;
	IOI2CRequest	request;
	UInt8		data[128];
	int		 i;

	bzero( &request, sizeof(request) );

	request.commFlags				= 0;

	request.sendAddress			= 0xA0;

Did you have ATITVOut.kext with Intel flavour? Thanks to Krazubu!

Any link for a working version of this?

Edit:
Just put subAddress as the first data byte to write. However, what itvview.c does is only save random bytes to tv and read them back through i2c to make sure i2c channel is working if the bytes read back are not changed.

#178
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 2,893 posts
  • Gender:Male
  • Location:Moscow

Any link for a working version of this?

Post N52 here. And link is still alive.
When you install the utility, or open by Pacifist, you may find ATITVOut. In kextstat I see that it loaded but I make no any test yet because no any other monitors and TV near to my working place.

Edit:
Just put subAddress as the first data byte to write. However, what itvview.c does is only save random bytes to tv and read them back through i2c to make sure i2c channel is working if the bytes read back are not changed.

I didn't check, sorry. May be you are right. But not all I2C bus return the same value as written! For a what? It may be some kind of RAM or register space. Don't know.

I am busy to adjust Linux sources to The Project.

#179
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 2,893 posts
  • Gender:Male
  • Location:Moscow
C++ is very complex language. I understand that OpenATI project is wrong defining class ATIDriver.
Here there is working one without any hardware function. Very good template.
Now we can add functions to ATIDriver or override some framebuffer members.
Look xbench results before
Quartz Graphics Test	41.38	
		Line	34.74	2.31 Klines/sec [50% alpha]
		Rectangle	35.67	10.65 Krects/sec [50% alpha]
		Circle	35.46	2.89 Kcircles/sec [50% alpha]
		Bezier	58.89	1.49 Kbeziers/sec [50% alpha]
		Text	53.05	3.32 Kchars/sec
	OpenGL Graphics Test	24.09	
		Spinning Squares	24.09	30.57 frames/sec
	User Interface Test	55.41	
		Elements	55.41	254.31 refresh/sec
and after
Quartz Graphics Test	60.39	
		Line	48.79	3.25 Klines/sec [50% alpha]
		Rectangle	59.06	17.63 Krects/sec [50% alpha]
		Circle	57.87	4.72 Kcircles/sec [50% alpha]
		Bezier	69.16	1.74 Kbeziers/sec [50% alpha]
		Text	73.38	4.59 Kchars/sec
	OpenGL Graphics Test	23.89	
		Spinning Squares	23.89	30.30 frames/sec
	User Interface Test	81.26	
		Elements	81.26	372.93 refresh/sec
What is happen? This is nearly empty class! Other interrupts? No IOPEFNDRV calls?

#180
Slice

Slice

    InsanelyMacaholic

  • Local Moderators
  • 2,893 posts
  • Gender:Male
  • Location:Moscow
Next step.

This project contains Radeon initialization and BIOS interpretation. So I get internal structures needed to make switch resolution. Final cut is to do the procedure :D

The problems:
1. For my shared memory I want to change physical address of framebuffer from PCI address 0xd0000000 to kernel space 0x38000000. I see method
IOReturn IOFramebuffer::doSetup( bool full )
that is not present in IONDRVFramebuffer. How to influence?
For users with dedicated memory there is no problem.

2. GetConnectors
from BIOS I get static array of connectors.
from registry I get index of framebuffer
How can I know that framebuffer is connected to bus N?
Joblo said
/*-------------------------------------------------------------------------
* Probe physical connection of a CRT. This code comes from XFree
* as well and currently is only implemented for the CRT DAC, the
* code for the TVDAC is commented out in XFree as "non working"
*/
What to do? I have TVDAC namely.
From Linux codes I see my connector is PROPRIETARY.
And I have poor connectorInfo from BIOS even with latest codes.
I simply write rinfo->mon1_type = MT_LCD; despite on all previous calculations.

3. R500 compatibility. Cause I still use Joblo's sources my project is intended for R200-R400.
Needs to rewrite INPLL, OUTPLL, memory mapping (MC_FB_LOCATION) etc. according to similar Linux codes. XF project must work for R500-R600!

4. I2C bus routing I didn't implement because I can't check its. No problem! Simply get dong's sources RadeonDump and use it at command
cscGetCommunicationInfo

The kext is still works with ATILead but without switch resolutions.
Take into account that I inject value
<key>@0,address</key>
<integer>0xd0000000</integer>
It is my own address. It is not good idea to write it manually. Simply delete this key!

What about ATILead compatibility with R500-R600? I think it is not problem for dong :P





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy