Compare commits
39
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e54b34aa93 | ||
|
|
fcfe7c3204 | ||
|
|
be4b482bde | ||
|
|
6f50b053b7 | ||
|
|
ece376660c | ||
|
|
98a14bc7dc | ||
|
|
989e36ffe2 | ||
|
|
ceb03a9d7e | ||
|
|
8be364c990 | ||
|
|
0e2c6b2936 | ||
|
|
632c3fa66b | ||
|
|
875e3e4765 | ||
|
|
e28d68128d | ||
|
|
a9969d58f8 | ||
|
|
d7a54d858d | ||
|
|
4e991c3e6f | ||
|
|
a3217de71a | ||
|
|
19b433a19f | ||
|
|
69d1d22a18 | ||
|
|
5c15343ed0 | ||
|
|
3ae349fbc8 | ||
|
|
78c060c114 | ||
|
|
cd925e96c2 | ||
|
|
142dd486dd | ||
|
|
beeeabd441 | ||
|
|
b73c66f6d6 | ||
|
|
a7111d3cac | ||
|
|
d182fd7f46 | ||
|
|
b5582b1284 | ||
|
|
161cea4920 | ||
|
|
6b81c4ece0 | ||
|
|
ee17f69115 | ||
|
|
81c19bff16 | ||
|
|
e7cda58113 | ||
|
|
44f18554e1 | ||
|
|
52b42ec975 | ||
|
|
2815dd9e4d | ||
|
|
d057bfc3ff | ||
|
|
e4621c8aaa |
No files matched your search
@@ -11,3 +11,7 @@
|
|||||||
/*.img
|
/*.img
|
||||||
src/include/asuro.pas
|
src/include/asuro.pas
|
||||||
localenv.json
|
localenv.json
|
||||||
|
/lvgl/
|
||||||
|
dockerout.txt
|
||||||
|
AGENTS.md
|
||||||
|
*.log
|
||||||
+1
-1
@@ -5,7 +5,7 @@ VOLUME ["/code"]
|
|||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
RUN dpkg --add-architecture i386
|
RUN dpkg --add-architecture i386
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
curl dos2unix wget git make nasm binutils:i386 xorriso grub-pc-bin && \
|
curl dos2unix wget git make nasm binutils xorriso grub-pc-bin gcc gcc-multilib && \
|
||||||
apt-get clean my room
|
apt-get clean my room
|
||||||
|
|
||||||
SHELL ["/bin/bash", "-c"]
|
SHELL ["/bin/bash", "-c"]
|
||||||
|
|||||||
+2
-1
@@ -7,7 +7,7 @@ echo "Asuro Compilation"
|
|||||||
echo " "
|
echo " "
|
||||||
|
|
||||||
#Compile Stub.asm
|
#Compile Stub.asm
|
||||||
rm lib/*
|
rm -f lib/*
|
||||||
|
|
||||||
runOrFail() {
|
runOrFail() {
|
||||||
local binary=$1
|
local binary=$1
|
||||||
@@ -23,6 +23,7 @@ runOrFail() {
|
|||||||
declare -a run_steps=(
|
declare -a run_steps=(
|
||||||
"compile_stub.sh" "Failed to compile stub!"
|
"compile_stub.sh" "Failed to compile stub!"
|
||||||
"compile_vergen.sh" "Versions failed to compile"
|
"compile_vergen.sh" "Versions failed to compile"
|
||||||
|
"compile_lvgl.sh" "Failed to compile LVGL!"
|
||||||
"compile_sources.sh" "Failed to compile FPC Sources!"
|
"compile_sources.sh" "Failed to compile FPC Sources!"
|
||||||
"compile_link.sh" "Failed linking!"
|
"compile_link.sh" "Failed linking!"
|
||||||
"compile_isogen.sh" "Failed to create ISO!"
|
"compile_isogen.sh" "Failed to create ISO!"
|
||||||
|
|||||||
+6
-1
@@ -14,4 +14,9 @@ done;
|
|||||||
objstring=lib/stub.o" "$objstring
|
objstring=lib/stub.o" "$objstring
|
||||||
echo "Object Files: "$objstring
|
echo "Object Files: "$objstring
|
||||||
echo " "
|
echo " "
|
||||||
ld -m elf_i386 -s --gc-sections -Tlinker.script -o bin/kernel.bin $objstring
|
|
||||||
|
# Find libgcc for i386 (needed by LVGL compiled with gcc)
|
||||||
|
LIBGCC=$(gcc -m32 -print-libgcc-file-name)
|
||||||
|
echo "libgcc: ${LIBGCC}"
|
||||||
|
|
||||||
|
ld -m elf_i386 -s --gc-sections -Tlinker.script -o bin/kernel.bin $objstring --start-group lib/liblvgl.a ${LIBGCC} --end-group
|
||||||
+117
@@ -0,0 +1,117 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# compile_lvgl.sh — Download LVGL v9.2 source and compile into lib/liblvgl.a
|
||||||
|
# Clone & compile in /tmp (fast container-local fs).
|
||||||
|
# Copy source + objects to /lvgl (host mount) for debugging.
|
||||||
|
set -e
|
||||||
|
|
||||||
|
LVGL_VERSION="v9.2.2"
|
||||||
|
LVGL_REPO="https://github.com/lvgl/lvgl.git"
|
||||||
|
LVGL_DIR="/tmp/lvgl"
|
||||||
|
OBJ_DIR="/tmp/lvgl_obj"
|
||||||
|
CONF_DIR="$(pwd)/lvglh"
|
||||||
|
OUT_DIR="$(pwd)/lib"
|
||||||
|
|
||||||
|
CC="gcc"
|
||||||
|
CFLAGS="-m32 -march=i686 -ffreestanding \
|
||||||
|
-fno-builtin -fno-stack-protector -fno-pic -fno-pie \
|
||||||
|
-O2 -Wall -Wno-unused-function -Wno-unused-variable \
|
||||||
|
-I${CONF_DIR} \
|
||||||
|
-I${LVGL_DIR} \
|
||||||
|
-I${LVGL_DIR}/.. \
|
||||||
|
-DLV_CONF_INCLUDE_SIMPLE"
|
||||||
|
|
||||||
|
echo " "
|
||||||
|
echo "======================="
|
||||||
|
echo " "
|
||||||
|
echo "Compiling LVGL..."
|
||||||
|
echo " "
|
||||||
|
|
||||||
|
# Clone LVGL into /tmp (container-local)
|
||||||
|
rm -rf "$LVGL_DIR"
|
||||||
|
echo "Downloading LVGL ${LVGL_VERSION}..."
|
||||||
|
git clone --depth 1 --branch "${LVGL_VERSION}" "${LVGL_REPO}" "${LVGL_DIR}" 2>&1
|
||||||
|
echo "Download complete."
|
||||||
|
|
||||||
|
# Gather all LVGL .c source files (core library only, no demos/examples)
|
||||||
|
SOURCES=$(find "${LVGL_DIR}/src" -name '*.c' -not -path '*/test/*')
|
||||||
|
TOTAL=$(echo "$SOURCES" | wc -l)
|
||||||
|
echo "Found ${TOTAL} LVGL source files."
|
||||||
|
|
||||||
|
# Compile each .c file to .o (container-local)
|
||||||
|
rm -rf "$OBJ_DIR"
|
||||||
|
mkdir -p "$OBJ_DIR"
|
||||||
|
|
||||||
|
COUNT=0
|
||||||
|
ERRORS=0
|
||||||
|
for src in $SOURCES; do
|
||||||
|
COUNT=$((COUNT + 1))
|
||||||
|
rel="${src#${LVGL_DIR}/src/}"
|
||||||
|
obj_path="${OBJ_DIR}/${rel%.c}.o"
|
||||||
|
mkdir -p "$(dirname "$obj_path")"
|
||||||
|
|
||||||
|
if ! $CC $CFLAGS -c "$src" -o "$obj_path" 2>&1; then
|
||||||
|
echo "FAILED: $rel"
|
||||||
|
ERRORS=$((ERRORS + 1))
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $((COUNT % 50)) -eq 0 ]; then
|
||||||
|
echo " Compiled ${COUNT}/${TOTAL}..."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Compiled ${COUNT} files (${ERRORS} errors)."
|
||||||
|
|
||||||
|
if [ "$ERRORS" -ne 0 ]; then
|
||||||
|
echo "LVGL compilation FAILED with ${ERRORS} errors."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Archive into static library
|
||||||
|
OBJECTS=$(find "$OBJ_DIR" -name '*.o')
|
||||||
|
ar rcs "${OUT_DIR}/liblvgl.a" $OBJECTS
|
||||||
|
echo "Created ${OUT_DIR}/liblvgl.a"
|
||||||
|
|
||||||
|
# Compile custom LVGL extension files from lvglh/
|
||||||
|
LVGLH_SOURCES=$(find "${CONF_DIR}" -name '*.c' 2>/dev/null || true)
|
||||||
|
if [ -n "$LVGLH_SOURCES" ]; then
|
||||||
|
echo " "
|
||||||
|
echo "Compiling custom LVGL files from lvglh/..."
|
||||||
|
LVGLH_OBJ_DIR="/tmp/lvglh_obj"
|
||||||
|
rm -rf "$LVGLH_OBJ_DIR"
|
||||||
|
mkdir -p "$LVGLH_OBJ_DIR"
|
||||||
|
HCOUNT=0
|
||||||
|
HERRORS=0
|
||||||
|
for src in $LVGLH_SOURCES; do
|
||||||
|
HCOUNT=$((HCOUNT + 1))
|
||||||
|
rel="${src#${CONF_DIR}/}"
|
||||||
|
obj_path="${LVGLH_OBJ_DIR}/${rel%.c}.o"
|
||||||
|
mkdir -p "$(dirname "$obj_path")"
|
||||||
|
echo " [lvglh] $rel"
|
||||||
|
if ! $CC $CFLAGS -c "$src" -o "$obj_path" 2>&1; then
|
||||||
|
echo " FAILED: $rel"
|
||||||
|
HERRORS=$((HERRORS + 1))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "Compiled ${HCOUNT} custom files (${HERRORS} errors)."
|
||||||
|
if [ "$HERRORS" -ne 0 ]; then
|
||||||
|
echo "Custom LVGL compilation FAILED."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# Append custom objects into the existing archive
|
||||||
|
HOBJECTS=$(find "$LVGLH_OBJ_DIR" -name '*.o')
|
||||||
|
ar rcs "${OUT_DIR}/liblvgl.a" $HOBJECTS
|
||||||
|
echo "Updated ${OUT_DIR}/liblvgl.a with custom objects."
|
||||||
|
else
|
||||||
|
echo "No custom LVGL files in lvglh/."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy source + objects to /lvgl host mount for debugging
|
||||||
|
echo "Copying LVGL source and objects to host mount..."
|
||||||
|
rm -rf /lvgl/* /lvgl/.[!.]* /lvgl/..?* 2>/dev/null || true
|
||||||
|
cp -a "$LVGL_DIR/src" /lvgl/src
|
||||||
|
cp -a "$OBJ_DIR" /lvgl/obj
|
||||||
|
echo "Done."
|
||||||
|
|
||||||
|
echo " "
|
||||||
|
echo "LVGL compilation complete."
|
||||||
|
echo " "
|
||||||
+1
-1
@@ -4,4 +4,4 @@ echo "======================="
|
|||||||
echo " "
|
echo " "
|
||||||
echo "Compiling FPC Sources..."
|
echo "Compiling FPC Sources..."
|
||||||
echo " "
|
echo " "
|
||||||
fpc -Aelf -gw -g -gl -n -vlewn -O3 -OpPENTIUM3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ -Fusrc/* -Fusrc/driver/* -Fusrc/driver/net/* src/kernel.pas
|
fpc -Aelf -gw -g -gl -n -v0ew -O3 -OpPENTIUM3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ -Fusrc/* -Fusrc/driver/* -Fusrc/driver/net/* src/kernel.pas
|
||||||
@@ -3,3 +3,4 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
volumes:
|
volumes:
|
||||||
- .:/code
|
- .:/code
|
||||||
|
- ./lvgl:/lvgl
|
||||||
+374
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
+3
-2
@@ -1776,14 +1776,15 @@ var
|
|||||||
fb: puint32;
|
fb: puint32;
|
||||||
|
|
||||||
Begin
|
Begin
|
||||||
|
Ready:= False;
|
||||||
fb:= puint32(uint32(multibootinfo^.framebuffer_addr));
|
fb:= puint32(uint32(multibootinfo^.framebuffer_addr));
|
||||||
Console_Properties.Width:= multibootinfo^.framebuffer_width;
|
Console_Properties.Width:= multibootinfo^.framebuffer_width;
|
||||||
Console_Properties.Height:= multibootinfo^.framebuffer_height;
|
Console_Properties.Height:= multibootinfo^.framebuffer_height;
|
||||||
Console_Properties.BitsPerPixel:= multibootinfo^.framebuffer_bpp;
|
Console_Properties.BitsPerPixel:= multibootinfo^.framebuffer_bpp;
|
||||||
Console_Properties.MAX_CELL_X:= (Console_Properties.Width div 8) - 1;
|
Console_Properties.MAX_CELL_X:= (Console_Properties.Width div 8) - 1;
|
||||||
Console_Properties.MAX_CELL_Y:= (Console_Properties.Height div 16) - 1;
|
Console_Properties.MAX_CELL_Y:= (Console_Properties.Height div 16) - 1;
|
||||||
If Console_Properties.BitsPerPixel <> 16 then while true do begin
|
If Console_Properties.BitsPerPixel <> 16 then begin
|
||||||
|
exit;
|
||||||
end;
|
end;
|
||||||
kpalloc(uint32(fb));
|
kpalloc(uint32(fb));
|
||||||
keyboard.hook(@keyhook);
|
keyboard.hook(@keyhook);
|
||||||
|
|||||||
+30
@@ -291,6 +291,35 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure enableAVX();
|
||||||
|
begin
|
||||||
|
if CPUID.Capabilities1^.AVX and CPUID.Capabilities1^.XSAVE then begin
|
||||||
|
{ Enable OSXSAVE in CR4 (bit 18) - required before XGETBV/XSETBV }
|
||||||
|
asm
|
||||||
|
MOV EAX, CR4
|
||||||
|
OR EAX, (1 shl 18)
|
||||||
|
MOV CR4, EAX
|
||||||
|
end;
|
||||||
|
{ Set XCR0 bits: x87 (0) + SSE (1) + AVX (2) }
|
||||||
|
asm
|
||||||
|
PUSH EAX
|
||||||
|
PUSH ECX
|
||||||
|
PUSH EDX
|
||||||
|
XOR ECX, ECX
|
||||||
|
db $0F
|
||||||
|
db $01
|
||||||
|
db $D0
|
||||||
|
OR EAX, 7
|
||||||
|
db $0F
|
||||||
|
db $01
|
||||||
|
db $D1
|
||||||
|
POP EDX
|
||||||
|
POP ECX
|
||||||
|
POP EAX
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure init();
|
procedure init();
|
||||||
begin
|
begin
|
||||||
terminal.registerCommand('CPU', @Terminal_Command_CPU, 'CPU Info.');
|
terminal.registerCommand('CPU', @Terminal_Command_CPU, 'CPU Info.');
|
||||||
@@ -300,6 +329,7 @@ begin
|
|||||||
getCPUCapabilities;
|
getCPUCapabilities;
|
||||||
getCPUClockSpeed;
|
getCPUClockSpeed;
|
||||||
enableSSE;
|
enableSSE;
|
||||||
|
enableAVX;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
+94
-13
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,99 @@
|
|||||||
|
// Copyright 2021 Kieron Morris
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
{
|
||||||
|
Driver->Video->Doublebuffer - Implements a very basic double buffer, tested with VESA drivers.
|
||||||
|
|
||||||
|
@author(Kieron Morris <[email protected]>)
|
||||||
|
}
|
||||||
|
unit doublebuffer;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
lmemorymanager, tracer, videotypes, serial, util;
|
||||||
|
|
||||||
|
//Init the driver, and register with the video interface in a state ready for execution.
|
||||||
|
procedure init(Register : FRegisterDriver);
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
function allocateBackBuffer(Width : uint32; Height : uint32; BitsPerPixel : uint8) : uint64;
|
||||||
|
begin
|
||||||
|
tracer.push_trace('doublebuffer.allocateBackBuffer.enter');
|
||||||
|
allocateBackBuffer:= uint64(klalloc((Width * Height * BitsPerPixel) div 8));
|
||||||
|
tracer.push_trace('doublebuffer.allocateBackBuffer.exit');
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure initBackBuffer(VInterface : PVideoInterface; Width : uint32; Height : uint32; BitsPerPixel : uint8);
|
||||||
|
begin
|
||||||
|
tracer.push_trace('doublebuffer.initBackBuffer.enter');
|
||||||
|
if not(VInterface^.BackBuffer.Initialized) then begin
|
||||||
|
VInterface^.BackBuffer.Location:= allocateBackBuffer(Width, Height, BitsPerPixel);
|
||||||
|
if (VInterface^.BackBuffer.Location <> 0) then begin
|
||||||
|
VInterface^.BackBuffer.Width:= Width;
|
||||||
|
VInterface^.BackBuffer.Height:= Height;
|
||||||
|
VInterface^.BackBuffer.BitsPerPixel:= BitsPerPixel;
|
||||||
|
VInterface^.BackBuffer.Initialized:= True;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
tracer.push_trace('doublebuffer.initBackBuffer.exit');
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure Flush(FrontBuffer : PVideoBuffer; BackBuffer : PVideoBuffer);
|
||||||
|
var
|
||||||
|
idx : uint32;
|
||||||
|
Back,Front : uint32;
|
||||||
|
BufferSize : uint32;
|
||||||
|
|
||||||
|
const
|
||||||
|
//COPY_WIDTH = 64; //Use this for 64bit copies
|
||||||
|
COPY_WIDTH = 128; //Use this for SSE copies
|
||||||
|
|
||||||
|
begin
|
||||||
|
//tracer.push_trace('doublebuffer.Flush.enter');
|
||||||
|
if not(BackBuffer^.Initialized) then exit;
|
||||||
|
if ((FrontBuffer^.Width > BackBuffer^.Width) or (FrontBuffer^.Height > BackBuffer^.Height)) then exit;
|
||||||
|
Back:= BackBuffer^.Location;
|
||||||
|
Front:= FrontBuffer^.Location;
|
||||||
|
BufferSize:= ( ( BackBuffer^.Width * BackBuffer^.Height * BackBuffer^.BitsPerPixel) div COPY_WIDTH ) - 1;
|
||||||
|
for idx:=0 to BufferSize do begin
|
||||||
|
//Front[idx]:= Back[idx];
|
||||||
|
// -- TODO: Get SSE working here for 128bit copies --
|
||||||
|
__SSE_128_memcpy(Back + (idx * 16), Front + (idx * 16));
|
||||||
|
end;
|
||||||
|
//tracer.push_trace('doublebuffer.Flush.exit');
|
||||||
|
end;
|
||||||
|
|
||||||
|
function enable(VideoInterface : PVideoInterface) : boolean;
|
||||||
|
begin
|
||||||
|
tracer.push_trace('doublebuffer.enable.enter');
|
||||||
|
enable:= false;
|
||||||
|
initBackBuffer(VideoInterface, VideoInterface^.FrontBuffer.Width, VideoInterface^.FrontBuffer.Height, VideoInterface^.FrontBuffer.BitsPerPixel);
|
||||||
|
if VideoInterface^.BackBuffer.Initialized then begin
|
||||||
|
VideoInterface^.DefaultBuffer:= @VideoInterface^.BackBuffer;
|
||||||
|
VideoInterface^.DrawRoutines.Flush:= @Flush;
|
||||||
|
enable:= true;
|
||||||
|
end;
|
||||||
|
tracer.push_trace('doublebuffer.enable.exit');
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure init(Register : FRegisterDriver);
|
||||||
|
begin
|
||||||
|
tracer.push_trace('doublebuffer.init.enter');
|
||||||
|
Register('BASIC_DOUBLE_BUFFER', @enable);
|
||||||
|
tracer.push_trace('doublebuffer.init.exit');
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,89 @@
|
|||||||
|
// Copyright 2021 Kieron Morris
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
{
|
||||||
|
Driver->Video->VESA - VESA Display Driver.
|
||||||
|
|
||||||
|
@author(Kieron Morris <kjm@kieronmorris.me>)
|
||||||
|
}
|
||||||
|
unit vesa;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
videotypes, tracer, multiboot, lmemorymanager;
|
||||||
|
|
||||||
|
//Init the driver, and register with the video interface in a state ready for execution.
|
||||||
|
procedure init(Register : FRegisterDriver);
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
VESA8, VESA16, VESA24, VESA32;
|
||||||
|
|
||||||
|
procedure allocateVESAFrameBuffer(Address : uint32; Width : uint32; Height : uint32; BitsPerPixel : uint8);
|
||||||
|
var
|
||||||
|
LowerAddress, UpperAddress : uint32;
|
||||||
|
Block : uint32;
|
||||||
|
FrameBufferSize : uint32;
|
||||||
|
|
||||||
|
begin
|
||||||
|
tracer.push_trace('VESA.allocateFrameBuffer.enter');
|
||||||
|
FrameBufferSize := (Width * Height * BitsPerPixel) div 8;
|
||||||
|
LowerAddress:= ((Address) SHR 22)-1;
|
||||||
|
UpperAddress:= ((Address + FrameBufferSize) SHR 22)+1;
|
||||||
|
For Block:=LowerAddress to UpperAddress do begin
|
||||||
|
kpalloc(Block SHL 22);
|
||||||
|
end;
|
||||||
|
tracer.push_trace('VESA.allocateFrameBuffer.exit');
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure initVESAFrameBuffer(VideoBuffer : PVideoBuffer; Location : uint64; Width : uint32; Height : uint32; BitsPerPixel : uint8; Pitch : uint32);
|
||||||
|
begin
|
||||||
|
tracer.push_trace('VESA.initVESAFrameBuffer.enter');
|
||||||
|
if not(VideoBuffer^.Initialized) then begin
|
||||||
|
VideoBuffer^.Location:= Location;
|
||||||
|
VideoBuffer^.BitsPerPixel:= BitsPerPixel;
|
||||||
|
VideoBuffer^.Width:= Width;
|
||||||
|
VideoBuffer^.Height:= Height;
|
||||||
|
allocateVESAFrameBuffer(VideoBuffer^.Location, VideoBuffer^.Width, VideoBuffer^.Height, BitsPerPixel);
|
||||||
|
if VideoBuffer^.Location <> 0 then
|
||||||
|
VideoBuffer^.Initialized:= True;
|
||||||
|
end;
|
||||||
|
tracer.push_trace('VESA.initVESAFrameBuffer.exit');
|
||||||
|
end;
|
||||||
|
|
||||||
|
function enable(VideoInterface : PVideoInterface) : boolean;
|
||||||
|
begin
|
||||||
|
tracer.push_trace('VESA.enable.enter');
|
||||||
|
initVESAFrameBuffer(@VideoInterface^.FrontBuffer, multiboot.multibootinfo^.framebuffer_addr, multiboot.multibootinfo^.framebuffer_width, multiboot.multibootinfo^.framebuffer_height, multiboot.multibootinfo^.framebuffer_bpp, multiboot.multibootinfo^.framebuffer_pitch);
|
||||||
|
case (VideoInterface^.FrontBuffer.BitsPerPixel) of
|
||||||
|
08:VESA8.init(@VideoInterface^.DrawRoutines);
|
||||||
|
16:VESA16.init(@VideoInterface^.DrawRoutines);
|
||||||
|
24:VESA24.init(@VideoInterface^.DrawRoutines);
|
||||||
|
32:VESA32.init(@VideoInterface^.DrawRoutines);
|
||||||
|
end;
|
||||||
|
enable:= VideoInterface^.FrontBuffer.Initialized;
|
||||||
|
tracer.push_trace('VESA.enable.exit');
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure init(Register : FRegisterDriver);
|
||||||
|
begin
|
||||||
|
tracer.push_trace('VESA.init.enter');
|
||||||
|
if Register <> nil then
|
||||||
|
Register('VESA', @enable);
|
||||||
|
tracer.push_trace('VESA.init.exit');
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
// Copyright 2021 Kieron Morris
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
{
|
||||||
|
Driver->Video->VESA16 - Implementation of VESA 16bpp draw routines for the VESA Driver.
|
||||||
|
|
||||||
|
@author(Kieron Morris <kjm@kieronmorris.me>)
|
||||||
|
}
|
||||||
|
unit vesa16;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
videotypes, vesa, tracer, color;
|
||||||
|
|
||||||
|
//Init the draw routines by providing what we support through the DrawRoutines struct.
|
||||||
|
procedure init(DrawRoutines : PDrawRoutines);
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
procedure DrawPixel(Buffer : PVideoBuffer; X : uint32; Y : uint32; Pixel : TRGB32);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure init(DrawRoutines : PDrawRoutines);
|
||||||
|
begin
|
||||||
|
tracer.push_trace('vesa16.init.enter');
|
||||||
|
tracer.push_trace('vesa16.init.exit');
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
// Copyright 2021 Kieron Morris
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
{
|
||||||
|
Driver->Video->VESA24 - Implementation of VESA 24bpp draw routines for the VESA Driver.
|
||||||
|
|
||||||
|
@author(Kieron Morris <kjm@kieronmorris.me>)
|
||||||
|
}
|
||||||
|
unit vesa24;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
videotypes, vesa, tracer, color;
|
||||||
|
|
||||||
|
//Init the draw routines by providing what we support through the DrawRoutines struct.
|
||||||
|
procedure init(DrawRoutines : PDrawRoutines);
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
procedure DrawPixel(Buffer : PVideoBuffer; X : uint32; Y : uint32; Pixel : TRGB32);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure init(DrawRoutines : PDrawRoutines);
|
||||||
|
begin
|
||||||
|
tracer.push_trace('vesa24.init.enter');
|
||||||
|
tracer.push_trace('vesa24.init.exit');
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
// Copyright 2021 Kieron Morris
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
{
|
||||||
|
Driver->Video->VESA32 - Implementation of VESA 32bpp draw routines for the VESA Driver.
|
||||||
|
|
||||||
|
@author(Kieron Morris <kjm@kieronmorris.me>)
|
||||||
|
}
|
||||||
|
unit vesa32;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
videotypes, vesa, tracer, color;
|
||||||
|
|
||||||
|
//Init the draw routines by providing what we support through the DrawRoutines struct.
|
||||||
|
procedure init(DrawRoutines : PDrawRoutines);
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
procedure DrawPixel(Buffer : PVideoBuffer; X : uint32; Y : uint32; Pixel : TRGB32);
|
||||||
|
var
|
||||||
|
Location : PuInt32;
|
||||||
|
LocationIndex : Uint32;
|
||||||
|
|
||||||
|
begin
|
||||||
|
//tracer.push_trace('vesa32.DrawPixel.enter');
|
||||||
|
Location:= Puint32(Buffer^.Location);
|
||||||
|
LocationIndex:= (Y * Buffer^.Width) + X;
|
||||||
|
Location[LocationIndex]:= uint32(Pixel);
|
||||||
|
//tracer.push_trace('vesa32.DrawPixel.exit');
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure init(DrawRoutines : PDrawRoutines);
|
||||||
|
begin
|
||||||
|
tracer.push_trace('vesa32.init.enter');
|
||||||
|
DrawRoutines^.DrawPixel:= @DrawPixel;
|
||||||
|
tracer.push_trace('vesa32.init.exit');
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
Loaded 20 of 33 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user