1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-13 23:27:12 +00:00

1102 Commits

Author SHA1 Message Date
Nick Briggs
b166d36ec4 Cleanup, strip some debug/performance code in display update, minor formatting 2023-02-19 10:07:28 -08:00
Nick Briggs
878168f4f5 Implement bitblt to texture at bit level rather than word level, some cleanup
sdl_bitblt_to_texture2 is an experiment, parallel to sdl_bitblt_to_texture
that only moves as many bits as are required, rather than rounding down(up) to the
nearest (16-bit) word boundary for the start(end) of the line.

Introduces some name changes to make things a little clearer.
2023-02-19 10:07:28 -08:00
Nick Briggs
78bcb188a8 Take pixelscale into account when repositioning cursor 2023-02-19 10:07:28 -08:00
Nick Briggs
d2700aa637 Some systems require C99 extensions to get sigset utilities. 2023-02-19 10:07:28 -08:00
Nick Briggs
0600a034b6 Speedups in texture based display path
Instead of checking "do_invert" at each pixel assignment, assign the
foreground and background colors appropriately when responding to the
(VIDEOCOLOR x) call.

Modify sdl_bitblt_to_texture() so that it does less arithmetic in the inner loop,
including using a table of masks rather than computing 1<<n on each pixel.
Modify sdl_bitblt_to_texture() so that it accesses the Lisp display region
16-bits at a time with the correct ordering for whether we are on a byte-swapped
system or not.
2023-02-19 10:07:28 -08:00
Nick Briggs
ca7f09bb6d Minor changes to add missing file for SDL and set no extensions for C compiler
Sets CMAKE_C_EXTENSIONS to OFF as we wish to use c99 *not* gnu99
Adds inc/sdldefs.h to SDL header files list
2023-02-19 10:07:28 -08:00
Nick Briggs
16e4062b8f When updating the window surface directly, at scale 1, avoid the intermediate buffer
Adds an sdl_blt_to_window_surface() that goes directly from the Lisp bitmap
to the window surface avoiding the intermediate copy.  This is only coded for a
scale factor of 1.  Uses the intermediate buffer if the scale is not 1.

Corrects an error where the damage rectangle was not properly reset.
2023-02-19 10:07:28 -08:00
Nick Briggs
4104219ee5 Avoid intermediate buffer and bitblt Lisp screen changes directly into the texture pixels
Using SDL_LockTexture/SDL_UnlockTexture we can gain more direct access to the pixels of the
texture and update them directly from the Lisp screen bitmap.

At the same time, for both the rendering case and the display surface case,
update the pixel format used to be either the first (presumably preferred?)
format for a texture, or the surface format of the window.

Use the SDL routines to pick out the pixel value for Black and White based on the
destination it will be placed in.
2023-02-19 10:07:28 -08:00
Nick Briggs
74da70d0b4 Introduce alternative method for updating window from Lisp bitmap
If the preprocessor symbol SDLRENDERING is defined the code operates as
it previously did.  In the absence of that, we process the Lisp bitmap
into an intermediate form (as before) but then use SDL bitblt to
redraw the intermediate form on the window's surface.
2023-02-19 10:07:28 -08:00
Nick Briggs
2b957aa8f3 Move display update into separate procedure 2023-02-19 10:07:28 -08:00
Nick Briggs
e5b8248465 Width, but not height, must be multiple of 32 2023-02-19 10:07:28 -08:00
Nick Briggs
fab10fc71f Bounds check indexing into intermediate screen buffer
When building with -DCMAKE_BUILD_TYPE=Debug, we assert() that the
index into the intermediate screen buffer is in bounds.
2023-02-19 10:07:28 -08:00
Nick Briggs
a2f8f23152 Keep damage notification boundaries within the current screen
On startup, bitblt calls may be made for the original screen size
and if the new screen size is smaller than that, we must ensure
that damage notifications are contained within the new screen.

