summaryrefslogtreecommitdiff
path: root/src/fb.h
AgeCommit message (Collapse)Author
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.
2020-09-25fb: track zeroed state in fb_fragment_tVito Caputo
This adds a bit flag for tracking if the fragment has been zeroed since its last flip/present. When a fresh frame comes back from flipping, its zeroed state is reset to false. When fb_fragment_zero() is called, it checks if zeroed is true, and skips the zeroing if so. If zeroed is false, fb_fragment_zero() will zero the fragment and set the zeroed flag to 1. This change is preparatory for layering the output of modules in a compositing fashion. Not all modules are amenable to being used as upper layers, since they inherently fill the screen with new pixels every frame. Those modules make good bottom or bg layers. Other modules perform fb_fragment_zero() every frame and add relatively few pixels atop a clean slate. These modules make good candidates for upper layers where this change becomes relevant.
2019-11-24fb: add number to fb_fragment_tVito Caputo
This introduces a stricter coupling and requirement for modules supplying a fragmenter in their prepare_frame() to only receive fragments produced by *their* fragmenter at their render_fragment(). When modules don't explicitly perform any fragmenting they can't really make much use of this number as it will reflect an arbitrary fragmenting pass's perspective. But when modules do perform their own frame fragmenting, they can assume any fragment supplied to their render function will have been generated by it. This needs to be enforced a bit in the code. The current use case is montage using a fragmenter for tiling the montage in a threaded render. The fragment numbers map to the modules to be rendered in the tiles. As long as modules can assume their fragmenter will always be what produces their fragments, this is perfectly fine.
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.
2018-02-26rototiller,fb: swap dispatch with page flippingVito Caputo
For the sake of sdl_fb, move page flipping into the main thread and run module render dispatch from another thread instead. This eliminates the fb flipper thread, moving its functionality into fb_flip() which synchronously consumes and performs a single flip from the same queue as before - the function is verbatim the loop body of the flipper thread. Now main() calls fb_flip() in a loop where it previously dispatched pages for rendering. Rendering dispatch is now performed in a created thread. See the comment in fb.c for more explanation of this shuffle.
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-22*: embrace new generic settings paradigmVito Caputo
This should probably be split into multiple commits, but for simplicity sake it's all cut over at once. drm_fb.c sees major changes, migrating the remaining drm-specific bits from drmsetup into it, behind the settings API. rototiller.c sees a bunch of scaffolding surrounding the settings API and wiring it up into the commandline handling and renderers and video backends. fb.[ch] see minor changes as settings get plumbed to the backend drmsetup.[ch] goes bye bye
2018-01-01fb: switch over to fb_ops_t abstractionVito Caputo
Remove everything drm-related from fb.c, utilizing the implementation in drm_fb.c instead.
2018-01-01fb: introduce fb_ops_tVito Caputo
Hooks for fb acquire/release, page allocate, free, and flip. This should encompass everything currently needed for the drm backend, which will move behind this abstraction in a later commit.
2017-09-14fb: s/fb_fragment_divide_single/fb_fragment_slice_single/Vito Caputo
Mechanical cosmetic change
2017-09-14fb: implement a tiling fragmenterVito Caputo
2017-09-14*: use fragment generatorVito Caputo
Rather than laying out all fragments in a frame up-front in ray_module_t.prepare_frame(), return a fragment generator (rototiller_fragmenter_t) which produces the numbered fragment as needed. This removes complexity from the serially-executed prepare_frame() and allows the individual fragments to be computed in parallel by the different threads. It also eliminates the need for a fragments array in the rototiller_frame_t, indeed rototiller_frame_t is eliminated altogether.
2017-04-27fb: apply fragment coordinates put pixel helperVito Caputo
fb_fragment_put_pixel_unchecked() assumed the x,y coordinates of the fragment were always 0.
2017-04-22fb: add frame_{width,height} to fb_fragment_tVito Caputo
Modules need to know the overall dimensions of the frame the fragment they're rendering is part of. Previously it wasn't really necessary since the fragments supplied to the modules had always been the full page, but that's changing. This commit also changes the julia module to use the frame dimensions, others will need updating as well.
2017-02-03fb: add fb_fragment_zero() helperVito Caputo
Currently just a memset wrapper... but maybe could get noop'd if the flipper thread started supporting pre-zeroing pages in its thread, just need a zeroed state in the fb page.
2017-02-03fb: add pixel drawing helpersVito Caputo
Modules seem to be duplicating this, just pull it into fb.h since we're already dependent on the fb.h abstractions in the modules. Slippery slope!
2017-02-03fb: add fragment bounds checking helperVito Caputo
Simple x,y coordinate check
2017-01-18*: move source into src/ subdirVito Caputo
Restoring some organizational sanity since adopting autotools.
© All Rights Reserved