Home | History | Annotate | Download | only in liboverlay

Lines Matching refs:shared

53 #define ALL_BUFFERS_FLUSHED -66 //shared with Camera/Video Playback HAL
116 overlay_shared_t *shared;
123 static int create_shared_data(overlay_shared_t **shared);
124 static void destroy_shared_data(int shared_fd, overlay_shared_t *shared, bool closefd);
128 static int enable_streaming( overlay_shared_t *shared, int ovly_fd, int lock_required );
244 static int create_shared_data(overlay_shared_t **shared)
252 LOGE("Failed to Create Overlay Shared Data!\n");
259 LOGE("Failed to Map Overlay Shared Data!\n");
273 LOGE("Failed to set the overlay mutex attr to be shared across-processes");
283 *shared = p;
287 static void destroy_shared_data( int shared_fd, overlay_shared_t *shared, bool closefd )
289 if (shared == NULL)
294 if (android_atomic_dec(&shared->refCnt) == 1) {
295 if (pthread_mutex_destroy(&shared->lock)) {
299 if (pthread_mutexattr_destroy(&shared->attr)) {
302 shared->marker = 0;
305 if (munmap(shared, shared->size)) {
306 LOGE("Failed to Unmap Overlay Shared Data!\n");
310 LOGE("Failed to Close Overlay Shared Data!\n");
321 if (ctx->shared != NULL) {
323 LOGI("Overlay Shared Data Already Open\n");
326 ctx->shared = (overlay_shared_t*)mmap(0, size, mode, MAP_SHARED, fd, 0);
328 if (ctx->shared == MAP_FAILED) {
329 LOGE("Failed to Map Overlay Shared Data!\n");
330 } else if ( ctx->shared->marker != SHARED_DATA_MARKER ) {
331 LOGE("Invalid Overlay Shared Marker!\n");
332 munmap( ctx->shared, size);
333 } else if ( (int)ctx->shared->size != size ) {
334 LOGE("Invalid Overlay Shared Size!\n");
335 munmap(ctx->shared, size);
337 android_atomic_inc(&ctx->shared->refCnt);
346 destroy_shared_data(ctx->shared_fd, ctx->shared, false);
347 ctx->shared = NULL;
350 static int enable_streaming_locked(overlay_shared_t *shared, int ovly_fd)
354 if (!shared->controlReady || !shared->dataReady) {
355 LOGI("Postponing Stream Enable/%d/%d\n", shared->controlReady,
356 shared->dataReady);
358 shared->streamEn = 1;
362 shared->streamEn = 0;
369 static int enable_streaming(overlay_shared_t *shared, int ovly_fd)
373 pthread_mutex_lock(&shared->lock);
374 ret = enable_streaming_locked(shared, ovly_fd);
375 pthread_mutex_unlock(&shared->lock);
379 static int disable_streaming_locked(overlay_shared_t *shared, int ovly_fd)
383 if (shared->streamEn) {
388 shared->streamingReset = 1;
389 shared->streamEn = 0;
426 overlay_shared_t *shared;
443 shared_fd = create_shared_data(&shared);
445 LOGE("Failed to create shared data");
475 overlay = new overlay_object(fd, shared_fd, shared->size, w, h, format, num);
482 overlay->setShared(shared);
484 shared->controlReady = 0;
485 shared->streamEn = 0;
486 shared->streamingReset = 0;
487 shared->dispW = LCD_WIDTH; // Need to determine this properly
488 shared->dispH = LCD_HEIGHT; // Need to determine this properly
491 (unsigned long)overlay, shared_fd, shared->size);
500 destroy_shared_data(shared_fd, shared, true);
515 overlay_shared_t *shared = obj->getShared();
517 if (shared == NULL) {
522 pthread_mutex_lock(&shared->lock);
524 disable_streaming_locked(shared, fd);
526 pthread_mutex_unlock(&shared->lock);
528 destroy_shared_data(obj->shared_fd(), shared, true);
555 overlay_shared_t *shared = obj->getShared();
572 } else if (!shared->controlReady) {
575 if ( w > shared->dispW ) w = shared->dispW;
576 if ( h > shared->dispH ) h = shared->dispH;
577 if ( (x + w) > shared->dispW ) w = shared->dispW - x;
578 if ( (y + h) > shared->dispH ) h = shared->dispH - y;
579 } else if (x < 0 || y < 0 || (x + w) > shared->dispW ||
580 (y + h) > shared->dispH) {
659 overlay_shared_t *shared = obj->getShared();
664 if (shared == NULL) {
665 LOGI("Shared Data Not Init'd!\n");
669 pthread_mutex_lock(&shared->lock);
671 if (!shared->controlReady) {
672 shared->controlReady = 1;
688 if ((ret = disable_streaming_locked(shared, fd)))
714 ret = enable_streaming_locked(shared, fd);
717 pthread_mutex_unlock(&shared->lock);
765 ctx->shared = NULL;
778 ctx->shared->dataReady = 0;
813 if (!ctx->shared) {
814 LOGI("Shared Data Not Init'd!\n");
818 if (ctx->shared->dataReady) {
824 pthread_mutex_lock(&ctx->shared->lock);
826 if ((rc = disable_streaming_locked(ctx->shared, ctx->ctl_fd)))
854 rc = enable_streaming_locked(ctx->shared, ctx->ctl_fd);
857 pthread_mutex_unlock(&ctx->shared->lock);
869 if (ctx->shared == NULL)
871 LOGI("Shared Data Not Init'd!\n");
875 if (ctx->shared->dataReady) {
895 if (ctx->shared == NULL) {
896 LOGI("Shared Data Not Init'd!\n");
900 pthread_mutex_lock(&ctx->shared->lock);
902 ctx->shared->dataReady = 1;
917 if ((rc = disable_streaming_locked(ctx->shared, ctx->ctl_fd)))
925 rc = enable_streaming_locked(ctx->shared, ctx->ctl_fd);
928 pthread_mutex_unlock(&ctx->shared->lock);
950 pthread_mutex_lock(&ctx->shared->lock);
951 if ( ctx->shared->streamingReset )
953 ctx->shared->streamingReset = 0;
954 pthread_mutex_unlock(&ctx->shared->lock);
957 pthread_mutex_unlock(&ctx->shared->lock);
960 if (ctx->shared->streamEn) {
982 pthread_mutex_lock(&ctx->shared->lock);
983 if ( ctx->shared->streamingReset )
985 ctx->shared->streamingReset = 0;
986 pthread_mutex_unlock(&ctx->shared->lock);
989 pthread_mutex_unlock(&ctx->shared->lock);
992 if (!ctx->shared->dataReady) {
993 ctx->shared->dataReady = 1;
994 enable_streaming(ctx->shared, ctx->ctl_fd);
1061 pthread_mutex_lock(&ctx->shared->lock);
1075 pthread_mutex_unlock(&ctx->shared->lock);
1077 ctx->shared->dataReady = 0;