Move definition of min() so we can use it in sdl_notify_damage()
2023-02-19 10:07:28 -08:00
Peter
0e731ce02d Cache cursors for SDL. 2023-02-19 10:07:28 -08:00
Peter
0ed7719343 Change Pixelformat to 332 (one byte) instead of 8888 (four bytes). 2023-02-19 10:07:28 -08:00
Nick Briggs
64e0419af3 Fix "error: implicit declaration of function" from dspsubrs
Creates an sdldefs.h, declares a few more functions in sdl.c static,
and includes sdldefs.h in dspsubrs.c when necessary.
2023-02-19 10:07:28 -08:00
Peter
1db44b1f76 Add support for setting the mouse cursor. Not finished!
Currently this just allocates a new X cursor each time, should be
amended to cache the cursor, just like X does at the moment.
2023-02-19 10:07:27 -08:00
Peter
dbba06d9e1 Add support for inverting video and setting mouse position.
Use (IL:VIDEOCOLOR T/NIL) to change inversion.
2023-02-19 10:07:27 -08:00
Peter
cf8ecc1dd4 Add mouse wheel diagnostics. 2023-02-19 10:07:27 -08:00
Peter
380416fa2d Only update texture on damage. 2023-02-19 10:07:27 -08:00
Peter
6f0ca7ad1c Add support for key repeating. 2023-02-19 10:07:27 -08:00
Peter
7573151be8 For now, some more extern functions declarations. 2023-02-19 10:07:27 -08:00
Peter
083d153d43 Maybe fix cmake for SDL2. 2023-02-19 10:07:27 -08:00
Peter
13d367e766 Remove SDL2 directory from include SDL2/SDL.h. 2023-02-19 10:07:27 -08:00
Peter
af6c6e3e1d Fix Caso. 2023-02-19 10:07:27 -08:00
Peter
2f633f2f50 Try to unify cmake file for different versions of SDL2. 2023-02-19 10:07:27 -08:00
Peter
74d47b07ca Try SDL2::SDL2 instead of SDL2 in CMakeLists.txt. 2023-02-19 10:07:27 -08:00
Peter
292e5dd9b2 Try to placate the macos build. 2023-02-19 10:07:27 -08:00
Peter
71d2d0a5b0 Apparently there is no sdl2 cask for macos :-/ 2023-02-19 10:07:27 -08:00
Peter
d046d26003 Add SDL2 dependency to macos build. 2023-02-19 10:07:27 -08:00
Peter
81e17c0955 Show cmake version before building. 2023-02-19 10:07:23 -08:00
Peter
40b24ec655 Try to make builds pass again. 2023-02-19 10:06:26 -08:00
Peter
5e28babfa5 Run apt-get update before trying to install. 2023-02-19 10:06:26 -08:00
Peter
6604b3dd06 Add support for -t / -title. 2023-02-19 10:06:24 -08:00
Peter
0187073ae0 Revert CMakeLists.txt change until better understanding. 2023-02-19 10:05:18 -08:00
Peter
79903e311e Also *correctly* install SDL2 on ubuntu runners. 2023-02-19 10:05:18 -08:00
Peter
e2e6aa5366 Also install SDL2 on ubuntu runners. 2023-02-19 10:05:18 -08:00
Peter
8c34ca3106 Try to get CI running again ;) 2023-02-19 10:05:18 -08:00
Peter
b77f64f31e Add command line parameters -sc WxH and -pixelscale n for SDL. 2023-02-19 10:05:15 -08:00
Peter
8038a959c5 Update CMakeLists.txt for cross-compiling. 2023-02-19 10:03:59 -08:00
Peter
085e99a7c0 Add more #ifdef XWINDOW 2023-02-19 10:03:59 -08:00
Peter
3b6b203e6c Remove extra directory from includes for SDL. 2023-02-19 10:03:59 -08:00
Peter
948db16ed9 Refactor, only bitblt once per "frame". 2023-02-19 10:03:59 -08:00
Peter
ffacda1278 Refactor, don't update texture on every bitblt. 2023-02-19 10:03:59 -08:00
Peter
e39b650f4d Only bitblt on damage.
Also add an alternative for key handling, which does not work any better...
2023-02-19 10:03:55 -08:00
Peter
a722e01a4f Change SDL backend to accelerated renderer, support pixel scaling.
Edit main.c, init_SDL(1600, 1024, 1) means lisp display size 1600x1024, pixel scaling 1.

Try init_SDL(800, 512, 2) or even init_SDL(608, 1023, 3).
2023-02-19 10:02:25 -08:00
Peter
8cf471bec9 Add prototypical SDL support.
Build with cmake. This will create a new backend (ldesdl).
- Resolution can only be set by editing the variables in sdl.c.
- Key repeat does not work.
- Still problems with keysyms that implicitly contain modifiers.
- The entire screen is bitblted onto the SDL display every frame.

Support keyboard, and work on mouse.

Kind of working...

Fix display resolution problems.
2023-02-19 10:00:21 -08:00
Nick Briggs
900c9557ab Fix gcscan1, gcscan2 can miss finding 0th entry in gc hashtable #1038
The Lisp implementation distinguishes between 0 and NIL as the result of
    the gcscan1/gcscan2 opcodes, however the C implementation did not, since
    NIL and 0 are indistinguishable.
2023-02-17 17:01:27 -08:00
Nick Briggs
937a003bfb Correct format specification for printing DLword StackOffset (%tx -> %hx) 2023-02-17 17:01:27 -08:00
Nick Briggs
a958af1627 Resolve warning: variable may be uninitialized when used - initialize more variables. 2023-02-17 17:01:27 -08:00