OSDN Git Service

Mitigate GRALLOC1_PFN_LOCK_FLEX multithread issue.
authorAlexey Dulaev <alexeyx.dulaev@intel.com>
Fri, 5 Oct 2018 08:26:39 +0000 (11:26 +0300)
committerLin Johnson <johnson.lin@intel.com>
Sat, 15 Dec 2018 07:05:35 +0000 (15:05 +0800)
lockFlex fills outFlexLayout->planes with pointer to global variable
ycbcrplanes, doesn't work from multiple threads.
Workaround: change the variable to thread_local.

Jira: OAM-70143, MDP-51191
Test: check memory regions mapped from different threads don't overlap

cros_gralloc/gralloc1/cros_gralloc1_module.cc

index d9136fa..566fd33 100644 (file)
@@ -405,7 +405,7 @@ int32_t CrosGralloc1::lock(buffer_handle_t bufferHandle, gralloc1_producer_usage
        return CROS_GRALLOC_ERROR_NONE;
 }
 
        return CROS_GRALLOC_ERROR_NONE;
 }
 
-android_flex_plane_t ycbcrplanes[3];
+thread_local android_flex_plane_t ycbcrplanes[3];
 
 int32_t update_flex_layout(struct android_ycbcr *ycbcr, struct android_flex_layout *outFlexLayout)
 {
 
 int32_t update_flex_layout(struct android_ycbcr *ycbcr, struct android_flex_layout *outFlexLayout)
 {