diff options
author | pk33 <pk33@email.com> | 2024-11-03 03:41:54 +0100 |
---|---|---|
committer | pk33 <pk33@email.com> | 2024-11-03 03:41:54 +0100 |
commit | 0f23d50c8291b23799e55c8653c15f16c0d752d0 (patch) | |
tree | 0fad70720f1bf647448a26636d51fdbd80bfc640 | |
parent | ee7cd3e6b622a8c40236ac26270e369bc28af007 (diff) | |
download | engine33-0f23d50c8291b23799e55c8653c15f16c0d752d0.tar.gz |
VT switcher fix
-rw-r--r-- | README.html | 8 | ||||
-rw-r--r-- | include/options.h | 22 | ||||
-rw-r--r-- | include/system.h | 16 | ||||
-rw-r--r-- | makefile | 3 | ||||
-rw-r--r-- | src/display.c | 11 | ||||
-rw-r--r-- | src/main.c | 2 |
6 files changed, 27 insertions, 35 deletions
diff --git a/README.html b/README.html index 5758e47..940a743 100644 --- a/README.html +++ b/README.html @@ -6,18 +6,20 @@ <h3>COMPILING</h3> <hr> -<p>bmake</p> +<p>Set CC in the makefile. Then bmake.</p> <br><br> <h3>USAGE</h3> <hr> -<p>run ./bin/engine33 on a TTY with a display connected to the integrated graphics. Can you find the green pixel on your screen? Well done.</p> +<p>You need a monitor connected to an on-board connector.<br> +Run ./bin/engine33 on a TTY.<br> +Can you see the green pixel on your screen? Well done.</p> <br><br> <h3>BUGS</h3> <hr> <ul> - <li>VT switcher doesn't work</li> + <li>Vsync code is pretty shitty</li> </ul> <br><br> diff --git a/include/options.h b/include/options.h index 4b6f765..2e71ad6 100644 --- a/include/options.h +++ b/include/options.h @@ -2,25 +2,9 @@ #define __OPTIONS_H__ -/**/ -#define DRM_DEVICE "/dev/dri/card0" -#define DRM_MODE "1024x768" -#define DRM_RATE 75 -/**/ - - -#define NEAR 1.0; -#define FAR 24.0 - -#define TRANSPARENT 0x0 -#define BLACK 0xff000000 -#define WHITE 0xffffffff -#define RED 0xffff0000 -#define GREEN 0xff00ff00 -#define BLUE 0xff0000ff -#define YELLOW 0xffffff00 -#define MAGENTA 0xffff00ff -#define CYAN 0xff00ffff +#define DRM_DEVICE "/dev/dri/card1" +#define DRM_MODE "1366x768" +#define DRM_RATE 60 #endif /* __OPTIONS_H */ diff --git a/include/system.h b/include/system.h index 6260013..b97daff 100644 --- a/include/system.h +++ b/include/system.h @@ -3,12 +3,22 @@ #include "types.h" +#define NEAR 1.0 +#define FAR 24.0 + +#define TRANSPARENT 0x0 +#define BLACK 0xff000000 +#define WHITE 0xffffffff +#define RED 0xffff0000 +#define GREEN 0xff00ff00 +#define BLUE 0xff0000ff +#define YELLOW 0xffffff00 +#define MAGENTA 0xffff00ff +#define CYAN 0xff00ffff + err e33_ioctl( Size fd, unsigned long req, void *arg ); boolean strcomp( String s1, String s2 ); -void clear_tty( void); -void vprint_tty( String fmt, ... ); -err get_line (char *buff, size_t sz, char *fmt, ...); #endif /** __SYSTEM_H__ **/ @@ -22,8 +22,9 @@ CFLAGS = -march=native -mtune=native -std=c99 -static -w -Wall -Werror -Wextra - $(PROJECT): $(OBJS) $(CC) $(CFLAGS) $(LIBS) -o $(.TARGET) $(.OODATE) + mkdir -p $(PDIR) mv $(.TARGET) $(.ALLSRC:T) $(PDIR) clean: - rm bin/*.out + rm bin/*.o diff --git a/src/display.c b/src/display.c index 1e68f89..25c6437 100644 --- a/src/display.c +++ b/src/display.c @@ -52,7 +52,7 @@ typedef struct { static DRMData_d drmData = {0,}; -static Size vtPipe[2] = { -1, -1 }; +static int vtPipe[2] = { -1, -1 }; static struct termios termOldConfig; @@ -538,11 +538,10 @@ static Size _init_vt_switch( void ) struct vt_mode vt_mode = {0,}; sigset_t set; - __display.ttyfd = -1; + __display.ttyfd = -1; - /* Init VT pipes */ - if (pipe(vtPipe) != 0) + if( pipe(vtPipe) == -1 ) { vtPipe[0] = vtPipe[1] = -1; loge( "Could not set VT pipes"); @@ -557,7 +556,6 @@ static Size _init_vt_switch( void ) loge( "Could not set VT write pipe" ); return E33_EXIT_FAILURE; } - /**/ if( __display.ttyfd = open("/dev/tty", O_RDWR ) < 0 ) { @@ -566,7 +564,6 @@ static Size _init_vt_switch( void ) } - /* Setup signals */ if( _has_signal(REL_SIGNAL) ) { loge( "VT release signal is already in use"); return E33_EXIT_FAILURE; @@ -584,8 +581,6 @@ static Size _init_vt_switch( void ) loge( "Could not set acquire signal handler"); return E33_EXIT_FAILURE; } - /**/ - if( ioctl(__display.ttyfd, VT_GETMODE, &vt_mode) < 0 ) { @@ -1,7 +1,7 @@ #include "display.h" #include "clock.h" #include "logger.h" -#include "options.h" +#include "system.h" int main(int argc, char *argv[]) |