Chameleon

Chameleon Commit Details

Date:2015-07-30 04:01:37 (8 years 8 months ago)
Author:ErmaC
Commit:2740
Parents: 2739
Message:sync with trunk.
Changes:
M/branches/ErmaC/Enoch/i386/boot2/lzvn.c
M/branches/ErmaC/Enoch/i386/boot2/graphics.c
M/branches/ErmaC/Enoch/i386/libsaio/gma.c
M/branches/ErmaC/Enoch/i386/boot2/boot.c
M/branches/ErmaC/Enoch/i386/boot2/gui.c
M/branches/ErmaC/Enoch/i386/boot2/boot.h

File differences

branches/ErmaC/Enoch/i386/libsaio/gma.c
4848
4949
5050
51
52
53
54
5551
5652
5753
......
6965
7066
7167
72
7368
7469
75
7670
7771
7872
......
135129
136130
137131
138
139132
140133
141134
......
157150
158151
159152
160
161153
162154
163155
......
869861
870862
871863
872
873864
874865
875866
......
939930
940931
941932
942
933
943934
944935
945936
#define DEBUG_GMA 0
#endif
#ifndef DEBUG_BDW
#define DEBUG_BDW 1
#endif
#if DEBUG_GMA
#define DBG(x...)printf(x)
#else
static uint8_t default_aapl_haswell[]={ 0x00,0x00,0x26,0x0c }; // haswell_ig_vals[7]
#define AAPL_LEN_HSW ( sizeof(default_aapl_haswell) / sizeof(uint8_t) )
#if DEBUG_BDW
static uint8_t default_aapl_broadwell[]={ 0x00,0x00,0x1e,0x16 }; // broadwell_ig_vals[2]
#define AAPL_LEN_BDW ( sizeof(default_aapl_broadwell) / sizeof(uint8_t) )
#endif
uint8_t GMAX3100_vals[23][4] = {
{ 0x01,0x00,0x00,0x00 },//0 "AAPL,HasPanel"
{ 0x04,0x00,0x12,0x04 }// 16 "AAPL,ig-platform-id" //FB: 32MB, Pipes: 3, Ports: 3, FBMem: 3 - ULT mobile GT3
};
#if DEBUG_BDW
uint8_t broadwell_ig_vals[19][4] = {
{ 0x00,0x00,0x06,0x16 },// 0 - 16060000 Broadwell GT1 (Intel HD Graphics)
{ 0x00,0x00,0x0e,0x16 },// 1 - 160e0000 Broadwell GT1 (Intel HD Graphics)
{ 0x05,0x00,0x26,0x16 },// 17 - 16260005 Broadwell GT3 (MacBook Air) (Intel HD Graphics 6000)
{ 0x06,0x00,0x26,0x16 }// 18 - 16260006 Broadwell GT3 (MacBook Air) (Intel HD Graphics 6000)
};
#endif
uint8_t HD2000_vals[16][4] = {
{ 0x00,0x00,0x00,0x00 }, //0 "AAPL00,PixelFormat"
break;
#if DEBUG_BDW
/* Broadwell */
/* HD Graphics 5300 Mobile, HD Graphics 6000 Mobile, HD Graphics 6100 Mobile */
case GMA_BROADWELL_BDW_0bd0: // 0bd0
devprop_add_value(device, "class-code", ClassFix, 4);
break;
#endif // DEBUG_BDW
default:
break;
}
branches/ErmaC/Enoch/i386/boot2/graphics.c
397397
398398
399399
400
400
401401
402402
403403
......
483483
484484
485485
486
486
487487
488
488
489489
490
491
492
493
490
491
492
493
494494
495
495
496496
497
498
499
500
501
502
503
504
505
497
498
499
500
501
502
503
504
505
506506
507
508
507
508
509509
510
511
512
510
511
512
513
513514
514
515
515
516
516517
517
518
519
520
521
522
518
519
520
521
522
523
523524
524525
525526
526
527
527528
528529
529530
530531
531532
532533
533
534
535
536
534
535
536
537
537538
538
539
540
541
542
543
544
545
539
540
541
542
543
544
545
546
547
546548
547
548
549
550
551
552
553
549
550
551
552
553
554
555
554556
555
556
557
558
559
560
561
557
558
559
560
561
562
563
562564
563565
564566
......
860862
861863
862864
863
865
864866
865867
868
866869
870
867871
868872
869873
870874
875
871876
872877
873878
......
928933
929934
930935
931
936
932937
933938
934939
935940
936
937
941
942
938943
939944
940945
......
959964
960965
961966
967
962968
963969
964970
......
10221028
10231029
10241030
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
10311037
10321038
10331039
//==========================================================================
// Simple decompressor for boot images encoded in RLE format.
char * decodeRLE( const void * rleData, int rleBlocks, int outBytes )
char *decodeRLE( const void *rleData, int rleBlocks, int outBytes )
{
char *out, *cp;
// err = setVBEMode( mode | kLinearFrameBufferBit, NULL );
// }
// Set the mode with default refresh rate.
// Set the mode with default refresh rate.
err = setVBEMode(mode | kLinearFrameBufferBit, NULL);
err = setVBEMode(mode | kLinearFrameBufferBit, NULL);
if (err != errSuccess)
{
break;
}
if (err != errSuccess)
{
break;
}
// Set 8-bit color palette.
// Set 8-bit color palette.
if ( minfo.BitsPerPixel == 8 )
{
VBEPalette palette;
setupPalette( &palette, appleClut8 );
if ((err = setVBEPalette(palette)) != errSuccess)
{
break;
}
}
if ( minfo.BitsPerPixel == 8 )
{
VBEPalette palette;
setupPalette( &palette, appleClut8 );
if ((err = setVBEPalette(palette)) != errSuccess)
{
break;
}
}
// Is this required for buggy Video BIOS implementations?
// On which adapter?
// Is this required for buggy Video BIOS implementations?
// On which adapter?
if ( minfo.BytesPerScanline == 0 )
minfo.BytesPerScanline = ( minfo.XResolution *
minfo.BitsPerPixel ) >> 3;
if ( minfo.BytesPerScanline == 0 )
{
minfo.BytesPerScanline = ( minfo.XResolution * minfo.BitsPerPixel ) >> 3;
}
// Update KernBootStruct using info provided by the selected
// VESA mode.
// Update KernBootStruct using info provided by the selected
// VESA mode.
bootArgs->Video.v_display = GRAPHICS_MODE;
bootArgs->Video.v_width = minfo.XResolution;
bootArgs->Video.v_height = minfo.YResolution;
bootArgs->Video.v_depth = minfo.BitsPerPixel;
bootArgs->Video.v_rowBytes = minfo.BytesPerScanline;
bootArgs->Video.v_baseAddr = VBEMakeUInt32(minfo.PhysBasePtr);
bootArgs->Video.v_display = GRAPHICS_MODE;
bootArgs->Video.v_width = minfo.XResolution;
bootArgs->Video.v_height = minfo.YResolution;
bootArgs->Video.v_depth = minfo.BitsPerPixel;
bootArgs->Video.v_rowBytes = minfo.BytesPerScanline;
bootArgs->Video.v_baseAddr = VBEMakeUInt32(minfo.PhysBasePtr);
} while ( 0 );
return err;
return err;
}
//==============================================================================
int convertImage( unsigned short width, unsigned short height, const unsigned char *imageData, unsigned char **newImageData )
{
int cnt;
unsigned char *img = 0;
unsigned short *img16;
unsigned long *img32;
int cnt;
unsigned char *img = 0;
unsigned short *img16;
unsigned long *img32;
switch ( VIDEO(depth) ) {
case 16 :
img16 = malloc(width * height * 2);
if ( !img16 ) break;
for (cnt = 0; cnt < (width * height); cnt++)
img16[cnt] = lookUpCLUTIndex(imageData[cnt], 16);
img = (unsigned char *)img16;
break;
switch ( VIDEO(depth) )
{
case 16 :
img16 = malloc(width * height * 2);
if ( !img16 ) break;
for (cnt = 0; cnt < (width * height); cnt++)
img16[cnt] = lookUpCLUTIndex(imageData[cnt], 16);
img = (unsigned char *)img16;
break;
case 32 :
img32 = malloc(width * height * 4);
if ( !img32 ) break;
for (cnt = 0; cnt < (width * height); cnt++)
img32[cnt] = lookUpCLUTIndex(imageData[cnt], 32);
img = (unsigned char *)img32;
break;
case 32 :
img32 = malloc(width * height * 4);
if ( !img32 ) break;
for (cnt = 0; cnt < (width * height); cnt++)
img32[cnt] = lookUpCLUTIndex(imageData[cnt], 32);
img = (unsigned char *)img32;
break;
default :
img = malloc(width * height);
bcopy(imageData, img, width * height);
break;
}
*newImageData = img;
return 0;
default :
img = malloc(width * height);
bcopy(imageData, img, width * height);
break;
}
*newImageData = img;
return 0;
}
//==============================================================================
unsigned short y,
unsigned short width,
unsigned short height,
unsigned char * data )
unsigned char *data )
{
unsigned short drawWidth;
long pixelBytes = VIDEO(depth) / 8;
unsigned char * vram = (unsigned char *) VIDEO(baseAddr) + VIDEO(rowBytes) * y + pixelBytes * x;
drawWidth = MIN(width, VIDEO(width) - x);
height = MIN(height, VIDEO(height) - y);
while ( height-- )
{
bcopy( data, vram, drawWidth * pixelBytes );
void drawPreview(void *src, uint8_t * saveunder)
{
uint8_t * screen;
uint8_t *screen;
uint32_t rowBytes, pixelShift;
uint32_t x, y;
int32_t blob;
uint32_t alpha, in, color, result;
uint8_t * out;
void *uncomp;
uint8_t *out;
void *uncomp;
int origwidth, origheight, origbpx;
uint32_t saveindex[kIOHibernateProgressCount] = { 0 };
screen = (uint8_t *) VIDEO (baseAddr);
rowBytes = VIDEO (rowBytes);
// Set the screen to 75% grey.
drawColorRectangle(0, 0, VIDEO(width), VIDEO(height), 0x01 /* color index */);
}
void updateProgressBar(uint8_t * saveunder, int32_t firstBlob, int32_t select)
{
uint8_t * screen;
uint32_t rowBytes, pixelShift;
uint32_t x, y;
int32_t blob, lastBlob;
uint32_t alpha, in, color, result;
uint8_t * out;
uint8_t*screen;
uint32_trowBytes, pixelShift;
uint32_tx, y;
int32_tblob, lastBlob;
uint32_talpha, in, color, result;
uint8_t*out;
uint32_t saveindex[kIOHibernateProgressCount] = { 0 };
pixelShift = VIDEO(depth) >> 4;
branches/ErmaC/Enoch/i386/boot2/lzvn.c
6262
6363
6464
65
66
6567
6668
67
6869
6970
7071
const void *src,
size_t src_size)
{
const uint64_t rdi = (const uint64_t)dst;
size_t rax = 0;
const uint64_t rdi = (const uint64_t)dst;
uint64_t rsi = dst_size;
uint64_t rcx = src_size;
uint64_t rdx = (uint64_t)src;
branches/ErmaC/Enoch/i386/boot2/boot.c
105105
106106
107107
108
108
109109
110110
111111
//static voidselectBiosDevice(void);
/** options.c **/
extern char* msgbuf;
extern char *msgbuf;
void showTextBuffer(char *buf, int size);
//==========================================================================
branches/ErmaC/Enoch/i386/boot2/boot.h
289289
290290
291291
292
292
293293
294294
295295
unsigned short height,
const unsigned char *imageData,
unsigned char **newImageData );
extern char * decodeRLE( const void * rleData, int rleBlocks, int outBytes );
extern char *decodeRLE( const void *rleData, int rleBlocks, int outBytes );
extern void drawBootGraphics(void);
extern void drawPreview(void *src, uint8_t *saveunder);
extern int getVideoMode(void);
branches/ErmaC/Enoch/i386/boot2/gui.c
13361336
13371337
13381338
1339
1340
1339
13411340
13421341
13431342
......
14171416
14181417
14191418
1420
1421
1419
1420
14221421
14231422
14241423
14251424
1426
1427
1425
14281426
14291427
14301428
......
23272325
23282326
23292327
2330
2331
2332
2328
2329
2330
23332331
23342332
23352333
......
23642362
23652363
23662364
2367
2368
2369
2370
2365
2366
2367
2368
2369
2370
2371
23712372
23722373
23732374
......
24172418
24182419
24192420
2420
2421
2421
2422
24222423
24232424
24242425
......
24312432
24322433
24332434
2434
2435
2436
2437
2435
2436
2437
2438
24382439
2439
2440
2440
2441
24412442
24422443
2443
2444
24442445
24452446
2446
2447
2447
2448
24482449
24492450
24502451
2451
2452
2452
2453
24532454
24542455
24552456
// ====================================================================
static inline
void vramwrite (void *data, int width, int height)
static inline void vramwrite (void *data, int width, int height)
{
if (VIDEO (depth) == 32 && VIDEO (rowBytes) == gui.backbuffer->width * 4)
{
struct putc_info //Azi: exists on console.c & printf.c
{
char * str;
char * last_str;
char *str;
char *last_str;
};
// ====================================================================
static int
sputc(int c, struct putc_info * pi) //Azi: same as above
static int sputc(int c, struct putc_info * pi) //Azi: same as above
{
if (pi->last_str)
{
// ====================================================================
uint16_t bootImageWidth = 0;
uint16_t bootImageHeight = 0;
uint8_t *bootImageData = NULL;
uint16_t bootImageWidth = 0;
uint16_t bootImageHeight = 0;
uint8_t *bootImageData = NULL;
static bool usePngImage = true;
//==========================================================================
int length;
const char *dummyVal;
int oldScreenWidth, oldScreenHeight;
bool legacy_logo;
uint16_t x, y;
if (getBoolForKey("Legacy Logo", &legacy_logo, &bootInfo->chameleonConfig) && legacy_logo)
bool legacy_logo = true; // ErmaC: Legacy Logo is enabled by default
uint16_t x, y;
getBoolForKey("Legacy Logo", &legacy_logo, &bootInfo->chameleonConfig);
if ( legacy_logo )
{
usePngImage = false;
}
}
else
{
// Fill the background to 75% grey (same as BootX).
drawColorRectangle(0, 0, screen_params[0], screen_params[1], 0x01);
// Fill the background to 75% grey (same as BootX).
drawColorRectangle(0, 0, screen_params[0], screen_params[1], 0x01);
}
if ((bootImageData) && (usePngImage))
}
else
{
uint8_t *appleBootPict;
bootImageData = NULL;
bootImageWidth = kAppleBootWidth;
bootImageHeight = kAppleBootHeight;
uint8_t *appleBootPict;
bootImageData = NULL;
bootImageWidth = kAppleBootWidth;
bootImageHeight = kAppleBootHeight;
// Prepare the data for the default Apple boot image.
appleBootPict = (uint8_t *) decodeRLE(gAppleBootPictRLE, kAppleBootRLEBlocks, bootImageWidth * bootImageHeight);
// Prepare the data for the default Apple boot image.
appleBootPict = (uint8_t *) decodeRLE(gAppleBootPictRLE, kAppleBootRLEBlocks, bootImageWidth * bootImageHeight);
if (appleBootPict)
{
convertImage(bootImageWidth, bootImageHeight, appleBootPict, &bootImageData);
convertImage(bootImageWidth, bootImageHeight, appleBootPict, &bootImageData);
if (bootImageData)
{
x = (screen_params[0] - MIN(kAppleBootWidth, screen_params[0])) / 2;
y = (screen_params[1] - MIN(kAppleBootHeight, screen_params[1])) / 2;
x = (screen_params[0] - MIN(kAppleBootWidth, screen_params[0])) / 2;
y = (screen_params[1] - MIN(kAppleBootHeight, screen_params[1])) / 2;
drawDataRectangle(x, y, kAppleBootWidth, kAppleBootHeight, bootImageData);
free(bootImageData);
}
free(appleBootPict);
}
free(appleBootPict);
}
}
}
// ====================================================================

Archive Download the corresponding diff file

Revision: 2740