blob: ed800a3649394c59bf435a2521123d5715b92a36 [file] [log] [blame]
Jason Samsdbe66d62012-09-17 13:54:41 -07001/*
Jason Sams709a0972012-11-15 18:18:04 -08002 * Copyright (C) 2011-2012 The Android Open Source Project
Jason Samsdbe66d62012-09-17 13:54:41 -07003 *
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#include "rsdCore.h"
Jason Sams709a0972012-11-15 18:18:04 -080018#include "../cpu_ref/rsd_cpu.h"
Jason Samsdbe66d62012-09-17 13:54:41 -070019
Jason Samsdbe66d62012-09-17 13:54:41 -070020
21#include "rsScript.h"
22#include "rsScriptGroup.h"
23#include "rsdScriptGroup.h"
24#include "rsdBcc.h"
Jason Samsbee28c62012-10-25 18:15:54 -070025#include "rsdAllocation.h"
Jason Samsdbe66d62012-09-17 13:54:41 -070026
27using namespace android;
28using namespace android::renderscript;
29
30
Yang Ni1ffd86b2015-01-07 09:16:40 -080031bool rsdScriptGroupInit(const Context *rsc, ScriptGroupBase *sg) {
Jason Sams709a0972012-11-15 18:18:04 -080032 RsdHal *dc = (RsdHal *)rsc->mHal.drv;
33
34 sg->mHal.drv = dc->mCpuRef->createScriptGroup(sg);
Chris Wailes44bef6f2014-08-12 13:51:10 -070035 return sg->mHal.drv != nullptr;
Jason Samsdbe66d62012-09-17 13:54:41 -070036}
37
Jason Sams709a0972012-11-15 18:18:04 -080038void rsdScriptGroupSetInput(const Context *rsc, const ScriptGroup *sg,
39 const ScriptKernelID *kid, Allocation *) {
Jason Samsdbe66d62012-09-17 13:54:41 -070040}
41
Jason Sams709a0972012-11-15 18:18:04 -080042void rsdScriptGroupSetOutput(const Context *rsc, const ScriptGroup *sg,
43 const ScriptKernelID *kid, Allocation *) {
Jason Samsdbe66d62012-09-17 13:54:41 -070044}
45
Yang Ni1ffd86b2015-01-07 09:16:40 -080046void rsdScriptGroupExecute(const Context *rsc, const ScriptGroupBase *sg) {
47 RsdCpuReference::CpuScriptGroupBase *sgi =
48 (RsdCpuReference::CpuScriptGroupBase *)sg->mHal.drv;
Jason Sams709a0972012-11-15 18:18:04 -080049 sgi->execute();
Jason Samsbee28c62012-10-25 18:15:54 -070050}
51
Yang Ni1ffd86b2015-01-07 09:16:40 -080052void rsdScriptGroupDestroy(const Context *rsc, const ScriptGroupBase *sg) {
53 RsdCpuReference::CpuScriptGroupBase *sgi =
54 (RsdCpuReference::CpuScriptGroupBase *)sg->mHal.drv;
Jason Sams709a0972012-11-15 18:18:04 -080055 delete sgi;
Jason Samsdbe66d62012-09-17 13:54:41 -070056}
57
Jason Samsa36c50a2014-06-17 12:06:06 -070058void rsdScriptGroupUpdateCachedObject(const Context *rsc,
59 const ScriptGroup *sg,
60 rs_script_group *obj)
61{
62 obj->p = sg;
63#ifdef __LP64__
Chris Wailes44bef6f2014-08-12 13:51:10 -070064 obj->r = nullptr;
65 if (sg != nullptr) {
Jason Samsa36c50a2014-06-17 12:06:06 -070066 obj->v1 = sg->mHal.drv;
67 } else {
Chris Wailes44bef6f2014-08-12 13:51:10 -070068 obj->v1 = nullptr;
Jason Samsa36c50a2014-06-17 12:06:06 -070069 }
Chris Wailes44bef6f2014-08-12 13:51:10 -070070 obj->v2 = nullptr;
Jason Samsa36c50a2014-06-17 12:06:06 -070071#endif
72}