mirror of
https://github.com/isometimes/rpi4-osdev
synced 2024-11-24 11:10:40 +00:00
62 lines
1.6 KiB
C
62 lines
1.6 KiB
C
#include "../include/wgt.h"
|
|
|
|
void vga256(void)
|
|
{
|
|
mbox[0] = 35*4; // Length of message in bytes
|
|
mbox[1] = MBOX_REQUEST;
|
|
|
|
mbox[2] = MBOX_TAG_SETPHYWH; // Tag identifier
|
|
mbox[3] = 8; // Value size in bytes
|
|
mbox[4] = 0;
|
|
mbox[5] = 1920; // Value(width)
|
|
mbox[6] = 1080; // Value(height)
|
|
|
|
mbox[7] = MBOX_TAG_SETVIRTWH;
|
|
mbox[8] = 8;
|
|
mbox[9] = 8;
|
|
//mbox[10] = 1920;
|
|
//mbox[11] = 1080;
|
|
mbox[10] = 320;
|
|
mbox[11] = 200;
|
|
|
|
mbox[12] = MBOX_TAG_SETVIRTOFF;
|
|
mbox[13] = 8;
|
|
mbox[14] = 8;
|
|
mbox[15] = 0; // Value(x)
|
|
mbox[16] = 0; // Value(y)
|
|
|
|
mbox[17] = MBOX_TAG_SETDEPTH;
|
|
mbox[18] = 4;
|
|
mbox[19] = 4;
|
|
mbox[20] = 32; // Bits per pixel
|
|
|
|
mbox[21] = MBOX_TAG_SETPXLORDR;
|
|
mbox[22] = 4;
|
|
mbox[23] = 4;
|
|
mbox[24] = 1; // RGB
|
|
|
|
mbox[25] = MBOX_TAG_GETFB;
|
|
mbox[26] = 8;
|
|
mbox[27] = 8;
|
|
mbox[28] = 4096; // FrameBufferInfo.pointer
|
|
mbox[29] = 0; // FrameBufferInfo.size
|
|
|
|
mbox[30] = MBOX_TAG_GETPITCH;
|
|
mbox[31] = 4;
|
|
mbox[32] = 4;
|
|
mbox[33] = 0; // Bytes per line
|
|
|
|
mbox[34] = MBOX_TAG_LAST;
|
|
|
|
// Check call is successful and we have a pointer with depth 32
|
|
if (mbox_call(MBOX_CH_PROP) && mbox[20] == 32 && mbox[28] != 0) {
|
|
mbox[28] &= 0x3FFFFFFF; // Convert GPU address to ARM address
|
|
WGT_SYS.xres = mbox[10]; // Actual physical width
|
|
WGT_SYS.yres = mbox[11]; // Actual physical height
|
|
WGT_SYS.screenwidth = mbox[10];
|
|
WGT_SYS.screenheight = mbox[11];
|
|
|
|
fbuf = (unsigned int *)((long)mbox[28]);
|
|
abuf = fbuf;
|
|
}
|
|
}
|