BTRFS: Implement BTree::Path and change _Find.
[haiku.git] / src / add-ons / accelerants / ati / engine.cpp
blob15ff0f147635df482d1bec38f5dc4c4c0ab8dedc
1 /*
2 Copyright 1999, Be Incorporated. All Rights Reserved.
3 This file may be used under the terms of the Be Sample Code License.
5 Other authors:
6 Gerald Zajac 2007-2008
7 */
9 #include "accelerant.h"
12 static engine_token engineToken = { 1, B_2D_ACCELERATION, NULL };
15 uint32
16 AccelerantEngineCount(void)
18 return 1;
22 status_t
23 AcquireEngine(uint32 capabilities, uint32 max_wait,
24 sync_token* st, engine_token** et)
26 (void)capabilities; // avoid compiler warning for unused arg
27 (void)max_wait; // avoid compiler warning for unused arg
29 if (gInfo.sharedInfo->engineLock.Acquire() != B_OK)
30 return B_ERROR;
32 // Sync if required.
33 if (st)
34 SyncToToken(st);
36 // Return an engine token.
37 *et = &engineToken;
38 return B_OK;
42 status_t
43 ReleaseEngine(engine_token* et, sync_token* st)
45 // Update the sync token, if any.
46 if (st)
47 GetSyncToken(et, st);
49 gInfo.sharedInfo->engineLock.Release();
50 return B_OK;
54 void
55 WaitEngineIdle(void)
57 gInfo.WaitForIdle(); // wait until engine is completely idle
61 status_t
62 GetSyncToken(engine_token* et, sync_token* st)
64 st->engine_id = et->engine_id;
65 st->counter = 0;
66 return B_OK;
70 status_t
71 SyncToToken(sync_token* st)
73 (void)st; // avoid compiler warning for unused arg
75 WaitEngineIdle();
76 return B_OK;