Skip to content
Snippets Groups Projects
Commit 7907b77e authored by Weilun Du's avatar Weilun Du
Browse files

Exit HostConnection for thread which only uses gralloc


For certain guest process which maintains a thread pool and only calls gralloc
library, we should exit the host connection to avoid spawning too many
render threads on host emulator.

Test: run empty test activity for 3000 times and the number of render
thread on host should stay roughly the same.
BUG: 80050618

Change-Id: Idb282aa67138572519edee761f8bc6cb50c1653d
Signed-off-by: default avatarWeilun Du <wdu@google.com>
(cherry picked from commit 904b90eb097609762c7c35c321f82b2cc5245190)
parent 776c876d
No related branches found
No related tags found
No related merge requests found
......@@ -339,6 +339,13 @@ static int map_buffer(cb_handle_t *cb, void **vaddr)
return -EIO; \
}
#define EXIT_GRALLOCONLY_HOST_CONNECTION \
if (hostCon && hostCon->isGrallocOnly()) { \
ALOGD("%s: exiting HostConnection (is buffer-handling thread)", \
__FUNCTION__); \
HostConnection::exit(); \
}
#if PLATFORM_SDK_VERSION < 18
// On older APIs, just define it as a value no one is going to use.
#define HAL_PIXEL_FORMAT_YCbCr_420_888 0xFFFFFFFF
......@@ -1046,6 +1053,8 @@ static int gralloc_unregister_buffer(gralloc_module_t const* module,
}
}
}
EXIT_GRALLOCONLY_HOST_CONNECTION;
}
//
......@@ -1070,6 +1079,7 @@ static int gralloc_unregister_buffer(gralloc_module_t const* module,
cb->ashmemBase = 0;
cb->mappedPid = 0;
D("%s: Unregister buffer previous mapped to pid %d", __FUNCTION__, getpid());
EXIT_GRALLOCONLY_HOST_CONNECTION;
}
done:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment