Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 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 | #include "rsContext.h" |
| 18 | |
| 19 | #include <utils/Log.h> |
| 20 | |
| 21 | #include "rsThreadIO.h" |
| 22 | |
| 23 | using namespace android; |
| 24 | using namespace android::renderscript; |
| 25 | |
| 26 | ThreadIO *android::renderscript::gIO = NULL; |
| 27 | |
| 28 | ThreadIO::ThreadIO() |
| 29 | { |
| 30 | mToCore.init(16 * 1024); |
| 31 | } |
| 32 | |
| 33 | ThreadIO::~ThreadIO() |
| 34 | { |
| 35 | } |
| 36 | |
Jason Sams | 732f1c0 | 2009-06-18 16:58:42 -0700 | [diff] [blame^] | 37 | bool ThreadIO::playCoreCommands(Context *con, bool waitForCommand) |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 38 | { |
| 39 | //LOGE("playCoreCommands 1"); |
| 40 | uint32_t cmdID = 0; |
| 41 | uint32_t cmdSize = 0; |
Jason Sams | a44cb29 | 2009-06-04 17:58:03 -0700 | [diff] [blame] | 42 | bool ret = false; |
Jason Sams | 732f1c0 | 2009-06-18 16:58:42 -0700 | [diff] [blame^] | 43 | while(!mToCore.isEmpty() || waitForCommand) { |
Jason Sams | a44cb29 | 2009-06-04 17:58:03 -0700 | [diff] [blame] | 44 | ret = true; |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 45 | //LOGE("playCoreCommands 2"); |
| 46 | const void * data = mToCore.get(&cmdID, &cmdSize); |
Jason Sams | 732f1c0 | 2009-06-18 16:58:42 -0700 | [diff] [blame^] | 47 | waitForCommand = false; |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 48 | //LOGE("playCoreCommands 3 %i %i", cmdID, cmdSize); |
| 49 | |
| 50 | gPlaybackFuncs[cmdID](con, data); |
| 51 | //LOGE("playCoreCommands 4"); |
| 52 | |
| 53 | mToCore.next(); |
| 54 | //LOGE("playCoreCommands 5"); |
| 55 | } |
Jason Sams | a44cb29 | 2009-06-04 17:58:03 -0700 | [diff] [blame] | 56 | return ret; |
Jason Sams | 326e0dd | 2009-05-22 14:03:28 -0700 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | |