Home | History | Annotate | Download | only in liboverlay

Lines Matching refs:shared

57 /* shared with Camera/Video Playback HAL */
131 overlay_shared_t *shared;
141 static int create_shared_data(overlay_shared_t **shared);
142 static void destroy_shared_data(int shared_fd, overlay_shared_t *shared,
147 static int enable_streaming(overlay_shared_t *shared, int ovly_fd,
268 static int create_shared_data(overlay_shared_t **shared)
276 LOGE("Failed to Create Overlay Shared Data!\n");
283 LOGE("Failed to Map Overlay Shared Data!\n");
297 LOGE("Failed to set the overlay mutex attr to be shared across-processes");
305 *shared = p;
317 static void destroy_shared_data(int shared_fd, overlay_shared_t *shared,
320 if (shared == NULL)
325 if (android_atomic_dec(&shared->refCnt) == 1) {
326 if (pthread_mutex_destroy(&shared->lock)) {
330 if (pthread_mutexattr_destroy(&shared->attr)) {
333 shared->marker = 0;
336 if (munmap(shared, shared->size)) {
337 LOGE("Failed to Unmap Overlay Shared Data!\n");
341 LOGE("Failed to Close Overlay Shared Data!\n");
352 if (ctx->shared != NULL) {
354 LOGI("Overlay Shared Data Already Open\n");
357 ctx->shared = (overlay_shared_t*)mmap(0, size, mode, MAP_SHARED, fd, 0);
359 if (ctx->shared == MAP_FAILED) {
360 LOGE("Failed to Map Overlay Shared Data!\n");
361 } else if ( ctx->shared->marker != SHARED_DATA_MARKER ) {
362 LOGE("Invalid Overlay Shared Marker!\n");
363 munmap( ctx->shared, size);
364 } else if ( (int)ctx->shared->size != size ) {
365 LOGE("Invalid Overlay Shared Size!\n");
366 munmap(ctx->shared, size);
368 android_atomic_inc(&ctx->shared->refCnt);
377 destroy_shared_data(ctx->shared_fd, ctx->shared, false);
378 ctx->shared = NULL;
381 static int enable_streaming_locked(overlay_shared_t *shared, int ovly_fd)
385 if (!shared->controlReady || !shared->dataReady) {
386 LOGI("Postponing Stream Enable/%d/%d\n", shared->controlReady,
387 shared->dataReady);
389 shared->streamEn = 1;
393 shared->streamEn = 0;
400 static int enable_streaming(overlay_shared_t *shared, int ovly_fd)
404 pthread_mutex_lock(&shared->lock);
405 ret = enable_streaming_locked(shared, ovly_fd);
406 pthread_mutex_unlock(&shared->lock);
410 static int disable_streaming_locked(overlay_shared_t *shared, int ovly_fd)
414 if (shared->streamEn) {
419 shared->streamingReset = 1;
420 shared->streamEn = 0;
528 overlay_shared_t *shared;
550 shared_fd = create_shared_data(&shared);
552 LOGE("Failed to create shared data");
612 overlay = new overlay_object(fd, shared_fd, shared->size,
620 overlay->setShared(shared);
622 shared->controlReady = 0;
623 shared->streamEn = 0;
624 shared->streamingReset = 0;
628 shared->dispW = info.xres;
629 shared->dispH = info.yres;
634 shared->dispW = g_lcd_width; /* Need to determine this properly */
635 shared->dispH = g_lcd_height; /* Need to determine this properly */
639 (unsigned long)overlay, shared_fd, shared->size);
646 destroy_shared_data(shared_fd, shared, true);
663 overlay_shared_t *shared = obj->getShared();
665 if (shared == NULL) {
670 pthread_mutex_lock(&shared->lock);
672 disable_streaming_locked(shared, fd);
674 pthread_mutex_unlock(&shared->lock);
676 destroy_shared_data(obj->shared_fd(), shared, true);
707 overlay_shared_t *shared = obj->getShared();
725 if (!shared->controlReady) {
728 if ( temp_w > shared->dispW ) temp_w = shared->dispW;
729 if ( temp_h > shared->dispH ) temp_h = shared->dispH;
730 if ( (temp_x + temp_w) > shared->dispW ) temp_w = shared->dispW - temp_x;
731 if ( (temp_y + temp_h) > shared->dispH ) temp_h = shared->dispH - temp_y;
732 } else if (temp_x < 0 || temp_y < 0 || (temp_x + temp_w) > shared->dispW ||
733 (temp_y + temp_h) > shared->dispH) {
843 overlay_shared_t *shared = obj->getShared();
848 if (shared == NULL) {
849 LOGI("Shared Data Not Init'd!\n");
853 pthread_mutex_lock(&shared->lock);
855 if (!shared->controlReady) {
856 shared->controlReady = 1;
895 if ((ret = disable_streaming_locked(shared, fd)))
929 ret = enable_streaming_locked(shared, fd);
932 pthread_mutex_unlock(&shared->lock);
1065 ctx->shared = NULL;
1084 ctx->shared->dataReady = 0;
1144 if (!ctx->shared) {
1145 LOGI("Shared Data Not Init'd!\n");
1149 if (ctx->shared->dataReady) {
1155 pthread_mutex_lock(&ctx->shared->lock);
1157 if ((rc = disable_streaming_locked(ctx->shared, ctx->ctl_fd)))
1209 rc = enable_streaming_locked(ctx->shared, ctx->ctl_fd);
1212 pthread_mutex_unlock(&ctx->shared->lock);
1224 if (ctx->shared == NULL) {
1225 LOGI("Shared Data Not Init'd!\n");
1229 if (ctx->shared->dataReady) {
1249 if (ctx->shared == NULL) {
1250 LOGI("Shared Data Not Init'd!\n");
1254 pthread_mutex_lock(&ctx->shared->lock);
1256 ctx->shared->dataReady = 1;
1270 if ((rc = disable_streaming_locked(ctx->shared, ctx->ctl_fd)))
1278 rc = enable_streaming_locked(ctx->shared, ctx->ctl_fd);
1281 pthread_mutex_unlock(&ctx->shared->lock);
1305 pthread_mutex_lock(&ctx->shared->lock);
1306 if ( ctx->shared->streamingReset ) {
1307 ctx->shared->streamingReset = 0;
1308 pthread_mutex_unlock(&ctx->shared->lock);
1311 pthread_mutex_unlock(&ctx->shared->lock);
1315 if (ctx->shared->streamEn && ctx->qd_buf_count) {
1338 pthread_mutex_lock(&ctx->shared->lock);
1339 if ( ctx->shared->streamingReset ) {
1340 ctx->shared->streamingReset = 0;
1341 pthread_mutex_unlock(&ctx->shared->lock);
1344 pthread_mutex_unlock(&ctx->shared->lock);
1347 if (!ctx->shared->dataReady) {
1348 ctx->shared->dataReady = 1;
1349 enable_streaming(ctx->shared, ctx->ctl_fd);
1352 if (!ctx->shared->controlReady) return -1;
1404 pthread_mutex_lock(&ctx->shared->lock);
1420 pthread_mutex_unlock(&ctx->shared->lock);
1422 ctx->shared->dataReady = 0;