Author Topic: [PATCH] nvidia "display-cfg" injection  (Read 11640 times)

0 Members and 1 Guest are viewing this topic.

Gringo Vermelho

  • Forum Moderator
  • Posts: 611
  • The gray monster energy hat
[PATCH] nvidia "display-cfg" injection
« on: October 08, 2010, 05:13:27 PM »
Patch by Jingu is here in the NVEnabler release thread:
http://www.projectosx.com/forum/index.php?s=&showtopic=370&view=findpost&p=10461
Please consider adding this to Chameleon 2.0 RC5. There's more info specifically about display-cfg in the first post:
http://www.projectosx.com/forum/index.php?showtopic=370

At present I'm using the DSDT code below to inject a suitable display-cfg value. It works together with Chameleon Graphics Enabler and gives me working analog TV-out on my 9800GTX+. Having this configurable via com.apple.Boot.plist would be very convenient.
Code: [Select]
                Device (GFX0)
                {
                    Name (_ADR, Zero)
                    Method (_DSM, 4, NotSerialized)
                    {
                        Store (Package (0x12)
                            {
                                "@0,compatible",
                                Buffer (0x0B)
                                {
                                    "NVDA,NVMac"
                                },

                                "@0,device_type",
                                Buffer (0x08)
                                {
                                    "display"
                                },

                                "@0,display-cfg",
                                Buffer (0x04)
                                {
                                    0x03, 0x01, 0x00, 0x00
                                },

                                "@0,name",
                                Buffer (0x0F)
                                {
                                    "NVDA,Display-A"
                                },

                                "@1,compatible",
                                Buffer (0x0B)
                                {
                                    "NVDA,NVMac"
                                },

                                "@1,device_type",
                                Buffer (0x08)
                                {
                                    "display"
                                },

                                "@1,display-cfg",
                                Buffer (0x04)
                                {
                                    0xFF, 0xFF, 0x00, 0x01
                                },

                                "@1,name",
                                Buffer (0x0F)
                                {
                                    "NVDA,Display-B"
                                },

                                "NVCAP",
                                Buffer (0x18)
                                {
                                    /* 0000 */    0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
                                    /* 0008 */    0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A,
                                    /* 0010 */    0x00, 0x00, 0x00, 0x00
                                }
                            }, Local0)
                        MCDP (Arg2, RefOf (Local0))
                        Return (Local0)
                    }
 
« Last Edit: October 08, 2010, 05:37:23 PM by Gringo Vermelho »
10.9.5 - ASUS P8Z77-V Pro - i5 3570K - GTX 660 - Chameleon 2.3 svn-r2xxx
How to...
Install Chameleon: http://forum.voodooprojects.org/index.php/topic,649
Make your own Chameleon boot CD: http://forum.voodooprojects.org/index.php/topic,484.msg2131.html#msg2131

valv

  • VoodooLabs
  • Posts: 72
    • The AnVAL Forum (fr)
Re: [PATCH] nvidia "display-cfg" injection
« Reply #1 on: October 11, 2010, 07:36:14 PM »
hi Gringo,
just to tell u that I (at least) would be interested in implementing this into my branch. So far, I added this to nvidia.c:
Code: [Select]
static uint8_t default_dcfg_0[] = {0xff, 0xff, 0xff, 0xff};
static uint8_t default_dcfg_1[] = {0xff, 0xff, 0xff, 0xff};

static uint8_t default_NVPM[]= {
    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00
};

#define DCFG0_LEN ( sizeof(default_dcfg_0) / sizeof(uint8_t) )
#define DCFG1_LEN ( sizeof(default_dcfg_1) / sizeof(uint8_t) )
...
if (getValueForKey(kdcfg0, &value, &len, &bootInfo->bootConfig) && len == DCFG0_LEN * 2) {
uint8_t new_dcfg0[DCFG0_LEN];
 
if (hex2bin(value, new_dcfg0, DCFG0_LEN) == 0) {
verbose("Using user supplied @0,display-cfg\n");
memcpy(default_dcfg_0, new_dcfg0, DCFG0_LEN);
}
}

#if DEBUG_dcfg0
        printf("@0,display-cfg: %02x%02x%02x%02x\n",
default_dcfg_0[0], default_dcfg_0[1], default_dcfg_0[2], default_dcfg_0[3], default_dcfg_0[4]);
#endif

if (getValueForKey(kdcfg1, &value, &len, &bootInfo->bootConfig) && len == DCFG1_LEN * 2) {
uint8_t new_dcfg1[DCFG1_LEN];
 
if (hex2bin(value, new_dcfg1, DCFG1_LEN) == 0) {
verbose("Using user supplied @1,display-cfg\n");
memcpy(default_dcfg_1, new_dcfg1, DCFG1_LEN);
}
}

#if DEBUG_dcfg1
        printf("@1,display-cfg: %02x%02x%02x%02x\n",
default_dcfg_1[0], default_dcfg_1[1], default_dcfg_1[2], default_dcfg_1[3], default_dcfg_1[4]);
#endif
...
devprop_add_value(device, "@0,display-cfg", default_dcfg_0, DCFG0_LEN);
devprop_add_value(device, "@1,display-cfg", default_dcfg_1, DCFG1_LEN);
devprop_add_value(device, "NVPM", default_NVPM, 28);

What I did here, is clone how NVCAP injection is done ;D Next I added these keys to boot.h:
Code: [Select]
#define kdcfg0 "display_0" /* nvidia.c */
#define kdcfg1 "display_1" /* nvidia.c */

That's, user adds the keys to boot.plist. But, I don't seem to get it to work (not sure in which format the value should be input :-[).

Gringo Vermelho

  • Forum Moderator
  • Posts: 611
  • The gray monster energy hat
Re: [PATCH] nvidia "display-cfg" injection
« Reply #2 on: October 15, 2010, 12:58:12 AM »
Cool, thanks for looking at it valv.

The discussion continues in the thread over at ProjectOSX but I got lost trying to make sense of it.
10.9.5 - ASUS P8Z77-V Pro - i5 3570K - GTX 660 - Chameleon 2.3 svn-r2xxx
How to...
Install Chameleon: http://forum.voodooprojects.org/index.php/topic,649
Make your own Chameleon boot CD: http://forum.voodooprojects.org/index.php/topic,484.msg2131.html#msg2131

audio01

  • Entrant
  • Posts: 2
Re: [PATCH] nvidia "display-cfg" injection
« Reply #3 on: October 21, 2010, 10:14:25 PM »
just to tell u that I (at least) would be interested in implementing this into my branch.

Hi, Did you have the chance to implement it in your branch? Any progress on this subject?

Cheers!

valv

  • VoodooLabs
  • Posts: 72
    • The AnVAL Forum (fr)
Re: [PATCH] nvidia "display-cfg" injection
« Reply #4 on: October 21, 2010, 11:02:03 PM »
Yes...not yet online though :P

Slice

  • VoodooLabs
  • Posts: 52
Re: [PATCH] nvidia "display-cfg" injection
« Reply #5 on: January 15, 2011, 08:05:31 PM »
I implemented this patch and have good reports.