pico9918-core 1.3.0
TMS9918A / F18A video display processor emulation in C99
Loading...
Searching...
No Matches
pico9918_gpu_priv.h
Go to the documentation of this file.
1/**
2 * \file
3 * \brief pico9918-core - GPU privileged surface
4 *
5 * Copyright (c) 2021 Troy Schrapel
6 *
7 * This code is licensed under the MIT license
8 *
9 * https://github.com/visrealm/pico9918-core
10 *
11 * The GPU entries that need the private instance layout, kept out of gpu/gpu.h so
12 * that header stays public. The include rule this serves: an emulator includes
13 * pico9918.h plus the platform/host header and nothing under impl/. Putting the
14 * one-line pico9918_gpu_trigger below on the public header would pull the whole
15 * private struct onto that surface for a single store.
16 *
17 * Privileged, like the rest of impl/. Do not include from an emulator.
18 */
19
20#pragma once
21
22#include "pico9918_priv.h"
23
24/*
25 * Trigger the GPU to (re)start execution at the current gpuAddress.
26 * Safe to call from the main/IRQ context.
27 *
28 * Every caller is inside the library: pico9918_frame.c is the only user, and it
29 * already includes impl/.
30 */
31PICO9918_INLINE void pico9918_gpu_trigger(PICO9918_INST_ONLY_ARG)
32{
33 tms9918->restart = 1;
34}
35
36#if PICO9918_GPU_BUDGETED
37
38/* A slice for an armed program. In gpu.c because it steps the core; the gpuSlice test
39 is here so a host driving the GPU itself pays a load and a branch, not a call. */
40void pico9918_gpu_run_slice(PICO9918_INST_ONLY_ARG);
41
42/* Re-derive the slice from the rate for this frame's line count and refresh. */
43void pico9918_gpu_note_frame(PICO9918_INST_ARG uint32_t lines, float frameRateHz);
44
45PICO9918_INLINE void pico9918_gpu_service(PICO9918_INST_ONLY_ARG)
46{
47 if (tms9918->gpuSlice) pico9918_gpu_run_slice(PICO9918_INST_ONLY);
48}
49
50#else
51
52/* An unbudgeted core is a board's, which runs the GPU on a core of its own - so the call
53 sites stay unguarded and these fold away, rather than leaving the scanline path a test
54 that can never be true. */
55PICO9918_INLINE void pico9918_gpu_service(PICO9918_INST_ONLY_ARG)
56{
57 (void)tms9918;
58}
59
60PICO9918_INLINE void pico9918_gpu_note_frame(PICO9918_INST_ARG uint32_t lines, float frameRateHz)
61{
62 (void)tms9918;
63 (void)lines;
64 (void)frameRateHz;
65}
66
67#endif
#define PICO9918_INST_ARG
declare the instance ahead of other parameters
Definition pico9918.h:71
#define PICO9918_INST_ONLY
pass the instance as the only argument
Definition pico9918.h:74
#define PICO9918_INST_ONLY_ARG
declare the instance as the only parameter
Definition pico9918.h:72
pico9918-core - the private instance layout