xref: /haiku/src/add-ons/accelerants/radeon_hd/engine.cpp (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1 /*
2  * Copyright 2006-2011, Haiku, Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Axel Dörfler, axeld@pinc-software.de
7  *		Alexander von Gluck IV, kallisti5@unixzen.com
8  */
9 
10 
11 #include <Debug.h>
12 
13 #include "accelerant.h"
14 #include "accelerant_protos.h"
15 
16 
17 #undef TRACE
18 
19 #define TRACE_ENGINE
20 #ifdef TRACE_ENGINE
21 #	define TRACE(x...) _sPrintf("radeon_hd: " x)
22 #else
23 #	define TRACE(x...) ;
24 #endif
25 
26 
27 static engine_token sEngineToken = {1, 0 /*B_2D_ACCELERATION*/, NULL};
28 
29 
30 //	#pragma mark - engine management
31 
32 
33 uint32
34 radeon_accelerant_engine_count(void)
35 {
36 	TRACE("%s\n", __func__);
37 	return 1;
38 }
39 
40 
41 status_t
42 radeon_acquire_engine(uint32 capabilities, uint32 maxWait,
43 	sync_token* syncToken, engine_token** _engineToken)
44 {
45 	TRACE("%s\n", __func__);
46 	*_engineToken = &sEngineToken;
47 
48 	if (acquire_lock(&gInfo->shared_info->engine_lock) != B_OK)
49 		return B_ERROR;
50 
51 	return B_OK;
52 }
53 
54 
55 status_t
56 radeon_release_engine(engine_token* engineToken, sync_token* syncToken)
57 {
58 	TRACE("%s\n", __func__);
59 	if (syncToken != NULL)
60 		syncToken->engine_id = engineToken->engine_id;
61 
62 	release_lock(&gInfo->shared_info->engine_lock);
63 	return B_OK;
64 }
65