Indentation fix, cleanup.
[AROS.git] / rom / graphics / qbsblit.c
blob59b4d443a966482313019bb2520a16b5b5003df3
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Queue a beam-synchronized 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, QBSBlit,
23 /* SYNOPSIS */
24 AROS_LHA(struct bltnode *, bn, A1),
26 /* LOCATION */
27 struct GfxBase *, GfxBase, 49, Graphics)
29 /* FUNCTION
30 Queues a request for a beam-synchronized blit.
32 INPUTS
33 bn - pointer to blitnode structure
35 RESULT
36 The routine that function in the bltnode is pointing to is
37 called when the blitter is ready for work. No other task will
38 be able to access the blitter while you're doing the blit.
39 Queued blits have precedence over a task that tries to own the
40 blitter via OwnBlitter(). So all queued blitter requests will
41 be done first until the task that attempts a OwnBlitter can
42 actually access the blitter.
44 NOTES
45 Not all hardware has a blitter. On hardware where there is no
46 blitter, a blitter is simulated. Therefore all code that will
47 be executed in the function that is called must not contain
48 code that is hacking the blitter's register but should contain
49 calls to graphics functions instead.
51 EXAMPLE
53 BUGS
55 SEE ALSO
56 QBSBlit(), OwnBlitter(), DisownBlitter(), hardware/blit.h
58 INTERNALS
60 HISTORY
62 ******************************************************************************/
64 AROS_LIBFUNC_INIT
66 /* this function uses the queue bsblthd (bsblttl) */
68 /* I am accessing a public structure and there's no semaphore...*/
69 Disable();
71 if (NULL == GfxBase->bsblthd)
73 /* OwnBlitter() only if both lists are empty */
74 if (NULL == GfxBase->blthd)
75 OwnBlitter();
77 /* it's the first one in the list */
78 GfxBase->bsblthd = bn;
79 GfxBase->bsblttl = bn;
81 /* In this case the following also has to happen:
82 It is my understanding that at the end of every blit an interrupt
83 occurs that can take care of any blits in this queue or allow
84 a taks to wake up when it was blocked due to a call to OwnBlitter.
85 But in this case there might not be such an interrupt for a long
86 time if no calls to blitterfunctions are made. Therefore this
87 blit might be queued forever. To avoid this I have to cause
88 a Blitter interrupt, if no task owns the blitter right now.
89 (BlitOwner)
92 !!! missing code here!! See explanation above!
94 #if (AROS_FLAVOUR & AROS_FLAVOUR_BINCOMPAT) && defined(mc68000)
96 /* Trigger blitter interrupt */
97 volatile struct Custom *custom = (struct Custom *)(void **)0xdff000;
98 custom->intreq = INTF_SETCLR | INTF_BLIT;
99 custom->intena = INTF_SETCLR | INTF_BLIT;
101 #endif
103 else
105 /* queue it at the end */
106 GfxBase->bsblttl->n = bn;
107 GfxBase->bsblttl = bn;
110 Enable();
112 AROS_LIBFUNC_EXIT
114 } /* QBSBlit */