1 /*****************************************************************************\ 2 * Tseng Labs ET6000, ET6100 and ET6300 graphics driver for BeOS 5. 3 * Copyright (c) 2003-2004, Evgeniy Vladimirovich Bobkov. 4 \*****************************************************************************/ 5 6 #include "GlobalData.h" 7 #include "generic.h" 8 9 10 /*****************************************************************************/ 11 static engine_token et6000EngineToken = {1, B_2D_ACCELERATION, NULL}; 12 /*****************************************************************************/ 13 uint32 ACCELERANT_ENGINE_COUNT(void) { 14 return 1; 15 } 16 /*****************************************************************************/ 17 status_t ACQUIRE_ENGINE(uint32 capabilities, 18 uint32 max_wait, 19 sync_token *st, 20 engine_token **et) 21 { 22 /* acquire the shared benaphore */ 23 AQUIRE_BEN(si->engine.lock) 24 /* sync if required */ 25 if (st) SYNC_TO_TOKEN(st); 26 27 /* return an engine token */ 28 *et = &et6000EngineToken; 29 return B_OK; 30 } 31 /*****************************************************************************/ 32 status_t RELEASE_ENGINE(engine_token *et, sync_token *st) { 33 /* update the sync token, if any */ 34 if (st) { 35 st->engine_id = et->engine_id; 36 st->counter = si->engine.count; 37 } 38 39 /* release the shared benaphore */ 40 RELEASE_BEN(si->engine.lock) 41 return B_OK; 42 } 43 /*****************************************************************************/ 44 void WAIT_ENGINE_IDLE(void) { 45 et6000aclWaitIdle(); 46 /* note our current possition */ 47 si->engine.lastIdle = si->engine.count; 48 } 49 /*****************************************************************************/ 50 status_t GET_SYNC_TOKEN(engine_token *et, sync_token *st) { 51 st->engine_id = et->engine_id; 52 st->counter = si->engine.count; 53 return B_OK; 54 } 55 /*****************************************************************************/ 56 status_t SYNC_TO_TOKEN(sync_token *st) { 57 WAIT_ENGINE_IDLE(); 58 si->engine.lastIdle = st->counter; 59 return B_OK; 60 } 61 /*****************************************************************************/ 62