rsdCore.h revision cdfdb8f2cdf4668c476cac842212892b2505ff3f
1/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef RSD_CORE_H
18#define RSD_CORE_H
19
20#include <rs_hal.h>
21#include <bcc/bcc.h>
22
23#include "rsMutex.h"
24#include "rsSignal.h"
25
26
27typedef void (* InvokeFunc_t)(void);
28typedef void (*WorkerCallback_t)(void *usr, uint32_t idx);
29
30typedef struct RsHalRec {
31    uint32_t version_major;
32    uint32_t version_minor;
33
34    struct Workers {
35        volatile int mRunningCount;
36        volatile int mLaunchCount;
37        uint32_t mCount;
38        pthread_t *mThreadId;
39        pid_t *mNativeThreadId;
40        android::renderscript::Signal mCompleteSignal;
41
42        android::renderscript::Signal *mLaunchSignals;
43        WorkerCallback_t mLaunchCallback;
44        void *mLaunchData;
45    };
46    Workers mWorkers;
47    bool mExit;
48} RsHal;
49
50
51
52void rsdLaunchThreads(android::renderscript::Context *rsc, WorkerCallback_t cbk, void *data);
53
54#endif
55
56