hwcomposer: delay starting the uevent thread
- There is a race condition window between initializing hwcomposer as a whole and registering callback functions for when the uevents arrive. We can fix this issue by delaying the uevent thread kick off until the callback functions are registered. - Add thread name to uevent thread Change-Id: I30e23b411b92b6578f186b641f562462a8f23179
This commit is contained in:
parent
4796f2588d
commit
b25918ac52
@ -70,6 +70,9 @@ static void hwc_registerProcs(struct hwc_composer_device* dev,
|
||||
return;
|
||||
}
|
||||
ctx->device.reserved_proc[0] = (void*)procs;
|
||||
|
||||
// Now that we have the functions needed, kick off the uevent thread
|
||||
init_uevent_thread(ctx);
|
||||
}
|
||||
|
||||
static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list)
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <hardware_legacy/uevent.h>
|
||||
#include <utils/Log.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/prctl.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "hwc_utils.h"
|
||||
@ -88,6 +89,8 @@ static void *uevent_loop(void *param)
|
||||
memset(udata, 0, sizeof(udata));
|
||||
hwc_context_t * ctx = reinterpret_cast<hwc_context_t *>(param);
|
||||
|
||||
char thread_name[64] = "hwcUeventThread";
|
||||
prctl(PR_SET_NAME, (unsigned long) &thread_name, 0, 0, 0);
|
||||
setpriority(PRIO_PROCESS, 0, HAL_PRIORITY_URGENT_DISPLAY);
|
||||
uevent_init();
|
||||
|
||||
@ -102,6 +105,7 @@ static void *uevent_loop(void *param)
|
||||
void init_uevent_thread(hwc_context_t* ctx)
|
||||
{
|
||||
pthread_t uevent_thread;
|
||||
ALOGI("Initializing UEvent Listener Thread");
|
||||
pthread_create(&uevent_thread, NULL, uevent_loop, (void*) ctx);
|
||||
}
|
||||
|
||||
|
@ -54,8 +54,6 @@ void initContext(hwc_context_t *ctx)
|
||||
ctx->mExtDisplay = new ExternalDisplay(ctx);
|
||||
MDPComp::init(ctx);
|
||||
|
||||
init_uevent_thread(ctx);
|
||||
|
||||
char value[PROPERTY_VALUE_MAX];
|
||||
property_get("debug.egl.swapinterval", value, "1");
|
||||
ctx->swapInterval = atoi(value);
|
||||
|
Loading…
Reference in New Issue
Block a user