diff options
author | Sushil Chauhan <sushilchauhan@codeaurora.org> | 2017-01-11 18:09:02 -0800 |
---|---|---|
committer | Sushil Chauhan <sushilchauhan@codeaurora.org> | 2017-01-11 18:51:08 -0800 |
commit | 1cc416f1223c47e75c2f7342f15d4e4cae09c976 (patch) | |
tree | 1f919b3ab8efe7170060bdf63ec6be17861fce80 /gpu_tonemapper | |
parent | eb5c32bed2b2a73c4b68efd3ad18ed9a76a2aeb1 (diff) | |
download | display-1cc416f1223c47e75c2f7342f15d4e4cae09c976.tar.gz |
gpu_tonemapper: Clear EGLImage mappings in Tonemapper
Tonemapper does not clear the eglImage/fd mappings in the destructor,
which leads to incorrect usage of those fds, when a tone map session
gets deleted and a new session gets created, leading to artifcats.
CRs-Fixed: 1104823
Change-Id: I9697eff93f9e5f150796a582f471246bca3b2816
Diffstat (limited to 'gpu_tonemapper')
-rw-r--r-- | gpu_tonemapper/EGLImageWrapper.cpp | 6 | ||||
-rw-r--r-- | gpu_tonemapper/EGLImageWrapper.h | 10 | ||||
-rw-r--r-- | gpu_tonemapper/TonemapFactory.cpp | 5 | ||||
-rw-r--r-- | gpu_tonemapper/Tonemapper.cpp | 14 | ||||
-rw-r--r-- | gpu_tonemapper/Tonemapper.h | 5 |
5 files changed, 23 insertions, 17 deletions
diff --git a/gpu_tonemapper/EGLImageWrapper.cpp b/gpu_tonemapper/EGLImageWrapper.cpp index eb0a2ca5..298475fe 100644 --- a/gpu_tonemapper/EGLImageWrapper.cpp +++ b/gpu_tonemapper/EGLImageWrapper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright 2015 The Android Open Source Project @@ -22,8 +22,6 @@ #include <gralloc_priv.h> #include <ui/GraphicBuffer.h> -std::map<int, EGLImageBuffer *> EGLImageWrapper::eglImageBufferMap; - //----------------------------------------------------------------------------- EGLImageBuffer *EGLImageWrapper::wrap(const void *pvt_handle) //----------------------------------------------------------------------------- @@ -65,4 +63,4 @@ void EGLImageWrapper::destroy() delete it->second; } eglImageBufferMap.clear(); -}
\ No newline at end of file +} diff --git a/gpu_tonemapper/EGLImageWrapper.h b/gpu_tonemapper/EGLImageWrapper.h index d7fc84ba..90aaf583 100644 --- a/gpu_tonemapper/EGLImageWrapper.h +++ b/gpu_tonemapper/EGLImageWrapper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright 2015 The Android Open Source Project @@ -24,11 +24,11 @@ #include "EGLImageBuffer.h" class EGLImageWrapper { - static std::map<int, EGLImageBuffer *> eglImageBufferMap; + std::map<int, EGLImageBuffer *> eglImageBufferMap; public: - static EGLImageBuffer *wrap(const void *pvt_handle); - static void destroy(); + EGLImageBuffer *wrap(const void *pvt_handle); + void destroy(); }; -#endif //__TONEMAPPER_EGLIMAGEWRAPPER_H__
\ No newline at end of file +#endif //__TONEMAPPER_EGLIMAGEWRAPPER_H__ diff --git a/gpu_tonemapper/TonemapFactory.cpp b/gpu_tonemapper/TonemapFactory.cpp index 81e9f7fc..cffc33a0 100644 --- a/gpu_tonemapper/TonemapFactory.cpp +++ b/gpu_tonemapper/TonemapFactory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright 2015 The Android Open Source Project @@ -19,7 +19,6 @@ #include "TonemapFactory.h" #include <utils/Log.h> -#include "EGLImageWrapper.h" #include "Tonemapper.h" #include "engine.h" @@ -41,8 +40,6 @@ Tonemapper *TonemapperFactory_GetInstance(int type, void *colorMap, int colorMap void TonemapperFactory_Destroy() //------------------------------------------ { - // clear EGLImage mappings - EGLImageWrapper::destroy(); // shutdown the engine engine_shutdown(); } diff --git a/gpu_tonemapper/Tonemapper.cpp b/gpu_tonemapper/Tonemapper.cpp index 957c1335..5f2f9741 100644 --- a/gpu_tonemapper/Tonemapper.cpp +++ b/gpu_tonemapper/Tonemapper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright 2015 The Android Open Source Project @@ -32,6 +32,7 @@ Tonemapper::Tonemapper() tonemapTexture = 0; lutXformTexture = 0; programID = 0; + eglImageWrapper = new EGLImageWrapper(); } //----------------------------------------------------------------------------- @@ -41,6 +42,13 @@ Tonemapper::~Tonemapper() engine_deleteInputBuffer(tonemapTexture); engine_deleteInputBuffer(lutXformTexture); engine_deleteProgram(programID); + + // clear EGLImage mappings + if (eglImageWrapper != 0) { + eglImageWrapper->destroy(); + delete eglImageWrapper; + eglImageWrapper = 0; + } } //----------------------------------------------------------------------------- @@ -95,8 +103,8 @@ int Tonemapper::blit(const void *dst, const void *src, int srcFenceFd) engine_bind(); // create eglimages if required - EGLImageBuffer *dst_buffer = EGLImageWrapper::wrap(dst); - EGLImageBuffer *src_buffer = EGLImageWrapper::wrap(src); + EGLImageBuffer *dst_buffer = eglImageWrapper->wrap(dst); + EGLImageBuffer *src_buffer = eglImageWrapper->wrap(src); // bind the program engine_setProgram(programID); diff --git a/gpu_tonemapper/Tonemapper.h b/gpu_tonemapper/Tonemapper.h index 9c41670d..0f9bd513 100644 --- a/gpu_tonemapper/Tonemapper.h +++ b/gpu_tonemapper/Tonemapper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. * Not a Contribution. * * Copyright 2015 The Android Open Source Project @@ -23,11 +23,14 @@ #define TONEMAP_FORWARD 0 #define TONEMAP_INVERSE 1 +#include "EGLImageWrapper.h" + class Tonemapper { private: unsigned int tonemapTexture; unsigned int lutXformTexture; unsigned int programID; + EGLImageWrapper* eglImageWrapper; Tonemapper(); public: |