0
votes

Hello guys another C++ programming question. Again be easy on me as I'm just starting to learn C++. I'm getting an error at compile time that shows:

frameworks/native/libs/gui/SurfaceTextureClient.cpp: In member function 'virtual int >android::SurfaceTextureClient::setUsage(uint32_t)': frameworks/native/libs/gui/SurfaceTextureClient.cpp:498:20: error: >'GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY' was not declared in this scope frameworks/native/libs/gui/SurfaceTextureClient.cpp:503:23: error: >'GRALLOC_USAGE_PRIVATE_EXTERNAL_BLOCK' was not declared in this scope frameworks/native/libs/gui/SurfaceTextureClient.cpp:505:30: error: >'GRALLOC_USAGE_PRIVATE_EXTERNAL_CC' was not declared in this scope

Here is the 'SurfaceTextureClient.cpp' file:

 17 #define LOG_TAG "SurfaceTextureClient"
 18 #define ATRACE_TAG ATRACE_TAG_GRAPHICS
 19 //#define LOG_NDEBUG 0
 20
 21 #include <android/native_window.h>
 22 
 23 #include <utils/Log.h>
 24 #include <utils/Trace.h>
 25
 26 #include <gui/ISurfaceComposer.h>
 27 #include <gui/SurfaceComposerClient.h>
 28 #include <gui/SurfaceTexture.h>
 29 #include <gui/SurfaceTextureClient.h>
 30
 31 #include <private/gui/ComposerService.h>
 32 #ifdef QCOMHW
 33 #include <gralloc_priv.h>
 34 #endif
 35 
 36 namespace android {
 37 
 38 SurfaceTextureClient::SurfaceTextureClient(
 39         const sp<ISurfaceTexture>& surfaceTexture)
 40 {
 41     SurfaceTextureClient::init();
 42     SurfaceTextureClient::setISurfaceTexture(surfaceTexture);
 43 }
 44 
 45 // see SurfaceTextureClient.h
 46 SurfaceTextureClient::SurfaceTextureClient(const
 47          sp<SurfaceTexture>& surfaceTexture)
 48 {
 49     SurfaceTextureClient::init();
 50     SurfaceTextureClient::setISurfaceTexture(surfaceTexture->getBufferQueue());
 51 }
 52
 53 SurfaceTextureClient::SurfaceTextureClient() {
 54     SurfaceTextureClient::init();
 55 }
 56 
 57 SurfaceTextureClient::~SurfaceTextureClient() { 
 58     if (mConnectedToCpu) {
 59         SurfaceTextureClient::disconnect(NATIVE_WINDOW_API_CPU);
 60
 61 }

494 int SurfaceTextureClient::setUsage(uint32_t reqUsage)
493 {
494     ALOGV("SurfaceTextureClient::setUsage");
495     Mutex::Autolock lock(mMutex);
496 
497 #ifdef QCOMHW
498     if (reqUsage & GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY) {
499         //Set explicitly, since reqUsage may have other values.
500         mReqExtUsage = GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY;
501         //This flag is never independent. Always an add-on to
502         //GRALLOC_USAGE_EXTERNAL_ONLY
503         if(reqUsage & GRALLOC_USAGE_PRIVATE_EXTERNAL_BLOCK) {
504             mReqExtUsage |= GRALLOC_USAGE_PRIVATE_EXTERNAL_BLOCK;
505         } else if(reqUsage & GRALLOC_USAGE_PRIVATE_EXTERNAL_CC) {
506             mReqExtUsage |= GRALLOC_USAGE_PRIVATE_EXTERNAL_CC;
507         }
508     }
509 #endif

If more info is needed let me know. Fixed a previous error with this compile. Not sure what to do here with this one.

1
Where is GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY declared?Luchian Grigore
Here is the link to a previous post with the gralloc... header file:dru
Well.. in that file you dont have GRALLOC_USAGE_PRIVATE_EXTERNAL_ONLY, but only GRALLOC_USAGE_EXTERNAL_ONLYRoman Saveljev
Not sure what to do from here. Should I assume a missing header?dru

1 Answers

0
votes

Well I found the solution to the problem I think lol. There was another gralloc_priv.h file in source folder under a different directory and copied over the declarations in that header file for the unscoped members and it went through fine. If anyone is coming across this problem let me know and I'll show you where I found the files.