22 #include "pedigree/kernel/machine/openfirmware/Device.h" 23 #include "pedigree/kernel/machine/openfirmware/OpenFirmware.h" 24 #include "pedigree/kernel/processor/PhysicalMemoryManager.h" 25 #include "pedigree/kernel/processor/VirtualAddressSpace.h" 26 #include "pedigree/kernel/utilities/utility.h" 29 : m_Framebuffer(
"VGA framebuffer"), m_pFramebuffer(0), m_Width(0),
30 m_Height(0), m_Depth(0), m_Stride(0)
47 OFParam physFbAddr = screen.getProperty(
"address");
52 m_Framebuffer, 0x01000000 / 0x1000,
58 reinterpret_cast<uintptr_t>(physFbAddr)))
78 m_Width =
reinterpret_cast<uint32_t
>(screen.getProperty(
"width"));
79 m_Height =
reinterpret_cast<uint32_t
>(screen.getProperty(
"height"));
80 m_Depth =
reinterpret_cast<uint32_t
>(screen.getProperty(
"depth"));
81 m_Stride =
reinterpret_cast<uint32_t
>(screen.getProperty(
"linebytes"));
85 for (
int i = 0; i < 16; i++)
88 else if (m_Depth == 16)
90 m_pColours[0] = RGB_16(0x00, 0x00, 0x00);
91 m_pColours[1] = RGB_16(0x00, 0x00, 0x99);
92 m_pColours[2] = RGB_16(0x00, 0x99, 0x00);
93 m_pColours[3] = RGB_16(0x00, 0x99, 0x99);
94 m_pColours[4] = RGB_16(0x99, 0x00, 0x00);
95 m_pColours[5] = RGB_16(0x99, 0x00, 0x99);
96 m_pColours[6] = RGB_16(0x99, 0x66, 0x00);
97 m_pColours[7] = RGB_16(0xBB, 0xBB, 0xBB);
98 m_pColours[8] = RGB_16(0x99, 0x99, 0x99);
99 m_pColours[9] = RGB_16(0x00, 0x00, 0xFF);
100 m_pColours[10] = RGB_16(0x00, 0xFF, 0x00);
101 m_pColours[11] = RGB_16(0x00, 0xFF, 0xFF);
102 m_pColours[12] = RGB_16(0xFF, 0x00, 0x00);
103 m_pColours[13] = RGB_16(0xFF, 0x00, 0xFF);
104 m_pColours[14] = RGB_16(0xFF, 0xFF, 0x00);
105 m_pColours[15] = RGB_16(0xFF, 0xFF, 0xFF);
110 uint16_t clear =
' ';
111 for (
unsigned int i = 0;
112 i < (m_Width / FONT_WIDTH) * (m_Height / FONT_HEIGHT); i++)
114 m_pTextBuffer[i] = clear;
120 for (
unsigned int i = 0; i < m_Stride * m_Height; i++)
131 p32Fb[i] = 0x00000000;
139 uint16_t *pBuffer16 =
reinterpret_cast<uint16_t *
>(pBuffer);
141 for (
unsigned int i = 0; i < (m_Width / FONT_WIDTH); i++)
143 for (
unsigned int j = 0; j < (m_Height / FONT_HEIGHT); j++)
145 int idx = j * (m_Width / FONT_WIDTH) + i;
146 if ((pBuffer16 == m_pTextBuffer) ||
147 (pBuffer16[idx] != m_pTextBuffer[idx]))
149 m_pTextBuffer[idx] = pBuffer16[idx];
150 uint16_t ch = m_pTextBuffer[j * (m_Width / FONT_WIDTH) + i];
152 fg = m_pColours[(ch >> 8) & 0xF];
153 bg = m_pColours[(ch >> 12) & 0xF];
154 putChar(ch & 0xFF, i * FONT_WIDTH, j * FONT_HEIGHT, fg, bg);
162 MemoryCopy(pBuffer, m_pTextBuffer, nBufLen);
165 void PPCVga::putChar(
char c,
int x,
int y,
unsigned int f,
unsigned int b)
167 int idx =
static_cast<int>(c) * FONT_HEIGHT;
170 for (
int i = 0; i < FONT_HEIGHT; i++)
172 unsigned char row = ppc_font[idx + i];
173 for (
int j = 0; j < FONT_WIDTH; j++)
176 if ((row & (0x80 >> j)) != 0)
188 else if (m_Depth == 16)
189 p16Fb[y * m_Stride + i * m_Stride + x + j] = col & 0xFFFF;
191 p32Fb[y * m_Stride + i * m_Stride + x + j] = col;
static PhysicalMemoryManager & instance()
static const size_t continuous
static OpenFirmware & instance()
virtual void pokeBuffer(uint8_t *pBuffer, size_t nBufLen)
virtual void peekBuffer(uint8_t *pBuffer, size_t nBufLen)
static const size_t force
static const size_t WriteThrough
static const size_t Write
static const size_t KernelMode
virtual bool allocateRegion(MemoryRegion &Region, size_t cPages, size_t pageConstraints, size_t Flags, physical_uintptr_t start=-1)=0
void * virtualAddress() const
static const size_t nonRamMemory