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
This commit is contained in:
@@ -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.
|
* Not a Contribution.
|
||||||
*
|
*
|
||||||
* Copyright 2015 The Android Open Source Project
|
* Copyright 2015 The Android Open Source Project
|
||||||
@@ -22,8 +22,6 @@
|
|||||||
#include <gralloc_priv.h>
|
#include <gralloc_priv.h>
|
||||||
#include <ui/GraphicBuffer.h>
|
#include <ui/GraphicBuffer.h>
|
||||||
|
|
||||||
std::map<int, EGLImageBuffer *> EGLImageWrapper::eglImageBufferMap;
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
EGLImageBuffer *EGLImageWrapper::wrap(const void *pvt_handle)
|
EGLImageBuffer *EGLImageWrapper::wrap(const void *pvt_handle)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -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.
|
* Not a Contribution.
|
||||||
*
|
*
|
||||||
* Copyright 2015 The Android Open Source Project
|
* Copyright 2015 The Android Open Source Project
|
||||||
@@ -24,11 +24,11 @@
|
|||||||
#include "EGLImageBuffer.h"
|
#include "EGLImageBuffer.h"
|
||||||
|
|
||||||
class EGLImageWrapper {
|
class EGLImageWrapper {
|
||||||
static std::map<int, EGLImageBuffer *> eglImageBufferMap;
|
std::map<int, EGLImageBuffer *> eglImageBufferMap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static EGLImageBuffer *wrap(const void *pvt_handle);
|
EGLImageBuffer *wrap(const void *pvt_handle);
|
||||||
static void destroy();
|
void destroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //__TONEMAPPER_EGLIMAGEWRAPPER_H__
|
#endif //__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.
|
* Not a Contribution.
|
||||||
*
|
*
|
||||||
* Copyright 2015 The Android Open Source Project
|
* Copyright 2015 The Android Open Source Project
|
||||||
@@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include "TonemapFactory.h"
|
#include "TonemapFactory.h"
|
||||||
#include <utils/Log.h>
|
#include <utils/Log.h>
|
||||||
#include "EGLImageWrapper.h"
|
|
||||||
#include "Tonemapper.h"
|
#include "Tonemapper.h"
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
|
|
||||||
@@ -41,8 +40,6 @@ Tonemapper *TonemapperFactory_GetInstance(int type, void *colorMap, int colorMap
|
|||||||
void TonemapperFactory_Destroy()
|
void TonemapperFactory_Destroy()
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
{
|
{
|
||||||
// clear EGLImage mappings
|
|
||||||
EGLImageWrapper::destroy();
|
|
||||||
// shutdown the engine
|
// shutdown the engine
|
||||||
engine_shutdown();
|
engine_shutdown();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.
|
* Not a Contribution.
|
||||||
*
|
*
|
||||||
* Copyright 2015 The Android Open Source Project
|
* Copyright 2015 The Android Open Source Project
|
||||||
@@ -32,6 +32,7 @@ Tonemapper::Tonemapper()
|
|||||||
tonemapTexture = 0;
|
tonemapTexture = 0;
|
||||||
lutXformTexture = 0;
|
lutXformTexture = 0;
|
||||||
programID = 0;
|
programID = 0;
|
||||||
|
eglImageWrapper = new EGLImageWrapper();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -41,6 +42,13 @@ Tonemapper::~Tonemapper()
|
|||||||
engine_deleteInputBuffer(tonemapTexture);
|
engine_deleteInputBuffer(tonemapTexture);
|
||||||
engine_deleteInputBuffer(lutXformTexture);
|
engine_deleteInputBuffer(lutXformTexture);
|
||||||
engine_deleteProgram(programID);
|
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();
|
engine_bind();
|
||||||
|
|
||||||
// create eglimages if required
|
// create eglimages if required
|
||||||
EGLImageBuffer *dst_buffer = EGLImageWrapper::wrap(dst);
|
EGLImageBuffer *dst_buffer = eglImageWrapper->wrap(dst);
|
||||||
EGLImageBuffer *src_buffer = EGLImageWrapper::wrap(src);
|
EGLImageBuffer *src_buffer = eglImageWrapper->wrap(src);
|
||||||
|
|
||||||
// bind the program
|
// bind the program
|
||||||
engine_setProgram(programID);
|
engine_setProgram(programID);
|
||||||
|
|||||||
@@ -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.
|
* Not a Contribution.
|
||||||
*
|
*
|
||||||
* Copyright 2015 The Android Open Source Project
|
* Copyright 2015 The Android Open Source Project
|
||||||
@@ -23,11 +23,14 @@
|
|||||||
#define TONEMAP_FORWARD 0
|
#define TONEMAP_FORWARD 0
|
||||||
#define TONEMAP_INVERSE 1
|
#define TONEMAP_INVERSE 1
|
||||||
|
|
||||||
|
#include "EGLImageWrapper.h"
|
||||||
|
|
||||||
class Tonemapper {
|
class Tonemapper {
|
||||||
private:
|
private:
|
||||||
unsigned int tonemapTexture;
|
unsigned int tonemapTexture;
|
||||||
unsigned int lutXformTexture;
|
unsigned int lutXformTexture;
|
||||||
unsigned int programID;
|
unsigned int programID;
|
||||||
|
EGLImageWrapper* eglImageWrapper;
|
||||||
Tonemapper();
|
Tonemapper();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user