Lines Matching refs:fb
665 static void vino_free_buffer_with_count(struct vino_framebuffer *fb, in vino_free_buffer_with_count() argument
673 ClearPageReserved(virt_to_page((void *)fb->desc_table.virtual[i])); in vino_free_buffer_with_count()
675 fb->desc_table.dma_cpu[VINO_PAGE_RATIO * i], in vino_free_buffer_with_count()
677 free_page(fb->desc_table.virtual[i]); in vino_free_buffer_with_count()
681 VINO_PAGE_RATIO * (fb->desc_table.page_count + 4) * in vino_free_buffer_with_count()
682 sizeof(dma_addr_t), (void *)fb->desc_table.dma_cpu, in vino_free_buffer_with_count()
683 fb->desc_table.dma); in vino_free_buffer_with_count()
684 kfree(fb->desc_table.virtual); in vino_free_buffer_with_count()
686 memset(fb, 0, sizeof(struct vino_framebuffer)); in vino_free_buffer_with_count()
689 static void vino_free_buffer(struct vino_framebuffer *fb) in vino_free_buffer() argument
691 vino_free_buffer_with_count(fb, fb->desc_table.page_count); in vino_free_buffer()
694 static int vino_allocate_buffer(struct vino_framebuffer *fb, in vino_allocate_buffer() argument
705 memset(fb, 0, sizeof(struct vino_framebuffer)); in vino_allocate_buffer()
713 fb->desc_table.virtual = (unsigned long *) in vino_allocate_buffer()
715 if (!fb->desc_table.virtual) in vino_allocate_buffer()
720 fb->desc_table.dma_cpu = in vino_allocate_buffer()
722 sizeof(dma_addr_t), &fb->desc_table.dma, in vino_allocate_buffer()
724 if (!fb->desc_table.dma_cpu) { in vino_allocate_buffer()
734 fb->desc_table.virtual[i] = in vino_allocate_buffer()
736 if (!fb->desc_table.virtual[i]) { in vino_allocate_buffer()
743 (void *)fb->desc_table.virtual[i], in vino_allocate_buffer()
747 fb->desc_table.dma_cpu[VINO_PAGE_RATIO * i + j] = in vino_allocate_buffer()
751 SetPageReserved(virt_to_page((void *)fb->desc_table.virtual[i])); in vino_allocate_buffer()
756 fb->desc_table.page_count = count; in vino_allocate_buffer()
761 vino_free_buffer_with_count(fb, i); in vino_allocate_buffer()
766 fb->size = count * PAGE_SIZE; in vino_allocate_buffer()
767 fb->data_format = VINO_DATA_FMT_NONE; in vino_allocate_buffer()
770 fb->desc_table.dma_cpu[VINO_PAGE_RATIO * count] = VINO_DESC_STOP; in vino_allocate_buffer()
774 kfree(fb->desc_table.virtual); in vino_allocate_buffer()
780 static int vino_prepare_user_buffer(struct vino_framebuffer *fb,
792 memset(fb, 0, sizeof(struct vino_framebuffer));
800 fb->desc_table.virtual = (unsigned long *)
802 if (!fb->desc_table.virtual)
807 fb->desc_table.dma_cpu =
809 sizeof(dma_addr_t), &fb->desc_table.dma,
811 if (!fb->desc_table.dma_cpu) {
821 fb->desc_table.virtual[i] =
823 if (!fb->desc_table.virtual[i]) {
830 (void *)fb->desc_table.virtual[i],
834 fb->desc_table.dma_cpu[VINO_PAGE_RATIO * i + j] =
838 SetPageReserved(virt_to_page((void *)fb->desc_table.virtual[i]));
843 fb->desc_table.page_count = count;
848 vino_free_buffer_with_count(fb, i);
853 fb->size = count * PAGE_SIZE;
856 fb->desc_table.dma_cpu[VINO_PAGE_RATIO * count] = VINO_DESC_STOP;
860 kfree(fb->desc_table.virtual);
865 static void vino_sync_buffer(struct vino_framebuffer *fb) in vino_sync_buffer() argument
871 for (i = 0; i < fb->desc_table.page_count; i++) in vino_sync_buffer()
873 fb->desc_table.dma_cpu[VINO_PAGE_RATIO * i], in vino_sync_buffer()
1128 struct vino_framebuffer *fb; in vino_queue_transfer() local
1149 fb = q->buffer[id]; in vino_queue_transfer()
1158 ret = fb; in vino_queue_transfer()
1790 struct vino_framebuffer *fb) in vino_dma_setup() argument
1799 fb->frame_counter = 0; in vino_dma_setup()
1811 ch->start_desc_tbl = fb->desc_table.dma; in vino_dma_setup()
1812 ch->next_4_desc = fb->desc_table.dma; in vino_dma_setup()
1836 fb->data_size = ((vcs->clipping.right - vcs->clipping.left) / in vino_dma_setup()
1905 fb->data_format = vcs->data_format; in vino_dma_setup()
1978 struct vino_framebuffer *fb) in vino_capture() argument
1983 spin_lock_irqsave(&fb->state_lock, flags); in vino_capture()
1985 if (fb->state == VINO_FRAMEBUFFER_IN_USE) in vino_capture()
1987 fb->state = VINO_FRAMEBUFFER_IN_USE; in vino_capture()
1989 spin_unlock_irqrestore(&fb->state_lock, flags); in vino_capture()
1997 vino_dma_setup(vcs, fb); in vino_capture()
2011 struct vino_framebuffer *fb; in vino_capture_enqueue() local
2018 fb = vino_queue_add(&vcs->fb_queue, index); in vino_capture_enqueue()
2019 if (fb == NULL) { in vino_capture_enqueue()
2027 return fb; in vino_capture_enqueue()
2032 struct vino_framebuffer *fb; in vino_capture_next() local
2069 fb = vino_queue_peek(&vcs->fb_queue, &id); in vino_capture_next()
2070 if (fb == NULL) { in vino_capture_next()
2082 err = vino_capture(vcs, fb); in vino_capture_next()
2135 static void vino_convert_to_rgba(struct vino_framebuffer *fb) { in vino_convert_to_rgba() argument
2140 for (page = 0; page < fb->desc_table.page_count; page++) { in vino_convert_to_rgba()
2141 pageptr = (unsigned char *)fb->desc_table.virtual[page]; in vino_convert_to_rgba()
2156 struct vino_framebuffer *fb) in vino_check_buffer() argument
2163 spin_lock_irqsave(&fb->state_lock, flags); in vino_check_buffer()
2164 switch (fb->state) { in vino_check_buffer()
2169 vino_sync_buffer(fb); in vino_check_buffer()
2170 fb->state = VINO_FRAMEBUFFER_UNUSED; in vino_check_buffer()
2175 spin_unlock_irqrestore(&fb->state_lock, flags); in vino_check_buffer()
2179 && (fb->data_format == VINO_DATA_FMT_RGB32)) { in vino_check_buffer()
2180 vino_convert_to_rgba(fb); in vino_check_buffer()
2252 struct vino_framebuffer *fb;
2276 fb = vino_queue_peek(&vcs->fb_queue, &i);
2277 if (fb == NULL) {
2282 spin_lock_irqsave(&fb->state_lock, flags);
2283 if (fb->state == VINO_FRAMEBUFFER_IN_USE) {
2284 fb->state = VINO_FRAMEBUFFER_UNUSED;
2290 spin_unlock_irqrestore(&fb->state_lock, flags);
2298 struct vino_framebuffer *fb; in vino_skip_frame() local
2303 fb = vino_queue_peek(&vcs->fb_queue, &id); in vino_skip_frame()
2304 if (!fb) { in vino_skip_frame()
2311 spin_lock_irqsave(&fb->state_lock, flags); in vino_skip_frame()
2312 fb->state = VINO_FRAMEBUFFER_UNUSED; in vino_skip_frame()
2313 spin_unlock_irqrestore(&fb->state_lock, flags); in vino_skip_frame()
2320 struct vino_framebuffer *fb; in vino_frame_done() local
2324 fb = vino_queue_transfer(&vcs->fb_queue); in vino_frame_done()
2325 if (!fb) { in vino_frame_done()
2332 fb->frame_counter = vcs->int_data.frame_counter; in vino_frame_done()
2333 memcpy(&fb->timestamp, &vcs->int_data.timestamp, in vino_frame_done()
2336 spin_lock_irqsave(&fb->state_lock, flags); in vino_frame_done()
2337 if (fb->state == VINO_FRAMEBUFFER_IN_USE) in vino_frame_done()
2338 fb->state = VINO_FRAMEBUFFER_READY; in vino_frame_done()
2339 spin_unlock_irqrestore(&fb->state_lock, flags); in vino_frame_done()
3395 struct vino_framebuffer *fb, in vino_v4l2_get_buffer_status() argument
3399 fb->id)) { in vino_v4l2_get_buffer_status()
3403 fb->id)) { in vino_v4l2_get_buffer_status()
3413 if (fb->map_count > 0) in vino_v4l2_get_buffer_status()
3416 b->index = fb->id; in vino_v4l2_get_buffer_status()
3419 b->m.offset = fb->offset; in vino_v4l2_get_buffer_status()
3420 b->bytesused = fb->data_size; in vino_v4l2_get_buffer_status()
3421 b->length = fb->size; in vino_v4l2_get_buffer_status()
3423 b->sequence = fb->frame_counter; in vino_v4l2_get_buffer_status()
3424 memcpy(&b->timestamp, &fb->timestamp, in vino_v4l2_get_buffer_status()
3429 fb->id, fb->size, fb->data_size, fb->offset); in vino_v4l2_get_buffer_status()
3436 struct vino_framebuffer *fb; in vino_querybuf() local
3448 fb = vino_queue_get_buffer(&vcs->fb_queue, in vino_querybuf()
3450 if (fb == NULL) { in vino_querybuf()
3455 vino_v4l2_get_buffer_status(vcs, fb, b); in vino_querybuf()
3464 struct vino_framebuffer *fb; in vino_qbuf() local
3476 fb = vino_capture_enqueue(vcs, b->index); in vino_qbuf()
3477 if (fb == NULL) in vino_qbuf()
3480 vino_v4l2_get_buffer_status(vcs, fb, b); in vino_qbuf()
3496 struct vino_framebuffer *fb; in vino_dqbuf() local
3541 fb = vino_queue_remove(&vcs->fb_queue, &b->index); in vino_dqbuf()
3542 if (fb == NULL) { in vino_dqbuf()
3547 err = vino_check_buffer(vcs, fb); in vino_dqbuf()
3549 vino_v4l2_get_buffer_status(vcs, fb, b); in vino_dqbuf()
3844 struct vino_framebuffer *fb = vma->vm_private_data; in vino_vm_open() local
3846 fb->map_count++; in vino_vm_open()
3847 dprintk("vino_vm_open(): count = %d\n", fb->map_count); in vino_vm_open()
3852 struct vino_framebuffer *fb = vma->vm_private_data; in vino_vm_close() local
3854 fb->map_count--; in vino_vm_close()
3855 dprintk("vino_vm_close(): count = %d\n", fb->map_count); in vino_vm_close()
3871 struct vino_framebuffer *fb = NULL; in vino_mmap() local
3909 fb = vino_queue_get_buffer(&vcs->fb_queue, i); in vino_mmap()
3910 if (fb == NULL) { in vino_mmap()
3916 if (fb->offset == offset) in vino_mmap()
3927 if (size > (fb->desc_table.page_count * PAGE_SIZE)) { in vino_mmap()
3929 size, fb->desc_table.page_count * PAGE_SIZE); in vino_mmap()
3934 for (i = 0; i < fb->desc_table.page_count; i++) { in vino_mmap()
3936 virt_to_phys((void *)fb->desc_table.virtual[i]) >> in vino_mmap()
3954 fb->map_count = 1; in vino_mmap()
3958 vma->vm_private_data = fb; in vino_mmap()