summaryrefslogtreecommitdiffstats
path: root/libs/rs
diff options
context:
space:
mode:
authorAlex Sakhartchouk <alexst@google.com>2011-04-06 10:57:51 -0700
committerJason Sams <rjsams@android.com>2011-04-25 14:30:27 -0700
commite7c4a7565c7f8c8fc1ec92dc0692577fcc474750 (patch)
treed43d472a9207a28ff03141e6920a21fc6012b44c /libs/rs
parent466e3a22db283958a1da71cc60a23ce3976a3659 (diff)
downloadframeworks_base-e7c4a7565c7f8c8fc1ec92dc0692577fcc474750.zip
frameworks_base-e7c4a7565c7f8c8fc1ec92dc0692577fcc474750.tar.gz
frameworks_base-e7c4a7565c7f8c8fc1ec92dc0692577fcc474750.tar.bz2
Modifying libRS internal communication to handle network rendering.
Change-Id: I8c8b3cc3402ecf4ba774e1d668dce25ff0af0e5a
Diffstat (limited to 'libs/rs')
-rw-r--r--libs/rs/rs.spec31
-rw-r--r--libs/rs/rsAllocation.cpp2
-rw-r--r--libs/rs/rsContext.cpp6
-rw-r--r--libs/rs/rsElement.cpp9
-rw-r--r--libs/rs/rsFont.cpp11
-rw-r--r--libs/rs/rsHandcode.h16
-rw-r--r--libs/rs/rsScriptC.cpp7
-rw-r--r--libs/rs/spec.l14
8 files changed, 46 insertions, 50 deletions
diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec
index a7f473c..dac5cec 100644
--- a/libs/rs/rs.spec
+++ b/libs/rs/rs.spec
@@ -51,9 +51,8 @@ ContextDestroyWorker {
}
AssignName {
- param void *obj
+ param RsObjectBase obj
param const char *name
- param size_t len
}
ObjDestroy {
@@ -69,7 +68,6 @@ ElementCreate {
}
ElementCreate2 {
- param size_t count
param const RsElement * elements
param const char ** names
param const size_t * nameLengths
@@ -80,7 +78,6 @@ ElementCreate2 {
AllocationCopyToBitmap {
param RsAllocation alloc
param void * data
- param size_t dataLen
}
@@ -90,7 +87,6 @@ Allocation1DData {
param uint32_t lod
param uint32_t count
param const void *data
- param uint32_t bytes
handcodeApi
togglePlay
}
@@ -101,7 +97,6 @@ Allocation1DElementData {
param uint32_t lod
param const void *data
param uint32_t comp_offset
- param uint32_t bytes
handcodeApi
togglePlay
}
@@ -115,7 +110,6 @@ Allocation2DData {
param uint32_t w
param uint32_t h
param const void *data
- param uint32_t bytes
}
Allocation2DElementData {
@@ -126,7 +120,6 @@ Allocation2DElementData {
param RsAllocationCubemapFace face
param const void *data
param uint32_t element_offset
- param uint32_t bytes
}
AllocationGenerateMipmaps {
@@ -184,7 +177,6 @@ ScriptBindAllocation {
ScriptSetTimeZone {
param RsScript s
param const char * timeZone
- param uint32_t length
}
@@ -197,7 +189,6 @@ ScriptInvokeV {
param RsScript s
param uint32_t slot
param const void * data
- param uint32_t dataLen
handcodeApi
togglePlay
}
@@ -236,7 +227,6 @@ ScriptSetVarV {
param RsScript s
param uint32_t slot
param const void * data
- param uint32_t dataLen
handcodeApi
togglePlay
}
@@ -246,7 +236,6 @@ ScriptCCreate {
param const char * resName
param const char * cacheDir
param const char * text
- param uint32_t length
ret RsScript
}
@@ -294,17 +283,13 @@ ProgramBindSampler {
ProgramFragmentCreate {
param const char * shaderText
- param uint32_t shaderLength
param const uint32_t * params
- param uint32_t paramLength
ret RsProgramFragment
}
ProgramVertexCreate {
param const char * shaderText
- param uint32_t shaderLength
param const uint32_t * params
- param uint32_t paramLength
ret RsProgramVertex
}
@@ -319,8 +304,7 @@ FontCreateFromMemory {
param const char *name
param float fontSize
param uint32_t dpi
- param const void *data
- param uint32_t dataLen
+ param const void *data
ret RsFont
}
@@ -346,14 +330,3 @@ MeshBindVertex {
MeshInitVertexAttribs {
param RsMesh mesh
}
-
-AnimationCreate {
- param const float *inValues
- param const float *outValues
- param uint32_t valueCount
- param RsAnimationInterpolation interp
- param RsAnimationEdge pre
- param RsAnimationEdge post
- ret RsAnimation
- }
-
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index 6b37e03..a759004 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -780,7 +780,7 @@ void rsi_Allocation2DData(Context *rsc, RsAllocation va, uint32_t xoff, uint32_t
a->data(rsc, xoff, yoff, lod, face, w, h, data, sizeBytes);
}
-void rsi_AllocationRead(Context *rsc, RsAllocation va, void *data) {
+void rsi_AllocationRead(Context *rsc, RsAllocation va, void *data, size_t data_length) {
Allocation *a = static_cast<Allocation *>(va);
a->read(data);
}
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index 20fa367..0ca892d 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -705,9 +705,9 @@ void rsi_ContextBindFont(Context *rsc, RsFont vfont) {
rsc->setFont(font);
}
-void rsi_AssignName(Context *rsc, void * obj, const char *name, uint32_t len) {
+void rsi_AssignName(Context *rsc, RsObjectBase obj, const char *name, uint32_t name_length) {
ObjectBase *ob = static_cast<ObjectBase *>(obj);
- rsc->assignName(ob, name, len);
+ rsc->assignName(ob, name, name_length);
}
void rsi_ObjDestroy(Context *rsc, void *optr) {
@@ -724,7 +724,7 @@ void rsi_ContextResume(Context *rsc) {
rsc->resume();
}
-void rsi_ContextSetSurface(Context *rsc, uint32_t w, uint32_t h, ANativeWindow *sur) {
+void rsi_ContextSetSurface(Context *rsc, uint32_t w, uint32_t h, ANativeWindow *sur, size_t sur_length) {
rsc->setSurface(w, h, sur);
}
diff --git a/libs/rs/rsElement.cpp b/libs/rs/rsElement.cpp
index 477cb61..d5d5ca5 100644
--- a/libs/rs/rsElement.cpp
+++ b/libs/rs/rsElement.cpp
@@ -348,12 +348,15 @@ RsElement rsi_ElementCreate(Context *rsc,
}
RsElement rsi_ElementCreate2(Context *rsc,
- size_t count,
const RsElement * ein,
+ size_t ein_length,
const char ** names,
+ size_t names_length,
const size_t * nameLengths,
- const uint32_t * arraySizes) {
- const Element *e = Element::create(rsc, count, (const Element **)ein, names, nameLengths, arraySizes);
+ size_t nameLengths_length,
+ const uint32_t * arraySizes,
+ size_t arraySizes_length) {
+ const Element *e = Element::create(rsc, ein_length, (const Element **)ein, names, nameLengths, arraySizes);
e->incUserRef();
return (RsElement)e;
}
diff --git a/libs/rs/rsFont.cpp b/libs/rs/rsFont.cpp
index c30b857..b7b85b6 100644
--- a/libs/rs/rsFont.cpp
+++ b/libs/rs/rsFont.cpp
@@ -827,7 +827,9 @@ bool FontState::CacheTextureLine::fitBitmap(FT_Bitmap_ *bitmap, uint32_t *retOri
namespace android {
namespace renderscript {
-RsFont rsi_FontCreateFromFile(Context *rsc, char const *name, float fontSize, uint32_t dpi) {
+RsFont rsi_FontCreateFromFile(Context *rsc,
+ char const *name, size_t name_length,
+ float fontSize, uint32_t dpi) {
Font *newFont = Font::create(rsc, name, fontSize, dpi);
if (newFont) {
newFont->incUserRef();
@@ -835,8 +837,11 @@ RsFont rsi_FontCreateFromFile(Context *rsc, char const *name, float fontSize, ui
return newFont;
}
-RsFont rsi_FontCreateFromMemory(Context *rsc, char const *name, float fontSize, uint32_t dpi, const void *data, uint32_t dataLen) {
- Font *newFont = Font::create(rsc, name, fontSize, dpi, data, dataLen);
+RsFont rsi_FontCreateFromMemory(Context *rsc,
+ char const *name, size_t name_length,
+ float fontSize, uint32_t dpi,
+ const void *data, size_t data_length) {
+ Font *newFont = Font::create(rsc, name, fontSize, dpi, data, data_length);
if (newFont) {
newFont->incUserRef();
}
diff --git a/libs/rs/rsHandcode.h b/libs/rs/rsHandcode.h
index 57da10a..da51d95 100644
--- a/libs/rs/rsHandcode.h
+++ b/libs/rs/rsHandcode.h
@@ -7,7 +7,7 @@ static inline void rsHCAPI_ContextFinish (RsContext rsc) {
io->mToCore.commitSync(RS_CMD_ID_ContextFinish, size);
}
-static inline void rsHCAPI_ScriptInvokeV (RsContext rsc, RsScript va, uint32_t slot, const void * data, uint32_t sizeBytes) {
+static inline void rsHCAPI_ScriptInvokeV (RsContext rsc, RsScript va, uint32_t slot, const void * data, size_t sizeBytes) {
ThreadIO *io = &((Context *)rsc)->mIO;
uint32_t size = sizeof(RS_CMD_ScriptInvokeV);
if (sizeBytes < DATA_SYNC_SIZE) {
@@ -16,7 +16,7 @@ static inline void rsHCAPI_ScriptInvokeV (RsContext rsc, RsScript va, uint32_t s
RS_CMD_ScriptInvokeV *cmd = static_cast<RS_CMD_ScriptInvokeV *>(io->mToCore.reserve(size));
cmd->s = va;
cmd->slot = slot;
- cmd->dataLen = sizeBytes;
+ cmd->data_length = sizeBytes;
cmd->data = data;
if (sizeBytes < DATA_SYNC_SIZE) {
cmd->data = (void *)(cmd+1);
@@ -28,7 +28,7 @@ static inline void rsHCAPI_ScriptInvokeV (RsContext rsc, RsScript va, uint32_t s
}
-static inline void rsHCAPI_ScriptSetVarV (RsContext rsc, RsScript va, uint32_t slot, const void * data, uint32_t sizeBytes) {
+static inline void rsHCAPI_ScriptSetVarV (RsContext rsc, RsScript va, uint32_t slot, const void * data, size_t sizeBytes) {
ThreadIO *io = &((Context *)rsc)->mIO;
uint32_t size = sizeof(RS_CMD_ScriptSetVarV);
if (sizeBytes < DATA_SYNC_SIZE) {
@@ -37,7 +37,7 @@ static inline void rsHCAPI_ScriptSetVarV (RsContext rsc, RsScript va, uint32_t s
RS_CMD_ScriptSetVarV *cmd = static_cast<RS_CMD_ScriptSetVarV *>(io->mToCore.reserve(size));
cmd->s = va;
cmd->slot = slot;
- cmd->dataLen = sizeBytes;
+ cmd->data_length = sizeBytes;
cmd->data = data;
if (sizeBytes < DATA_SYNC_SIZE) {
cmd->data = (void *)(cmd+1);
@@ -49,7 +49,7 @@ static inline void rsHCAPI_ScriptSetVarV (RsContext rsc, RsScript va, uint32_t s
}
static inline void rsHCAPI_Allocation1DData (RsContext rsc, RsAllocation va, uint32_t xoff, uint32_t lod,
- uint32_t count, const void * data, uint32_t sizeBytes) {
+ uint32_t count, const void * data, size_t sizeBytes) {
ThreadIO *io = &((Context *)rsc)->mIO;
uint32_t size = sizeof(RS_CMD_Allocation1DData);
if (sizeBytes < DATA_SYNC_SIZE) {
@@ -61,7 +61,7 @@ static inline void rsHCAPI_Allocation1DData (RsContext rsc, RsAllocation va, uin
cmd->lod = lod;
cmd->count = count;
cmd->data = data;
- cmd->bytes = sizeBytes;
+ cmd->data_length = sizeBytes;
if (sizeBytes < DATA_SYNC_SIZE) {
cmd->data = (void *)(cmd+1);
memcpy(cmd+1, data, sizeBytes);
@@ -72,7 +72,7 @@ static inline void rsHCAPI_Allocation1DData (RsContext rsc, RsAllocation va, uin
}
static inline void rsHCAPI_Allocation1DElementData (RsContext rsc, RsAllocation va, uint32_t x, uint32_t lod,
- const void * data, uint32_t comp_offset, uint32_t sizeBytes) {
+ const void * data, size_t sizeBytes, uint32_t comp_offset) {
ThreadIO *io = &((Context *)rsc)->mIO;
uint32_t size = sizeof(RS_CMD_Allocation1DElementData);
if (sizeBytes < DATA_SYNC_SIZE) {
@@ -84,7 +84,7 @@ static inline void rsHCAPI_Allocation1DElementData (RsContext rsc, RsAllocation
cmd->lod = lod;
cmd->data = data;
cmd->comp_offset = comp_offset;
- cmd->bytes = sizeBytes;
+ cmd->data_length = sizeBytes;
if (sizeBytes < DATA_SYNC_SIZE) {
cmd->data = (void *)(cmd+1);
memcpy(cmd+1, data, sizeBytes);
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index c379b8b..6d0701d 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -267,12 +267,13 @@ namespace android {
namespace renderscript {
RsScript rsi_ScriptCCreate(Context *rsc,
- const char *resName, const char *cacheDir,
- const char *text, uint32_t len)
+ const char *resName, size_t resName_length,
+ const char *cacheDir, size_t cacheDir_length,
+ const char *text, uint32_t text_length)
{
ScriptC *s = new ScriptC(rsc);
- if (!s->runCompiler(rsc, resName, cacheDir, (uint8_t *)text, len)) {
+ if (!s->runCompiler(rsc, resName, cacheDir, (uint8_t *)text, text_length)) {
// Error during compile, destroy s and return null.
delete s;
return NULL;
diff --git a/libs/rs/spec.l b/libs/rs/spec.l
index 6a9010fe..c8af891 100644
--- a/libs/rs/spec.l
+++ b/libs/rs/spec.l
@@ -20,6 +20,19 @@ ID [a-zA-Z_][a-zA-Z0-9_]*
int typeNextState;
+ void checkPointerType() {
+ VarType *lastType = currType;
+ if (lastType->ptrLevel) {
+ currType = &apis[apiCount].params[apis[apiCount].paramCount];
+ currType->type = 4;
+ sprintf(currType->typeName, "%s", "size_t");
+ if (lastType->name[0]) {
+ sprintf(currType->name, "%s_length", lastType->name);
+ }
+ apis[apiCount].paramCount++;
+ }
+ }
+
extern "C" int yylex();
%%
@@ -145,6 +158,7 @@ ID [a-zA-Z_][a-zA-Z0-9_]*
<api_entry_param>{ID} {
memcpy(currType->name, yytext, yyleng);
+ checkPointerType();
BEGIN(api_entry2);
}