Native C program for Android, using PVRScope

This topic contains 4 replies, has 3 voices, and was last updated by  kevin 1 year, 11 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #51259

    Keun-Ho
    Member

    Hello. I’m trying to use PVRScope for the native C program (command line program) on Android.
    (My device is Odroid-XU with Android 4.2.2)

    I have tried to compile the example code of PVRScopeStats, included in PVRScope’s user manual.

    And, I found some example for Android NDK in
    http://imgtec.eetrend.com/sites/imgtec.eetrend.com/files/download/201403/1765-3054-tuxingfenxiandroid.pdf

    Thus now trying to use Android NDK for compling of the example.
    (In Windows(cygwin), using the Android NDK ver. r10e)
    (Application.mk contains only APP_ABI := armeabi-v7a)

    Below is my Android.mk for ndk-build command.


    LOCAL_PATH := /home/admin/project/jni

    include $(CLEAR_VARS)
    LOCAL_MODULE:= PVRScope
    LOCAL_SRC_FILES := /home/admin/PVRScopeDeveloper/Linux_armv7/libPVRScopeDeveloper.a
    include $(PREBUILT_STATIC_LIBRARY)

    include $(CLEAR_VARS)
    LOCAL_MODULE := example
    LOCAL_SRC_FILES := example.c
    LOCAL_C_INCLUDES := /home/admin/PVRScopeDeveloper/Linux_armv7/
    LOCAL_STATIC_LIBRARIES := PVRScope
    LOCAL_LDFLAGS += -Wl,–no-undefined
    LOCAL_CPPFLAGS := -std=c99 -Wall
    include $(BUILD_EXECUTABLE)


    With these settings, ndk-build shows error messages below.


    $ ndk-build
    [armeabi-v7a] Compile thumb : example <= example.c
    C:/cygwin/home/admin/project/jni/example.c:21:13: error: unknown type name ‘SPVRScopeImplData’
    bool PSInit(SPVRScopeImplData **ppsPVRScopeData, SPVRScopeCounterDef **ppsCounters, SPVRScopeCounterReading* const psReading, unsigned int* const pnCount)
    ^
    C:/cygwin/home/admin/project/jni/example.c:21:50: error: unknown type name ‘SPVRScopeCounterDef’
    bool PSInit(SPVRScopeImplData **ppsPVRScopeData, SPVRScopeCounterDef **ppsCounters, SPVRScopeCounterReading* const psReading, unsigned int* const pnCount)
    ^
    C:/cygwin/home/admin/project/jni/example.c:21:85: error: unknown type name ‘SPVRScopeCounterReading’
    bool PSInit(SPVRScopeImplData **ppsPVRScopeData, SPVRScopeCounterDef **ppsCounters, SPVRScopeCounterReading* const psReading, unsigned int* const pnCount)
    ^
    C:/cygwin/home/admin/project/jni/example.c: In function ‘main’:
    C:/cygwin/home/admin/project/jni/example.c:45:1: error: unknown type name ‘SPVRScopeImplData’
    SPVRScopeImplData *psData;
    ^
    C:/cygwin/home/admin/project/jni/example.c:47:1: error: unknown type name ‘SPVRScopeCounterDef’
    SPVRScopeCounterDef *psCounters;
    ^
    C:/cygwin/home/admin/project/jni/example.c:52:1: error: unknown type name ‘SPVRScopeCounterReading’
    SPVRScopeCounterReading sReading;
    ^
    C:/cygwin/home/admin/project/jni/example.c:64:37: error: request for member ‘nGroup’ in something not a structure or union
    printf(” Group %d %s”, psCounters.nGroup, psCounters.pszName);
    ^
    C:/cygwin/home/admin/project/jni/example.c:64:59: error: request for member ‘pszName’ in something not a structure or union
    printf(” Group %d %s”, psCounters.nGroup, psCounters.pszName);
    ^
    C:/cygwin/home/admin/project/jni/example.c:77:1: warning: passing argument 1 of ‘PVRScopeSetGroup’ from incompatible pointer type [enabled by default]
    PVRScopeSetGroup(psData, uActiveGroupSelect); bActiveGroupChanged = false;
    ^
    In file included from C:/cygwin/home/admin/project/jni/example.c:19:0:
    C:/cygwin/home/admin/PVRScopeDeveloper/Linux_armv7/PVRScopeStats.h:219:6: note: expected ‘struct SPVRScopeImplData * const’ but argument is of type ‘int *’
    void PVRScopeSetGroup(
    ^
    C:/cygwin/home/admin/project/jni/example.c:83:1: warning: passing argument 1 of ‘PVRScopeReadCounters’ from incompatible pointer type [enabled by default]
    PVRScopeReadCounters(psData, NULL);
    ^
    In file included from C:/cygwin/home/admin/project/jni/example.c:19:0:
    C:/cygwin/home/admin/PVRScopeDeveloper/Linux_armv7/PVRScopeStats.h:209:5: note: expected ‘struct SPVRScopeImplData * const’ but argument is of type ‘int *’
    int PVRScopeReadCounters(
    ^
    C:/cygwin/home/admin/project/jni/example.c:90:1: warning: passing argument 1 of ‘PVRScopeReadCounters’ from incompatible pointer type [enabled by default]
    if(PVRScopeReadCounters(psData, &sReading))
    ^
    In file included from C:/cygwin/home/admin/project/jni/example.c:19:0:
    C:/cygwin/home/admin/PVRScopeDeveloper/Linux_armv7/PVRScopeStats.h:209:5: note: expected ‘struct SPVRScopeImplData * const’ but argument is of type ‘int *’
    int PVRScopeReadCounters(
    ^
    C:/cygwin/home/admin/project/jni/example.c:90:1: warning: passing argument 2 of ‘PVRScopeReadCounters’ from incompatible pointer type [enabled by default]
    if(PVRScopeReadCounters(psData, &sReading))
    ^
    In file included from C:/cygwin/home/admin/project/jni/example.c:19:0:
    C:/cygwin/home/admin/PVRScopeDeveloper/Linux_armv7/PVRScopeStats.h:209:5: note: expected ‘struct SPVRScopeCounterReading * const’ but argument is of type ‘int *’
    int PVRScopeReadCounters(
    ^
    C:/cygwin/home/admin/project/jni/example.c:94:16: error: request for member ‘nValueCnt’ in something not a structure or union
    if(i < sReading.nValueCnt) {
    ^
    C:/cygwin/home/admin/project/jni/example.c:96:25: error: request for member ‘pszName’ in something not a structure or union
    if (strcmp(psCounters.pszName, “GPU task load: 3D core”) == 0) {
    ^
    C:/cygwin/home/admin/project/jni/example.c:97:34: error: request for member ‘pszName’ in something not a structure or union
    printf(“%s : %f\%”, psCounters.pszName,
    ^
    C:/cygwin/home/admin/project/jni/example.c:98:9: error: request for member ‘pfValueBuf’ in something not a structure or union
    sReading.pfValueBuf);
    ^
    C:/cygwin/home/admin/project/jni/example.c:101:30: error: request for member ‘pszName’ in something not a structure or union
    else if (strcmp(psCounters.pszName, “GPU task load: TA core”) == 0)
    ^
    C:/cygwin/home/admin/project/jni/example.c:103:34: error: request for member ‘pszName’ in something not a structure or union
    printf(“%s : %f\%”, psCounters.pszName,
    ^
    C:/cygwin/home/admin/project/jni/example.c:104:9: error: request for member ‘pfValueBuf’ in something not a structure or union
    sReading.pfValueBuf);
    ^
    C:/cygwin/home/admin/project/jni/example.c:114:1: warning: passing argument 1 of ‘PVRScopeDeInitialise’ from incompatible pointer type [enabled by default]
    PVRScopeDeInitialise(&psData, &psCounters, &sReading);
    ^
    In file included from C:/cygwin/home/admin/project/jni/example.c:19:0:
    C:/cygwin/home/admin/PVRScopeDeveloper/Linux_armv7/PVRScopeStats.h:148:6: note: expected ‘struct SPVRScopeImplData **’ but argument is of type ‘int **’
    void PVRScopeDeInitialise(
    ^
    C:/cygwin/home/admin/project/jni/example.c:114:1: warning: passing argument 2 of ‘PVRScopeDeInitialise’ from incompatible pointer type [enabled by default]
    PVRScopeDeInitialise(&psData, &psCounters, &sReading);
    ^
    In file included from C:/cygwin/home/admin/project/jni/example.c:19:0:
    C:/cygwin/home/admin/PVRScopeDeveloper/Linux_armv7/PVRScopeStats.h:148:6: note: expected ‘struct SPVRScopeCounterDef **’ but argument is of type ‘int **’
    void PVRScopeDeInitialise(
    ^
    C:/cygwin/home/admin/project/jni/example.c:114:1: warning: passing argument 3 of ‘PVRScopeDeInitialise’ from incompatible pointer type [enabled by default]
    PVRScopeDeInitialise(&psData, &psCounters, &sReading);
    ^
    In file included from C:/cygwin/home/admin/project/jni/example.c:19:0:
    C:/cygwin/home/admin/PVRScopeDeveloper/Linux_armv7/PVRScopeStats.h:148:6: note: expected ‘struct SPVRScopeCounterReading * const’ but argument is of type ‘int *’
    void PVRScopeDeInitialise(
    ^


    It seems that the compiler could not recognized the static library(.a file) of PVRScope.
    (I have tried other ABIs, but it does not work.)

    Please give me some advice.

    Any advice will help me.

    Thank you for your reading.

    #51643

    Joe Davis
    Member

    Hi,

    Thanks for reporting the issue. Which version of the SDK have you taken the PVRScope libraries from? 3.5? Would you be able to share the source code of your example with us to reproduce the issue?

    A fix was implemented a while ago after another user reported C compatibility issues. If there are still problems with the latest release, I’ll file a bug against the library for you.

    Thanks,
    Joe

    #51645

    Keun-Ho
    Member

    Thank you for your reply.

    I have used PVRScope libraries from 3.5.

    From the example code(for PVRScopeStats) of PVRscope’s manual, some logging functions are replaced by printf[].

    Below is the source code.

    Regards,

    Hwang.

    ex

    Attachments:
    You must be logged in to view attached files.
    #51661

    Joe Davis
    Member

    Thanks for confirming the version of the library and sharing your source code. We will follow up with you once we have reproduced the issue.

    Thanks,
    Joe

    #51687

    kevin
    Member

    Hi Keun-Ho,
    You can see that we define struct like this in our SDK:

    
    struct SPVRScopeCounterDef
    {
        const char      *pszName;                   ///< Counter name, null terminated
        int    nBoolPercentage;    ///< true if the counter is a percentage
        unsigned int    nGroup;                     ///< The counter group that the counter is in.
    };
    

    so the example code should like this:
    struct SPVRScopeCounterDef *psCounters;
    The modified C file was attached.(PVRScopeStats.c)
    2. the Android.mk file should be modified like the following:

    ++include $(CLEAR_VARS)
    ++LOCAL_MODULE:= supc++
    ++LOCAL_SRC_FILES := /home/kevin/Android/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/libsupc++.a
    ++include $(PREBUILT_STATIC_LIBRARY)

    ++LOCAL_STATIC_LIBRARIES := PVRScope supc++
    ++LOCAL_LDFLAGS += -llog

    After these change the code can be built successfully.:D

    Thanks,
    Kevin

    Attachments:
    You must be logged in to view attached files.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic.