Merge pull request 'GPU Stack, V8086 Monitor & BGA Driver' (#50) from feature/gpu-stack-v8086-bga into develop
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
Reviewed-on: #50 Reviewed-by: Aaron Hance <[email protected]>
This commit was merged in pull request #50.
This commit is contained in:
+1
-1
@@ -10,4 +10,4 @@ for dir in $(find src wasuro -type d 2>/dev/null); do
|
|||||||
FU_PATHS="$FU_PATHS -Fu$dir"
|
FU_PATHS="$FU_PATHS -Fu$dir"
|
||||||
done
|
done
|
||||||
|
|
||||||
fpc -Aelf -gw -g -gl -n -v0ew -O3 -OpPENTIUM3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ $FU_PATHS src/kernel.pas
|
fpc -Aelf -gw -g -gl -n -v0e -O3 -OpPENTIUM3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ $FU_PATHS src/kernel.pas
|
||||||
+2
-1
@@ -4,4 +4,5 @@ echo "======================="
|
|||||||
echo " "
|
echo " "
|
||||||
echo "Compiling Stub..."
|
echo "Compiling Stub..."
|
||||||
echo " "
|
echo " "
|
||||||
nasm -f elf src/stub/stub.asm -o lib/stub.o
|
nasm -f elf src/stub/stub.asm -o lib/stub.o
|
||||||
|
nasm -f elf src/stub/splash_tga.asm -o lib/splash_tga.o
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.0 MiB |
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@ unit desktop;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
lvgl, video, RTC, strings, util, tracer, multiboot, cpu, serial, windows, asuro;
|
lvgl, video, gpu, RTC, strings, util, tracer, multiboot, cpu, serial, windows, asuro;
|
||||||
|
|
||||||
type
|
type
|
||||||
TProgLaunchProc = procedure;
|
TProgLaunchProc = procedure;
|
||||||
@@ -25,6 +25,7 @@ procedure registerProgram(name: pchar; launcher: TProgLaunchProc);
|
|||||||
|
|
||||||
procedure init;
|
procedure init;
|
||||||
procedure update;
|
procedure update;
|
||||||
|
procedure relayout;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@@ -36,7 +37,7 @@ const
|
|||||||
DOCK_ITEM_H = 36;
|
DOCK_ITEM_H = 36;
|
||||||
|
|
||||||
SEARCH_W = 220;
|
SEARCH_W = 220;
|
||||||
SEARCH_RADIUS = 18;
|
SEARCH_RADIUS = 16;
|
||||||
|
|
||||||
RESULTS_W = SEARCH_W;
|
RESULTS_W = SEARCH_W;
|
||||||
RESULTS_ROW_H = 36;
|
RESULTS_ROW_H = 36;
|
||||||
@@ -299,12 +300,12 @@ begin
|
|||||||
addInfoRow(content, cw, 'CPU Clock', clk_str);
|
addInfoRow(content, cw, 'CPU Clock', clk_str);
|
||||||
mem_str := stringConcat(intToString(((multibootinfo^.mem_upper + 1000) div 1024) + 1), ' MB');
|
mem_str := stringConcat(intToString(((multibootinfo^.mem_upper + 1000) div 1024) + 1), ' MB');
|
||||||
addInfoRow(content, cw, 'Memory', mem_str);
|
addInfoRow(content, cw, 'Memory', mem_str);
|
||||||
res_str := stringConcat(intToString(multibootinfo^.framebuffer_width), 'x');
|
res_str := stringConcat(intToString(video.frontBufferWidth), 'x');
|
||||||
res_str := stringConcat(res_str, intToString(multibootinfo^.framebuffer_height));
|
res_str := stringConcat(res_str, intToString(video.frontBufferHeight));
|
||||||
res_str := stringConcat(res_str, 'x');
|
res_str := stringConcat(res_str, 'x');
|
||||||
res_str := stringConcat(res_str, intToString(multibootinfo^.framebuffer_bpp));
|
res_str := stringConcat(res_str, intToString(video.frontBufferBpp));
|
||||||
addInfoRow(content, cw, 'Resolution', res_str);
|
addInfoRow(content, cw, 'Resolution', res_str);
|
||||||
addInfoRow(content, cw, 'Graphics', 'VESA VBE');
|
addInfoRow(content, cw, 'Graphics', gpu.activeDriverName);
|
||||||
|
|
||||||
addSeparator(content, cw);
|
addSeparator(content, cw);
|
||||||
|
|
||||||
@@ -677,6 +678,14 @@ begin
|
|||||||
lv_obj_set_pos(results_panel, lv_obj_get_x(results_panel), anim_current_y);
|
lv_obj_set_pos(results_panel, lv_obj_get_x(results_panel), anim_current_y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ ============================================================
|
||||||
|
Mode-change callback — fired by GPU framework after setMode
|
||||||
|
============================================================ }
|
||||||
|
procedure desktopModeChanged(const info : TGPUModeInfo);
|
||||||
|
begin
|
||||||
|
relayout;
|
||||||
|
end;
|
||||||
|
|
||||||
{ ============================================================
|
{ ============================================================
|
||||||
Init — create the desktop UI
|
Init — create the desktop UI
|
||||||
============================================================ }
|
============================================================ }
|
||||||
@@ -819,6 +828,43 @@ begin
|
|||||||
{ ---- Register built-in programs ---- }
|
{ ---- Register built-in programs ---- }
|
||||||
registerProgram('System Information', @openSysInfo);
|
registerProgram('System Information', @openSysInfo);
|
||||||
|
|
||||||
|
{ Register for resolution-change notifications from GPU framework }
|
||||||
|
gpu.registerModeChangeCallback(@desktopModeChanged);
|
||||||
|
|
||||||
|
tracer.pop_trace;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ ============================================================
|
||||||
|
Relayout — reposition all desktop UI after resolution change
|
||||||
|
============================================================ }
|
||||||
|
procedure relayout;
|
||||||
|
var
|
||||||
|
scr_w, scr_h : sint32;
|
||||||
|
dock_w : sint32;
|
||||||
|
dock_x : sint32;
|
||||||
|
dock_y : sint32;
|
||||||
|
begin
|
||||||
|
tracer.push_trace('desktop.relayout');
|
||||||
|
|
||||||
|
scr_w := sint32(video.frontBufferWidth);
|
||||||
|
scr_h := sint32(video.frontBufferHeight);
|
||||||
|
|
||||||
|
{ Close any open search/results first }
|
||||||
|
clearAndClose;
|
||||||
|
|
||||||
|
{ Reposition dock }
|
||||||
|
dock_w := scr_w - (DOCK_HPAD * 2);
|
||||||
|
dock_x := DOCK_HPAD;
|
||||||
|
dock_y := scr_h - DOCK_HEIGHT - DOCK_MARGIN;
|
||||||
|
lv_obj_set_size(dock, dock_w, DOCK_HEIGHT);
|
||||||
|
lv_obj_set_pos(dock, dock_x, dock_y);
|
||||||
|
|
||||||
|
{ Watermark stays centered (LV_ALIGN_CENTER is relative to parent) }
|
||||||
|
lv_obj_align(desktop_label, LV_ALIGN_CENTER, 0, -30);
|
||||||
|
|
||||||
|
{ Force layout recalculation }
|
||||||
|
lv_obj_update_layout(lv_screen_active);
|
||||||
|
|
||||||
tracer.pop_trace;
|
tracer.pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
video, videotypes, color, serial, tracer, lmemorymanager,
|
video, videotypes, color, serial, tracer, lmemorymanager,
|
||||||
mouse, keyboard, TMR_0_ISR, util;
|
mouse, keyboard, TMR_0_ISR, util, syslog, gpu;
|
||||||
|
|
||||||
{ ============================================================
|
{ ============================================================
|
||||||
Opaque LVGL pointer types (internal C structs)
|
Opaque LVGL pointer types (internal C structs)
|
||||||
@@ -1670,6 +1670,7 @@ function lvgl_get_display: Plv_display;
|
|||||||
procedure lvgl_set_mouse_cursor(cursor: Plv_obj);
|
procedure lvgl_set_mouse_cursor(cursor: Plv_obj);
|
||||||
function lvgl_get_ticks: uint32;
|
function lvgl_get_ticks: uint32;
|
||||||
function lvgl_get_kb_group: Plv_group;
|
function lvgl_get_kb_group: Plv_group;
|
||||||
|
procedure lvgl_update_resolution(screen_w, screen_h: uint32);
|
||||||
|
|
||||||
{ Color helper (Pascal wrapper for inline C function) }
|
{ Color helper (Pascal wrapper for inline C function) }
|
||||||
function lv_color_make(r, g, b: uint8): lv_color_t;
|
function lv_color_make(r, g, b: uint8): lv_color_t;
|
||||||
@@ -1909,6 +1910,14 @@ begin
|
|||||||
tick_accumulator := tick_accumulator + 1;
|
tick_accumulator := tick_accumulator + 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ ============================================================
|
||||||
|
GPU mode-change callback — updates LVGL display resolution
|
||||||
|
============================================================ }
|
||||||
|
procedure lvglModeChanged(const info : TGPUModeInfo);
|
||||||
|
begin
|
||||||
|
lvgl_update_resolution(info.Width, info.Height);
|
||||||
|
end;
|
||||||
|
|
||||||
{ ============================================================
|
{ ============================================================
|
||||||
High-level init
|
High-level init
|
||||||
============================================================ }
|
============================================================ }
|
||||||
@@ -1962,9 +1971,45 @@ begin
|
|||||||
{ Hook 1024Hz timer for accurate LVGL tick }
|
{ Hook 1024Hz timer for accurate LVGL tick }
|
||||||
TMR_0_ISR.hook(uint32(@lvgl_timer_tick));
|
TMR_0_ISR.hook(uint32(@lvgl_timer_tick));
|
||||||
|
|
||||||
|
{ Register for GPU mode-change notifications so LVGL resolution updates automatically }
|
||||||
|
gpu.registerModeChangeCallback(@lvglModeChanged);
|
||||||
|
|
||||||
tracer.push_trace('lvgl.init.exit');
|
tracer.push_trace('lvgl.init.exit');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure lvgl_update_resolution(screen_w, screen_h: uint32);
|
||||||
|
var
|
||||||
|
new_buf : pointer;
|
||||||
|
new_size : uint32;
|
||||||
|
|
||||||
|
begin
|
||||||
|
tracer.push_trace('lvgl.update_resolution.enter');
|
||||||
|
|
||||||
|
{ Allocate new render buffer for the new width }
|
||||||
|
new_size := screen_w * LV_BUF_LINES * SizeOf(lv_color_t);
|
||||||
|
new_buf := pointer(kalloc(new_size));
|
||||||
|
|
||||||
|
if new_buf <> nil then begin
|
||||||
|
{ Free old render buffer }
|
||||||
|
if lv_buf1 <> nil then
|
||||||
|
kfree(lv_buf1);
|
||||||
|
|
||||||
|
lv_buf1 := new_buf;
|
||||||
|
lv_buf1_size := new_size;
|
||||||
|
|
||||||
|
{ Update LVGL display resolution and buffers }
|
||||||
|
lv_display_set_resolution(disp, sint32(screen_w), sint32(screen_h));
|
||||||
|
lv_display_set_buffers(disp, lv_buf1, nil,
|
||||||
|
lv_buf1_size, LV_DISPLAY_RENDER_MODE_PARTIAL);
|
||||||
|
|
||||||
|
syslog.logln('LVGL', 'Resolution updated successfully.');
|
||||||
|
end else begin
|
||||||
|
syslog.logln('LVGL', 'Failed to allocate new render buffer.');
|
||||||
|
end;
|
||||||
|
|
||||||
|
tracer.push_trace('lvgl.update_resolution.exit');
|
||||||
|
end;
|
||||||
|
|
||||||
function lvgl_handler: uint32;
|
function lvgl_handler: uint32;
|
||||||
var
|
var
|
||||||
elapsed: uint32;
|
elapsed: uint32;
|
||||||
|
|||||||
+162
-2
File diff suppressed because it is too large
Load Diff
@@ -22,7 +22,7 @@ unit video;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
lmemorymanager, tracer, color, videotypes, hashmap, util, texture;
|
lmemorymanager, tracer, color, videotypes, hashmap, util, texture, gpu;
|
||||||
|
|
||||||
procedure init();
|
procedure init();
|
||||||
procedure DrawPixel(X : uint32; Y : uint32; Pixel : TRGB32);
|
procedure DrawPixel(X : uint32; Y : uint32; Pixel : TRGB32);
|
||||||
@@ -30,6 +30,7 @@ procedure DrawLine(x1,y1,x2,y2 : uint32; thickness : uint32; Color : TRGB32);
|
|||||||
procedure DrawRect(x1,y1,x2,y2 : uint32; line_thickness : uint32; Color : TRGB32);
|
procedure DrawRect(x1,y1,x2,y2 : uint32; line_thickness : uint32; Color : TRGB32);
|
||||||
procedure FillRect(x1,y1,x2,y2 : uint32; line_thickness : uint32; Line_Color : TRGB32; Fill_Color : TRGB32);
|
procedure FillRect(x1,y1,x2,y2 : uint32; line_thickness : uint32; Line_Color : TRGB32; Fill_Color : TRGB32);
|
||||||
procedure Flush();
|
procedure Flush();
|
||||||
|
procedure reinit(fb_addr, width, height, pitch : uint32; bpp : uint8);
|
||||||
|
|
||||||
function register(DriverIdentifier : pchar; EnableCallback : FEnableDriver) : boolean;
|
function register(DriverIdentifier : pchar; EnableCallback : FEnableDriver) : boolean;
|
||||||
function enable(DriverIdentifier : pchar) : boolean;
|
function enable(DriverIdentifier : pchar) : boolean;
|
||||||
@@ -47,6 +48,9 @@ Procedure basicFDrawTexture(Buffer : PVideoBuffer; X : uint32; Y : uint32; Textu
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
VESA8, VESA16, VESA24, VESA32;
|
||||||
|
|
||||||
Procedure dummyFDrawPixel(Buffer : PVideoBuffer; X : uint32; Y : uint32; Pixel : TRGB32);
|
Procedure dummyFDrawPixel(Buffer : PVideoBuffer; X : uint32; Y : uint32; Pixel : TRGB32);
|
||||||
begin
|
begin
|
||||||
tracer.push_trace('video.dummyFDrawPixel.enter');
|
tracer.push_trace('video.dummyFDrawPixel.enter');
|
||||||
@@ -191,6 +195,14 @@ var
|
|||||||
VideoInterface : TVideoInterface;
|
VideoInterface : TVideoInterface;
|
||||||
DriverMap : PHashMap;
|
DriverMap : PHashMap;
|
||||||
|
|
||||||
|
{ ============================================================
|
||||||
|
GPU mode-change callback — reinits front/back buffers
|
||||||
|
============================================================ }
|
||||||
|
procedure videoModeChanged(const info : TGPUModeInfo);
|
||||||
|
begin
|
||||||
|
reinit(info.Framebuffer, info.Width, info.Height, info.Pitch, info.BPP);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure init();
|
procedure init();
|
||||||
var
|
var
|
||||||
RGB : TRGB32;
|
RGB : TRGB32;
|
||||||
@@ -226,6 +238,9 @@ begin
|
|||||||
//Initialize our 'DriverMap', a hashmap of loadable display drivers.
|
//Initialize our 'DriverMap', a hashmap of loadable display drivers.
|
||||||
DriverMap:= hashmap.new;
|
DriverMap:= hashmap.new;
|
||||||
|
|
||||||
|
{ Register for GPU mode-change notifications so reinit fires automatically }
|
||||||
|
gpu.registerModeChangeCallback(@videoModeChanged);
|
||||||
|
|
||||||
tracer.push_trace('video.init.exit');
|
tracer.push_trace('video.init.exit');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -327,4 +342,47 @@ begin
|
|||||||
frontBufferLocation:= VideoInterface.FrontBuffer.Location;
|
frontBufferLocation:= VideoInterface.FrontBuffer.Location;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure reinit(fb_addr, width, height, pitch : uint32; bpp : uint8);
|
||||||
|
begin
|
||||||
|
tracer.push_trace('video.reinit.enter');
|
||||||
|
{ Free old back buffer if allocated }
|
||||||
|
if VideoInterface.BackBuffer.Initialized then begin
|
||||||
|
kfree(void(VideoInterface.BackBuffer.Location));
|
||||||
|
VideoInterface.BackBuffer.Initialized := false;
|
||||||
|
VideoInterface.BackBuffer.Location := 0;
|
||||||
|
VideoInterface.BackBuffer.Width := 0;
|
||||||
|
VideoInterface.BackBuffer.Height := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ Reset front buffer so it can be re-initialized }
|
||||||
|
VideoInterface.FrontBuffer.Initialized := false;
|
||||||
|
VideoInterface.FrontBuffer.Location := 0;
|
||||||
|
VideoInterface.FrontBuffer.Width := 0;
|
||||||
|
VideoInterface.FrontBuffer.Height := 0;
|
||||||
|
|
||||||
|
{ Point default buffer back to front (in case doublebuffer re-enable fails) }
|
||||||
|
VideoInterface.DefaultBuffer := @VideoInterface.FrontBuffer;
|
||||||
|
|
||||||
|
{ Set front buffer directly from GPU mode info }
|
||||||
|
VideoInterface.FrontBuffer.Location := fb_addr;
|
||||||
|
VideoInterface.FrontBuffer.Width := width;
|
||||||
|
VideoInterface.FrontBuffer.Height := height;
|
||||||
|
VideoInterface.FrontBuffer.BitsPerPixel := bpp;
|
||||||
|
if fb_addr <> 0 then
|
||||||
|
VideoInterface.FrontBuffer.Initialized := true;
|
||||||
|
|
||||||
|
{ Set up BPP-specific draw routines }
|
||||||
|
case bpp of
|
||||||
|
08: VESA8.init(@VideoInterface.DrawRoutines);
|
||||||
|
16: VESA16.init(@VideoInterface.DrawRoutines);
|
||||||
|
24: VESA24.init(@VideoInterface.DrawRoutines);
|
||||||
|
32: VESA32.init(@VideoInterface.DrawRoutines);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ Re-enable double buffer (allocates new back buffer matching front) }
|
||||||
|
enable('BASIC_DOUBLE_BUFFER');
|
||||||
|
|
||||||
|
tracer.push_trace('video.reinit.exit');
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
+31
-21
@@ -12,7 +12,7 @@ type
|
|||||||
PTARGAColor = ^TTARGAColor;
|
PTARGAColor = ^TTARGAColor;
|
||||||
|
|
||||||
TTARGAHeader = packed record
|
TTARGAHeader = packed record
|
||||||
Magic: uint8;
|
IDLength: uint8;
|
||||||
ColorMapType: uint8;
|
ColorMapType: uint8;
|
||||||
ImageType: uint8;
|
ImageType: uint8;
|
||||||
ColorMapOrigin: uint16;
|
ColorMapOrigin: uint16;
|
||||||
@@ -24,7 +24,6 @@ type
|
|||||||
Height: uint16;
|
Height: uint16;
|
||||||
PixelDepth: uint8;
|
PixelDepth: uint8;
|
||||||
ImageDescriptor: uint8;
|
ImageDescriptor: uint8;
|
||||||
Data : PTARGAColor;
|
|
||||||
end;
|
end;
|
||||||
PTARGAHeader = ^TTARGAHeader;
|
PTARGAHeader = ^TTARGAHeader;
|
||||||
|
|
||||||
@@ -35,29 +34,40 @@ implementation
|
|||||||
Function Parse(buffer : puint8; len : uint32) : PTexture;
|
Function Parse(buffer : puint8; len : uint32) : PTexture;
|
||||||
var
|
var
|
||||||
header : PTARGAHeader;
|
header : PTARGAHeader;
|
||||||
i, j : uint32;
|
src : PTARGAColor;
|
||||||
data : PTARGAColor;
|
tex : PTexture;
|
||||||
tex : PTexture;
|
x, y : uint32;
|
||||||
|
dstRow : uint32;
|
||||||
|
topDown: boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if (len < sizeof(TTARGAHeader)) then exit;
|
Parse := nil;
|
||||||
|
if len < sizeof(TTARGAHeader) then exit;
|
||||||
|
|
||||||
header := PTARGAHeader(buffer);
|
header := PTARGAHeader(buffer);
|
||||||
if (header^.Magic <> $0) or (header^.ImageType <> 2) or (header^.PixelDepth <> 32) then exit;
|
if (header^.ImageType <> 2) or (header^.PixelDepth <> 32) then exit;
|
||||||
|
|
||||||
//Create a new texture
|
{ Pixel data starts after the 18-byte header + any ID field. }
|
||||||
tex:= texture.newTexture(header^.Width, header^.Height);
|
src := PTARGAColor(buffer + sizeof(TTARGAHeader) + header^.IDLength);
|
||||||
tex^.Width:= header^.Width;
|
|
||||||
tex^.Height:= header^.Height;
|
{ Bit 5 of ImageDescriptor: 1 = top-to-bottom, 0 = bottom-to-top. }
|
||||||
|
topDown := (header^.ImageDescriptor AND $20) <> 0;
|
||||||
//Copy the data
|
|
||||||
data := PTARGAColor(header^.Data);
|
tex := texture.newTexture(header^.Width, header^.Height);
|
||||||
for i := 0 to header^.Height - 1 do begin
|
|
||||||
for j := 0 to header^.Width - 1 do begin
|
for y := 0 to header^.Height - 1 do begin
|
||||||
tex^.Pixels[i * header^.Width + j].r := data^.r;
|
{ Flip vertically when origin is bottom-left (the TGA default). }
|
||||||
tex^.Pixels[i * header^.Width + j].g := data^.g;
|
if topDown then
|
||||||
tex^.Pixels[i * header^.Width + j].b := data^.b;
|
dstRow := y
|
||||||
tex^.Pixels[i * header^.Width + j].a := data^.a;
|
else
|
||||||
|
dstRow := (header^.Height - 1) - y;
|
||||||
|
|
||||||
|
for x := 0 to header^.Width - 1 do begin
|
||||||
|
tex^.Pixels[dstRow * header^.Width + x].b := src^.b;
|
||||||
|
tex^.Pixels[dstRow * header^.Width + x].g := src^.g;
|
||||||
|
tex^.Pixels[dstRow * header^.Width + x].r := src^.r;
|
||||||
|
tex^.Pixels[dstRow * header^.Width + x].a := src^.a;
|
||||||
|
Inc(src);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
+65
-44
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,83 @@
|
|||||||
|
{
|
||||||
|
Prog->setres - Set display resolution via GPU driver framework.
|
||||||
|
|
||||||
|
Usage: SETRES <width> <height>
|
||||||
|
Example: SETRES 1024 768
|
||||||
|
|
||||||
|
Uses the GPU driver framework to switch display modes. Tries BGA first,
|
||||||
|
then falls back to VBE/VESA.
|
||||||
|
|
||||||
|
@author(Kieron Morris <[email protected]>)
|
||||||
|
}
|
||||||
|
unit setres;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
stdio, gpu, util, strings, tracer, syslog;
|
||||||
|
|
||||||
|
procedure init();
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
procedure run(Params : PParamList; stdin_buf, stdout_buf, stderr_buf : POutBuf);
|
||||||
|
var
|
||||||
|
w, h : uint32;
|
||||||
|
wStr, hStr : pchar;
|
||||||
|
info : TGPUModeInfo;
|
||||||
|
|
||||||
|
begin
|
||||||
|
tracer.push_trace('setres.run');
|
||||||
|
|
||||||
|
if paramCount(params) < 2 then begin
|
||||||
|
stdio.bufWriteStrLn(stderr_buf, 'Usage: SETRES <width> <height>');
|
||||||
|
stdio.bufWriteStrLn(stderr_buf, 'Example: SETRES 1024 768');
|
||||||
|
tracer.pop_trace;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
wStr := getParam(0, params);
|
||||||
|
hStr := getParam(1, params);
|
||||||
|
|
||||||
|
w := stringToInt(wStr);
|
||||||
|
h := stringToInt(hStr);
|
||||||
|
|
||||||
|
if (w = 0) or (h = 0) then begin
|
||||||
|
stdio.bufWriteStrLn(stderr_buf, 'Error: Invalid resolution values.');
|
||||||
|
tracer.pop_trace;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
stdio.bufWriteStr(stdout_buf, 'Setting resolution to ');
|
||||||
|
stdio.bufWriteInt(stdout_buf, w);
|
||||||
|
stdio.bufWriteStr(stdout_buf, 'x');
|
||||||
|
stdio.bufWriteInt(stdout_buf, h);
|
||||||
|
stdio.bufWriteStrLn(stdout_buf, 'x32...');
|
||||||
|
|
||||||
|
{ Step 1: Set display mode via GPU framework (tries BGA first, then VBE) }
|
||||||
|
if not gpu.setMode(w, h, 32, info) then begin
|
||||||
|
stdio.bufWriteStrLn(stderr_buf, 'Error: Mode switch failed. Mode may not be supported.');
|
||||||
|
tracer.pop_trace;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
stdio.bufWriteStr(stdout_buf, 'Mode set via ');
|
||||||
|
stdio.bufWriteStrLn(stdout_buf, gpu.activeDriverName());
|
||||||
|
|
||||||
|
stdio.bufWriteStr(stdout_buf, 'Resolution set to ');
|
||||||
|
stdio.bufWriteInt(stdout_buf, w);
|
||||||
|
stdio.bufWriteStr(stdout_buf, 'x');
|
||||||
|
stdio.bufWriteInt(stdout_buf, h);
|
||||||
|
stdio.bufWriteStrLn(stdout_buf, 'x32 successfully.');
|
||||||
|
|
||||||
|
tracer.pop_trace;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure init();
|
||||||
|
begin
|
||||||
|
tracer.push_trace('setres.init');
|
||||||
|
stdio.registerCommand('SETRES', @Run, 'Set display resolution. Usage: SETRES <width> <height>');
|
||||||
|
tracer.pop_trace;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
File diff suppressed because it is too large
Load Diff
+8
-3
@@ -25,7 +25,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
tracer,
|
tracer,
|
||||||
//progs
|
//progs
|
||||||
base64_prog, md5sum, dhclient, vbeinfo, testcmd, ping, meminfo;
|
base64_prog, md5sum, dhclient, vbeinfo, testcmd, ping, meminfo, setres;
|
||||||
|
|
||||||
{ Initialize all baked-in programs }
|
{ Initialize all baked-in programs }
|
||||||
procedure init();
|
procedure init();
|
||||||
@@ -37,7 +37,7 @@ uses
|
|||||||
//command provider units
|
//command provider units
|
||||||
kernel, cpu, drivermanagement, processmanager,
|
kernel, cpu, drivermanagement, processmanager,
|
||||||
arp, ipv4, tcp,
|
arp, ipv4, tcp,
|
||||||
diskcmd, usbcore;
|
diskcmd, usbcore, diskutil, notepad, partcmd, volcmd;
|
||||||
|
|
||||||
procedure init();
|
procedure init();
|
||||||
begin
|
begin
|
||||||
@@ -54,10 +54,14 @@ begin
|
|||||||
stdio.registerCommand('TCPCONNECT', @tcp.terminal_command_tcpconnect, 'Connect to a TCP host and send Hello World.');
|
stdio.registerCommand('TCPCONNECT', @tcp.terminal_command_tcpconnect, 'Connect to a TCP host and send Hello World.');
|
||||||
stdio.registerCommand('TCPLISTEN', @tcp.terminal_command_tcplisten, 'Listen on a TCP port and log received data.');
|
stdio.registerCommand('TCPLISTEN', @tcp.terminal_command_tcplisten, 'Listen on a TCP port and log received data.');
|
||||||
stdio.registerCommand('TCPHTTP', @tcp.terminal_command_tcphttp, 'Send HTTP GET to a host IP (port 80 default).');
|
stdio.registerCommand('TCPHTTP', @tcp.terminal_command_tcphttp, 'Send HTTP GET to a host IP (port 80 default).');
|
||||||
diskcmd.init();
|
|
||||||
stdio.registerCommand('USB', @usbcore.terminal_command_usb, 'USB subsystem information.');
|
stdio.registerCommand('USB', @usbcore.terminal_command_usb, 'USB subsystem information.');
|
||||||
|
|
||||||
{ Initialize baked-in programs }
|
{ Initialize baked-in programs }
|
||||||
|
diskcmd.init();
|
||||||
|
partcmd.init();
|
||||||
|
volcmd.init();
|
||||||
|
diskutil.init;
|
||||||
|
notepad.init;
|
||||||
md5sum.init();
|
md5sum.init();
|
||||||
base64_prog.init();
|
base64_prog.init();
|
||||||
dhclient.init();
|
dhclient.init();
|
||||||
@@ -65,6 +69,7 @@ begin
|
|||||||
testcmd.init();
|
testcmd.init();
|
||||||
ping.init();
|
ping.init();
|
||||||
meminfo.init();
|
meminfo.init();
|
||||||
|
setres.init();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
; Embed the boot splash TGA image into .rodata so it is linked
|
||||||
|
; directly into the kernel binary.
|
||||||
|
;
|
||||||
|
; Exported symbols:
|
||||||
|
; _splash_tga_start – pointer to the first byte of the TGA file
|
||||||
|
; _splash_tga_end – pointer one past the last byte
|
||||||
|
; _splash_tga_size – uint32 containing the file size
|
||||||
|
|
||||||
|
section .rodata
|
||||||
|
|
||||||
|
global _splash_tga_start
|
||||||
|
global _splash_tga_end
|
||||||
|
global _splash_tga_size
|
||||||
|
|
||||||
|
_splash_tga_start:
|
||||||
|
incbin "img/asuro.tga"
|
||||||
|
_splash_tga_end:
|
||||||
|
|
||||||
|
_splash_tga_size: dd (_splash_tga_end - _splash_tga_start)
|
||||||
+775
File diff suppressed because it is too large
Load Diff
@@ -62,6 +62,7 @@ procedure free_page_at_address(address : uint32);
|
|||||||
function new_page_directory : uint32;
|
function new_page_directory : uint32;
|
||||||
function new_kernel_mapped_page_directory : uint32;
|
function new_kernel_mapped_page_directory : uint32;
|
||||||
function vtop(address : uint32) : uint32;
|
function vtop(address : uint32) : uint32;
|
||||||
|
function map_page_user(page_number : uint16; block : uint16) : boolean;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@@ -273,4 +274,22 @@ begin
|
|||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function map_page_user(page_number : uint16; block : uint16) : boolean;
|
||||||
|
var
|
||||||
|
rldpd : uint32;
|
||||||
|
|
||||||
|
begin
|
||||||
|
push_trace('vmemorymanager.map_page_user');
|
||||||
|
{ Map a page with User bit set (needed for V86 mode access) }
|
||||||
|
map_page_user := map_page_ex(page_number, block, PageDirectory);
|
||||||
|
PageDirectory^[page_number].UserMode := true;
|
||||||
|
{ Reload CR3 to flush TLB }
|
||||||
|
rldpd := uint32(PageDirectory) - KERNEL_VIRTUAL_BASE;
|
||||||
|
asm
|
||||||
|
mov eax, rldpd
|
||||||
|
mov CR3, eax
|
||||||
|
end;
|
||||||
|
pop_trace;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
Reference in New Issue
Block a user