add idnestcnt and tdnestcnt overrides. use atomic operations when appropriate
[AROS.git] / rom / graphics / disownblitter.c
blobabc86f1f41d1e1ca08730b37e55c1c8e9e1634a9
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Release the bitter from private usage
6 Lang: english
7 */
9 #include <aros/debug.h>
11 #include <proto/exec.h>
12 #include <graphics/gfxbase.h>
13 #include <exec/tasks.h>
15 #include "graphics_intern.h"
16 #include "gfxfuncsupport.h"
18 /*****************************************************************************
20 NAME */
21 #include <proto/graphics.h>
23 AROS_LH0(void, DisownBlitter,
25 /* SYNOPSIS */
28 /* LOCATION */
29 struct GfxBase *, GfxBase, 77, Graphics)
31 /* FUNCTION
32 The blitter is returned to usage by other tasks.
34 INPUTS
36 RESULT
38 NOTES
40 EXAMPLE
42 BUGS
44 SEE ALSO
45 DisownBlitter()
47 INTERNALS
49 HISTORY
51 ******************************************************************************/
53 AROS_LIBFUNC_INIT
55 /* Debugging disabled, this function must be callable from blitter interrupt.
56 * FIXME: better solution?
59 #if 0
60 struct Task *me = FindTask(NULL);
62 D(bug("DisownBlitter: Release by Task %p\n", me));
64 if (GfxBase->BlitOwner != me) {
65 D(bug("DisownBlitter: Owned by Task %p, but Task %p is releasing it!\n",
66 GfxBase->BlitOwner, me));
69 if (NULL != GfxBase->blthd && NULL != GfxBase->bsblthd)
71 D(bug("DisownBlitter: OOPS! Disowning while queued enties are in play!\n"));
73 #endif
75 Disable();
77 GfxBase->BlitOwner = NULL;
78 /* Do we have any waiting tasks? */
79 if (!IsListEmpty(&GfxBase->BlitWaitQ)) {
80 /* Wake up next OwnBlitter() waiting task */
81 struct BlitWaitQNode *node = (struct BlitWaitQNode*)GfxBase->BlitWaitQ.lh_Head;
82 D(bug("DisownBlitter: Waking task %p\n", node->task));
83 Signal(node->task, 1 << SIGB_BLIT);
86 Enable();
88 #if 0
89 D(bug("DisownBlitter: Released by Task %p\n", me));
90 #endif
92 AROS_LIBFUNC_EXIT
93 } /* DisownBlitter */