Minor fixes to comments.
[AROS.git] / rom / graphics / qblit.c
blobb6f1c9685e0e505166ba23420b79fe69371ac5e5
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Queue a Blit
6 Lang: english
7 */
9 #include <proto/exec.h>
10 #include <hardware/intbits.h>
11 #include <hardware/blit.h>
12 #include <graphics/gfxbase.h>
14 #include "graphics_intern.h"
16 /*****************************************************************************
18 NAME */
19 #include <proto/graphics.h>
21 AROS_LH1(void, QBlit,
23 /* SYNOPSIS */
24 AROS_LHA(struct bltnode *, bn, A1),
26 /* LOCATION */
27 struct GfxBase *, GfxBase, 46, Graphics)
29 /* FUNCTION
30 Queues a request for a blit. This request is queued at the end
31 of the list.
33 INPUTS
34 bn - pointer to blitnode structure
36 RESULT
37 The routine that function in the bltnode is pointing to is
38 called when the blitter is ready for work. No other task will
39 be able to access the blitter while you're doing the blit.
40 Queued blits have precedence over a task that tries to own the
41 blitter via OwnBlitter(). So all queued blitter requests will
42 be done first until the task that attempts a OwnBlitter can
43 actually access the blitter.
45 NOTES
46 Not all hardware has a blitter. On hardware where there is no
47 blitter, a blitter is simulated. Therefore all code that will
48 be executed in the function that is called must not contain
49 code that is hacking the blitter's register but should contain
50 calls to graphics functions instead.
52 EXAMPLE
54 BUGS
56 SEE ALSO
57 QBSBlit(), OwnBlitter(), DisownBlitter(), hardware/blit.h
59 INTERNALS
61 HISTORY
63 ******************************************************************************/
65 AROS_LIBFUNC_INIT
67 /* this function uses the simple FIFO queue blthd (blttl) */
69 /* I am accessing a public structure and there's no semaphore...
70 * Interrupts disabled because this is accessed from blitter interrupt.
72 Disable();
74 if (NULL == GfxBase->blthd)
76 /* OwnBlitter() only if both lists are empty */
77 if (NULL == GfxBase->bsblthd)
78 OwnBlitter();
80 /* it's the first one in the list */
81 GfxBase->blthd = bn;
82 GfxBase->blttl = bn;
84 /* In this case the following also has to happen:
85 It is my understanding that at the end of every blit an interrupt
86 occurs that can take care of any blits in this queue or allow
87 a taks to wake up when it was blocked due to a call to OwnBlitter.
88 But in this case there might not be such an interrupt for a long
89 time if no calls to blitterfunctions are made. Therefore this
90 blit might be queued forever. To avoid this I have to cause
91 a Blitter interrupt, if no task owns the blitter right now.
92 (BlitOwner)
95 !!! missing code here!! See explanation above!
97 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT) && defined(mc68000)
99 /* Trigger blitter interrupt */
100 volatile struct Custom *custom = (struct Custom *)(void **)0xdff000;
101 custom->intreq = INTF_SETCLR | INTF_BLIT;
102 custom->intena = INTF_SETCLR | INTF_BLIT;
104 #endif
106 else
108 /* queue it at the end */
109 GfxBase->blttl->n = bn;
110 GfxBase->blttl = bn;
113 Enable();
115 AROS_LIBFUNC_EXIT
116 } /* QBlit */