vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / accelerants / radeon_hd / engine.cpp
blobf123c50c63d9de0b53331ed16a23518e39d48352
1 /*
2 * Copyright 2006-2011, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Axel Dörfler, axeld@pinc-software.de
7 * Alexander von Gluck IV, kallisti5@unixzen.com
8 */
11 #include <Debug.h>
13 #include "accelerant.h"
14 #include "accelerant_protos.h"
17 #undef TRACE
19 #define TRACE_ENGINE
20 #ifdef TRACE_ENGINE
21 # define TRACE(x...) _sPrintf("radeon_hd: " x)
22 #else
23 # define TRACE(x...) ;
24 #endif
27 static engine_token sEngineToken = {1, 0 /*B_2D_ACCELERATION*/, NULL};
30 // #pragma mark - engine management
33 uint32
34 radeon_accelerant_engine_count(void)
36 TRACE("%s\n", __func__);
37 return 1;
41 status_t
42 radeon_acquire_engine(uint32 capabilities, uint32 maxWait,
43 sync_token* syncToken, engine_token** _engineToken)
45 TRACE("%s\n", __func__);
46 *_engineToken = &sEngineToken;
48 if (acquire_lock(&gInfo->shared_info->engine_lock) != B_OK)
49 return B_ERROR;
51 return B_OK;
55 status_t
56 radeon_release_engine(engine_token* engineToken, sync_token* syncToken)
58 TRACE("%s\n", __func__);
59 if (syncToken != NULL)
60 syncToken->engine_id = engineToken->engine_id;
62 release_lock(&gInfo->shared_info->engine_lock);
63 return B_OK;