libvideorender: CB1 crash when stress test [1/1]
PD#SWPL-185744
Problem:
crash when doing 24 hour stree test.
wayland buffer construct failed in prepareFrameBuffer.
and delete this buffer to release render buffer. but
wayland buffer managed by mWaylandBuffersMap. It
reused at next buffer loop
Solution:
delete wayland buffer and remove it from mWaylandBuffersMap
Verify:
ap222
Change-Id: I1704585c00c1e3ab9bdb13421919f2e8e2c15c9f
Signed-off-by: fei.deng <fei.deng@amlogic.com>
diff --git a/weston/wayland_display.cpp b/weston/wayland_display.cpp
index f776b80..e6f644e 100644
--- a/weston/wayland_display.cpp
+++ b/weston/wayland_display.cpp
@@ -1376,6 +1376,9 @@
}
return NO_ERROR;
waylandbuf_fail:
+ if (!isNew) {
+ removeWaylandBuffer(buf);
+ }
//delete waylandbuf
delete waylandBuf;
waylandBuf = NULL;
@@ -1758,6 +1761,18 @@
return (WaylandBuffer*) item->second;
}
+void WaylandDisplay::removeWaylandBuffer(RenderBuffer * buf)
+{
+ Tls::Mutex::Autolock _l(mBufferMutex);
+ std::size_t hashval = calculateDmaBufferHash(buf->dma);
+ auto item = mWaylandBuffersMap.find(hashval);
+ if (item == mWaylandBuffersMap.end()) {
+ return ;
+ }
+
+ mWaylandBuffersMap.erase(item);
+}
+
void WaylandDisplay::cleanAllWaylandBuffer()
{
Tls::Mutex::Autolock _l(mBufferMutex);
diff --git a/weston/wayland_display.h b/weston/wayland_display.h
index a0ce673..bcb7967 100644
--- a/weston/wayland_display.h
+++ b/weston/wayland_display.h
@@ -303,6 +303,7 @@
void cleanSurface();
void addWaylandBuffer(RenderBuffer * buf, WaylandBuffer *waylandbuf);
WaylandBuffer* findWaylandBuffer(RenderBuffer * buf);
+ void removeWaylandBuffer(RenderBuffer * buf);
void cleanAllWaylandBuffer();
void cleanWaylandBufferBeforeResChanged();