summaryrefslogtreecommitdiff
path: root/src/sdl_fb.c
AgeCommit message (Collapse)Author
2022-03-19*: de-constify til_setting_t throughoutVito Caputo
Now that til_setting_t.desc is not only a thing, but a thing that is intended to be refreshed regularly in the course of things like GUI interactive settings construction, it's not really appropriate to try even act like this these are const anymore.
2022-03-19*: normalize setting description capitalizationsVito Caputo
Always only capitalize the first letter, never capitalize like titles.
2022-03-12til_settings: always describe relevant settingsVito Caputo
The existing iterative *_setup() interface only described settings not found, quietly accepting usable settings already present in the til_settings_t. This worked fine for the existing interactive text setup thing, but it's especially problematic for providing a GUI setup frontend. This commit makes it so the *_setup() methods always describe undescribed settings they recognize, leaving the setup frontend loop calling into the *_setup() methods to both apply the description validation if wanted and actually tie the description to respective setting returned by the _setup() methods as being related to the returned description. A new helper called til_settings_get_and_describe_value() has been introduced primarily for use of module setup methods to simplify this nonsense, replacing the til_settings_get_value() calls and surrounding logic, but retaining the til_setting_desc_t definitions largely verbatim. This also results in discarding of some ad-hoc til_setting_desc_check() calls, now that there's a centralized place where settings become "described" (setup_interactively in the case of rototiller). Now a GUI frontend (like glimmer) would just provide its own setup_interactively() equivalent for constructing its widgets for a given *_setup() method's chain of returned descs. Whereas in the past this wasn't really feasible unless there was never going to be pre-supplied settings. I suspect the til_setting_desc_check() integration into setup_interactively() needs more work, but I think this is good enough for now and I'm out of spare time for the moment.
2021-10-01*: librototiller->libtilVito Caputo
Largely mechanical rename of librototiller -> libtil, but introducing a til_ prefix to all librototiller (now libtil) functions and types where a rototiller prefix was absent. This is just a step towards a more libized librototiller, and til is just a nicer to type/read prefix than rototiller_.
2021-02-16*fb: plumb outer fb_t down to fb_ops_t methodsVito Caputo
None of the existing fb_ops_t implementations need this, but due to how GTK+ works, the GTK+ frontend using librototiller will likely want to wire up calling fb_flip() on the fb from behind fb_ops.
2021-02-14*fb: improve error propagation out of setup/initVito Caputo
A lot of errors were being conflated as ENOMEM due to the lazy use of NULL pointer returns for errors. This commit reworks a handful of those return paths to instead return an errno-style int, storing the results on success at a supplied result pointer. It's kind of ugly, and I make some assumptions about libdrm setting errno on failure - it too uses this lazy API of returning NULL pointers on failure. Hopefully errno is always set by an underlying ioctl failing. The SDL error API is also pretty gross, being cross-platform it defines its own error codes so I try vaguely map these to errno values. I'm considering this a first approximation at fixing this up, but there are probably bugs as I did it real fast and nasty. It at least seems to all still work OK here in the non-error paths I tested. So it doesn't seem more broken than before at a glance.
2021-02-14drm_fb,sdl_fb: staticify all functionsVito Caputo
Some omissions, nothing in these is public outside of what's explicitly plumbed out via fb_ops_t.
2020-09-13sdl_fb: use SDL_CreateRGBSurface() insteadVito Caputo
I was using SDL_CreateRGBSurfaceWithFormat() without considering the minimum SDL2 version implications. Switch to SDL_CreateRGBSurface() as there's no relevant difference, so I can lower the minimum SDL2 version in configure.ac.
2019-11-24fb: add pitch to fb_fragment_tVito Caputo
The put_pixel helpers really needed reworking to properly handle subframe fragments modules like montage will utilize. I had the stride present as it's convenient for a number of modules that maintain a buf pointer as they progress down a row, but the pitch is more applicable to put_pixel for scaling the y coordinate. Now there's both pitch and stride so everyone's happy with what's most convenient for their needs.
2019-11-15sdl_fb: use setting_desc_check()Vito Caputo
2019-11-10settings: s/setting_desc_new/setting_desc_clone/Vito Caputo
Slight refactor to make call sites less annoying. Now takes a (setting_desc_t *) instead of the members as discrete parameters, and returns an errno on error so callers can simply propagate error codes out rather than having to get access to errno defines, check for NULL and return -ENOMEM etc. It also makes the call sites self documenting by employing designated initializers in compound literals for the supplied setting_desc_t. This is in prep for runtime-configurable module settings.
2018-02-26sdl_fb: add fullscreen= and size= settingsVito Caputo
fullscreen takes either "on" or "off" size expects WxH arguments, defaults still to 640x480 size is optional when fullscreen=on. Through the setup machinery, when fullscreen has been selected it will not ask for a size - a "fullscreen desktop" mode is presumed. However, thorugh the explicit commandline flags, a mixed mode can be achieved by specifying both "fullscreen=on,size=WxH". This instructs SDL to attempt a video mode switch to the specified size if needed. I've found it to be pretty unreliable on my Xorg/linux system, unless I choose the same video mode as my desktop is already in. Then I get what looks like rendering into the root window or something, it's weird. Hence there's no effort made to expose that in the interactive setup, but it's technically possible and some effort was made to wire it up.
2018-02-26sdl_fb: jump through SDL_Main() hoopsVito Caputo
Since I don't use the SDL event loop, this needs to be done to keep things happy apparently.
2018-02-26sdl_fb: drain event queue on page flipVito Caputo
2018-02-22fb,settings,drm_fb,sd_fb: const settings_t readersVito Caputo
The fb_ops entrypoints and their descendants are purely readers of the settings, so constify their settings_t instances and the operative functions which only read settings.
2018-02-22sdl_fb: implement rudimentary sdl fb backendVito Caputo
This uses a simple fixed 640x480 windowed mode (for now). The SDL2 Renderer & Texture API is used for vsync-synchronized presents. There's probably excessive copying going on because the rototiller fb code manages pages and flips but SDL2 doesn't really expose low-level control of such things. This backend is quite useful for development purposes, allowing quick iteration in a windowed environment. Note this is just the backend implementation, it's dormant code but trivially activated.
© All Rights Reserved