Lines Matching refs:group
93 switch (mem->group->buffer.memory) { in _v4l2mem_map()
103 GST_WARNING ("Unknown memory type %i", mem->group->buffer.memory); in _v4l2mem_map()
114 switch (mem->group->buffer.memory) { in _v4l2mem_unmap()
124 GST_WARNING ("Unknown memory type %i", mem->group->buffer.memory); in _v4l2mem_unmap()
134 GstV4l2MemoryGroup *group = mem->group; in _v4l2mem_dispose() local
137 if (group->mem[mem->plane]) { in _v4l2mem_dispose()
139 group->mem[mem->plane] = gst_memory_ref ((GstMemory *) mem); in _v4l2mem_dispose()
153 gint plane, gpointer data, int dmafd, GstV4l2MemoryGroup * group) in _v4l2mem_new() argument
168 mem->group = group; in _v4l2mem_new()
190 -1, mem->group); in _v4l2mem_share()
228 gst_v4l2_memory_group_free (GstV4l2MemoryGroup * group) in gst_v4l2_memory_group_free() argument
232 for (i = 0; i < group->n_mem; i++) { in gst_v4l2_memory_group_free()
233 GstMemory *mem = group->mem[i]; in gst_v4l2_memory_group_free()
234 group->mem[i] = NULL; in gst_v4l2_memory_group_free()
239 g_slice_free (GstV4l2MemoryGroup, group); in gst_v4l2_memory_group_free()
248 GstV4l2MemoryGroup *group; in gst_v4l2_memory_group_new() local
251 group = g_slice_new0 (GstV4l2MemoryGroup); in gst_v4l2_memory_group_new()
253 group->buffer.type = format->type; in gst_v4l2_memory_group_new()
254 group->buffer.index = index; in gst_v4l2_memory_group_new()
255 group->buffer.memory = memory; in gst_v4l2_memory_group_new()
258 group->n_mem = group->buffer.length = format->fmt.pix_mp.num_planes; in gst_v4l2_memory_group_new()
259 group->buffer.m.planes = group->planes; in gst_v4l2_memory_group_new()
261 group->n_mem = 1; in gst_v4l2_memory_group_new()
264 if (obj->ioctl (obj->video_fd, VIDIOC_QUERYBUF, &group->buffer) < 0) in gst_v4l2_memory_group_new()
267 if (group->buffer.index != index) { in gst_v4l2_memory_group_new()
271 g_slice_free (GstV4l2MemoryGroup, group); in gst_v4l2_memory_group_new()
280 for (i = 0; i < group->n_mem; i++) { in gst_v4l2_memory_group_new()
282 buf_size = group->planes[i].length; in gst_v4l2_memory_group_new()
288 buf_size = group->buffer.length; in gst_v4l2_memory_group_new()
296 group->planes[0].bytesused = group->buffer.bytesused; in gst_v4l2_memory_group_new()
297 group->planes[0].length = group->buffer.length; in gst_v4l2_memory_group_new()
298 group->planes[0].data_offset = 0; in gst_v4l2_memory_group_new()
299 g_assert (sizeof (group->planes[0].m) == sizeof (group->buffer.m)); in gst_v4l2_memory_group_new()
300 memcpy (&group->planes[0].m, &group->buffer.m, sizeof (group->buffer.m)); in gst_v4l2_memory_group_new()
304 GST_LOG_OBJECT (allocator, " index: %u", group->buffer.index); in gst_v4l2_memory_group_new()
305 GST_LOG_OBJECT (allocator, " type: %d", group->buffer.type); in gst_v4l2_memory_group_new()
306 GST_LOG_OBJECT (allocator, " flags: %08x", group->buffer.flags); in gst_v4l2_memory_group_new()
307 GST_LOG_OBJECT (allocator, " field: %d", group->buffer.field); in gst_v4l2_memory_group_new()
308 GST_LOG_OBJECT (allocator, " memory: %d", group->buffer.memory); in gst_v4l2_memory_group_new()
309 GST_LOG_OBJECT (allocator, " planes: %d", group->n_mem); in gst_v4l2_memory_group_new()
314 for (i = 0; i < group->n_mem; i++) { in gst_v4l2_memory_group_new()
317 group->planes[i].bytesused, group->planes[i].length, in gst_v4l2_memory_group_new()
318 group->planes[i].data_offset); in gst_v4l2_memory_group_new()
320 group->planes[i].m.mem_offset); in gst_v4l2_memory_group_new()
325 return group; in gst_v4l2_memory_group_new()
341 gst_v4l2_memory_group_free (group); in gst_v4l2_memory_group_new()
353 GstV4l2MemoryGroup *group = mem->group; in gst_v4l2_allocator_release() local
356 mem->plane, group->buffer.index); in gst_v4l2_allocator_release()
371 if (g_atomic_int_dec_and_test (&group->mems_allocated)) { in gst_v4l2_allocator_release()
372 GST_LOG_OBJECT (allocator, "buffer %u released", group->buffer.index); in gst_v4l2_allocator_release()
373 gst_atomic_queue_push (allocator->free_queue, group); in gst_v4l2_allocator_release()
387 GstV4l2MemoryGroup *group = mem->group; in gst_v4l2_allocator_free() local
392 mem->plane, group->buffer.index); in gst_v4l2_allocator_free()
396 obj->munmap (mem->data, group->planes[mem->plane].length); in gst_v4l2_allocator_free()
416 GstV4l2MemoryGroup *group = allocator->groups[i]; in gst_v4l2_allocator_dispose() local
418 if (group) in gst_v4l2_allocator_dispose()
419 gst_v4l2_memory_group_free (group); in gst_v4l2_allocator_dispose()
517 GstV4l2MemoryGroup *group = NULL; in gst_v4l2_allocator_create_buf() local
540 group = gst_v4l2_memory_group_new (allocator, bcreate.index); in gst_v4l2_allocator_create_buf()
542 if (group) { in gst_v4l2_allocator_create_buf()
543 allocator->groups[bcreate.index] = group; in gst_v4l2_allocator_create_buf()
549 return group; in gst_v4l2_allocator_create_buf()
575 GstV4l2MemoryGroup *group; in gst_v4l2_allocator_alloc() local
580 group = gst_atomic_queue_pop (allocator->free_queue); in gst_v4l2_allocator_alloc()
582 if (group == NULL) { in gst_v4l2_allocator_alloc()
584 group = gst_v4l2_allocator_create_buf (allocator); in gst_v4l2_allocator_alloc()
587 if (group == NULL) in gst_v4l2_allocator_alloc()
592 return group; in gst_v4l2_allocator_alloc()
597 GstV4l2MemoryGroup * group) in gst_v4l2_allocator_reset_size() argument
600 for (i = 0; i < group->n_mem; i++) { in gst_v4l2_allocator_reset_size()
601 group->mem[i]->maxsize = group->planes[i].length; in gst_v4l2_allocator_reset_size()
602 group->mem[i]->offset = 0; in gst_v4l2_allocator_reset_size()
603 group->mem[i]->size = group->planes[i].length; in gst_v4l2_allocator_reset_size()
608 _cleanup_failed_alloc (GstV4l2Allocator * allocator, GstV4l2MemoryGroup * group) in _cleanup_failed_alloc() argument
610 if (group->mems_allocated > 0) { in _cleanup_failed_alloc()
615 for (i = 0; i < group->n_mem; i++) in _cleanup_failed_alloc()
616 gst_memory_unref (group->mem[i]); in _cleanup_failed_alloc()
619 gst_atomic_queue_push (allocator->free_queue, group); in _cleanup_failed_alloc()
782 GstV4l2MemoryGroup *group = allocator->groups[i]; in gst_v4l2_allocator_stop() local
784 if (group) in gst_v4l2_allocator_stop()
785 gst_v4l2_memory_group_free (group); in gst_v4l2_allocator_stop()
831 GstV4l2MemoryGroup *group; in gst_v4l2_allocator_alloc_mmap() local
836 group = gst_v4l2_allocator_alloc (allocator); in gst_v4l2_allocator_alloc_mmap()
838 if (group == NULL) in gst_v4l2_allocator_alloc_mmap()
841 for (i = 0; i < group->n_mem; i++) { in gst_v4l2_allocator_alloc_mmap()
842 if (group->mem[i] == NULL) { in gst_v4l2_allocator_alloc_mmap()
844 data = obj->mmap (NULL, group->planes[i].length, PROT_READ | PROT_WRITE, in gst_v4l2_allocator_alloc_mmap()
845 MAP_SHARED, obj->video_fd, group->planes[i].m.mem_offset); in gst_v4l2_allocator_alloc_mmap()
852 group->planes[i].length, group->planes[i].data_offset, i); in gst_v4l2_allocator_alloc_mmap()
854 group->mem[i] = (GstMemory *) _v4l2mem_new (0, GST_ALLOCATOR (allocator), in gst_v4l2_allocator_alloc_mmap()
855 NULL, group->planes[i].length, 0, 0, group->planes[i].length, i, data, in gst_v4l2_allocator_alloc_mmap()
856 -1, group); in gst_v4l2_allocator_alloc_mmap()
862 group->mems_allocated++; in gst_v4l2_allocator_alloc_mmap()
869 gst_v4l2_allocator_reset_size (allocator, group); in gst_v4l2_allocator_alloc_mmap()
871 return group; in gst_v4l2_allocator_alloc_mmap()
877 _cleanup_failed_alloc (allocator, group); in gst_v4l2_allocator_alloc_mmap()
887 GstV4l2MemoryGroup *group; in gst_v4l2_allocator_alloc_dmabuf() local
892 group = gst_v4l2_allocator_alloc (allocator); in gst_v4l2_allocator_alloc_dmabuf()
894 if (group == NULL) in gst_v4l2_allocator_alloc_dmabuf()
897 for (i = 0; i < group->n_mem; i++) { in gst_v4l2_allocator_alloc_dmabuf()
901 if (group->mem[i] == NULL) { in gst_v4l2_allocator_alloc_dmabuf()
905 expbuf.index = group->buffer.index; in gst_v4l2_allocator_alloc_dmabuf()
915 group->mem[i] = (GstMemory *) _v4l2mem_new (0, GST_ALLOCATOR (allocator), in gst_v4l2_allocator_alloc_dmabuf()
916 NULL, group->planes[i].length, 0, group->planes[i].data_offset, in gst_v4l2_allocator_alloc_dmabuf()
917 group->planes[i].length - group->planes[i].data_offset, i, NULL, in gst_v4l2_allocator_alloc_dmabuf()
918 expbuf.fd, group); in gst_v4l2_allocator_alloc_dmabuf()
924 group->mems_allocated++; in gst_v4l2_allocator_alloc_dmabuf()
926 g_assert (gst_is_v4l2_memory (group->mem[i])); in gst_v4l2_allocator_alloc_dmabuf()
927 mem = (GstV4l2Memory *) group->mem[i]; in gst_v4l2_allocator_alloc_dmabuf()
930 group->planes[i].length, GST_FD_MEMORY_FLAG_DONT_CLOSE); in gst_v4l2_allocator_alloc_dmabuf()
931 gst_memory_resize (dma_mem, group->planes[i].data_offset, in gst_v4l2_allocator_alloc_dmabuf()
932 group->planes[i].length - group->planes[i].data_offset); in gst_v4l2_allocator_alloc_dmabuf()
937 group->mem[i] = dma_mem; in gst_v4l2_allocator_alloc_dmabuf()
940 gst_v4l2_allocator_reset_size (allocator, group); in gst_v4l2_allocator_alloc_dmabuf()
942 return group; in gst_v4l2_allocator_alloc_dmabuf()
952 _cleanup_failed_alloc (allocator, group); in gst_v4l2_allocator_alloc_dmabuf()
959 GstV4l2MemoryGroup * group) in gst_v4l2_allocator_clear_dmabufin() argument
967 for (i = 0; i < group->n_mem; i++) { in gst_v4l2_allocator_clear_dmabufin()
969 mem = (GstV4l2Memory *) group->mem[i]; in gst_v4l2_allocator_clear_dmabufin()
972 group->buffer.index, mem->dmafd, i); in gst_v4l2_allocator_clear_dmabufin()
981 group->planes[i].length = 0; in gst_v4l2_allocator_clear_dmabufin()
982 group->planes[i].bytesused = 0; in gst_v4l2_allocator_clear_dmabufin()
983 group->planes[i].m.fd = -1; in gst_v4l2_allocator_clear_dmabufin()
984 group->planes[i].data_offset = 0; in gst_v4l2_allocator_clear_dmabufin()
988 group->buffer.bytesused = 0; in gst_v4l2_allocator_clear_dmabufin()
989 group->buffer.length = 0; in gst_v4l2_allocator_clear_dmabufin()
990 group->buffer.m.fd = -1; in gst_v4l2_allocator_clear_dmabufin()
997 GstV4l2MemoryGroup *group; in gst_v4l2_allocator_alloc_dmabufin() local
1002 group = gst_v4l2_allocator_alloc (allocator); in gst_v4l2_allocator_alloc_dmabufin()
1004 if (group == NULL) in gst_v4l2_allocator_alloc_dmabufin()
1009 for (i = 0; i < group->n_mem; i++) { in gst_v4l2_allocator_alloc_dmabufin()
1010 if (group->mem[i] == NULL) { in gst_v4l2_allocator_alloc_dmabufin()
1011 group->mem[i] = (GstMemory *) _v4l2mem_new (0, GST_ALLOCATOR (allocator), in gst_v4l2_allocator_alloc_dmabufin()
1012 NULL, 0, 0, 0, 0, i, NULL, -1, group); in gst_v4l2_allocator_alloc_dmabufin()
1018 group->mems_allocated++; in gst_v4l2_allocator_alloc_dmabufin()
1021 gst_v4l2_allocator_clear_dmabufin (allocator, group); in gst_v4l2_allocator_alloc_dmabufin()
1023 return group; in gst_v4l2_allocator_alloc_dmabufin()
1028 GstV4l2MemoryGroup * group) in gst_v4l2_allocator_clear_userptr() argument
1036 for (i = 0; i < group->n_mem; i++) { in gst_v4l2_allocator_clear_userptr()
1037 mem = (GstV4l2Memory *) group->mem[i]; in gst_v4l2_allocator_clear_userptr()
1040 G_GSIZE_FORMAT, group->buffer.index, mem->data, i, mem->mem.size); in gst_v4l2_allocator_clear_userptr()
1046 group->planes[i].length = 0; in gst_v4l2_allocator_clear_userptr()
1047 group->planes[i].bytesused = 0; in gst_v4l2_allocator_clear_userptr()
1048 group->planes[i].m.userptr = 0; in gst_v4l2_allocator_clear_userptr()
1052 group->buffer.bytesused = 0; in gst_v4l2_allocator_clear_userptr()
1053 group->buffer.length = 0; in gst_v4l2_allocator_clear_userptr()
1054 group->buffer.m.userptr = 0; in gst_v4l2_allocator_clear_userptr()
1061 GstV4l2MemoryGroup *group; in gst_v4l2_allocator_alloc_userptr() local
1066 group = gst_v4l2_allocator_alloc (allocator); in gst_v4l2_allocator_alloc_userptr()
1068 if (group == NULL) in gst_v4l2_allocator_alloc_userptr()
1073 for (i = 0; i < group->n_mem; i++) { in gst_v4l2_allocator_alloc_userptr()
1075 if (group->mem[i] == NULL) { in gst_v4l2_allocator_alloc_userptr()
1076 group->mem[i] = (GstMemory *) _v4l2mem_new (0, GST_ALLOCATOR (allocator), in gst_v4l2_allocator_alloc_userptr()
1077 NULL, 0, 0, 0, 0, i, NULL, -1, group); in gst_v4l2_allocator_alloc_userptr()
1083 group->mems_allocated++; in gst_v4l2_allocator_alloc_userptr()
1086 gst_v4l2_allocator_clear_userptr (allocator, group); in gst_v4l2_allocator_alloc_userptr()
1088 return group; in gst_v4l2_allocator_alloc_userptr()
1093 GstV4l2MemoryGroup * group, gint n_mem, GstMemory ** dma_mem) in gst_v4l2_allocator_import_dmabuf() argument
1101 if (group->n_mem != n_mem) in gst_v4l2_allocator_import_dmabuf()
1104 for (i = 0; i < group->n_mem; i++) { in gst_v4l2_allocator_import_dmabuf()
1116 group->buffer.index, dmafd, i); in gst_v4l2_allocator_import_dmabuf()
1118 mem = (GstV4l2Memory *) group->mem[i]; in gst_v4l2_allocator_import_dmabuf()
1127 group->planes[i].length = maxsize; in gst_v4l2_allocator_import_dmabuf()
1128 group->planes[i].bytesused = size + offset; in gst_v4l2_allocator_import_dmabuf()
1129 group->planes[i].m.fd = dmafd; in gst_v4l2_allocator_import_dmabuf()
1130 group->planes[i].data_offset = offset; in gst_v4l2_allocator_import_dmabuf()
1135 group->buffer.bytesused = group->planes[0].bytesused; in gst_v4l2_allocator_import_dmabuf()
1136 group->buffer.length = group->planes[0].length; in gst_v4l2_allocator_import_dmabuf()
1137 group->buffer.m.fd = group->planes[0].m.userptr; in gst_v4l2_allocator_import_dmabuf()
1140 g_assert (group->planes[0].data_offset == 0); in gst_v4l2_allocator_import_dmabuf()
1142 group->buffer.length = group->n_mem; in gst_v4l2_allocator_import_dmabuf()
1150 group->n_mem); in gst_v4l2_allocator_import_dmabuf()
1162 GstV4l2MemoryGroup * group, gsize img_size, int n_planes, in gst_v4l2_allocator_import_userptr() argument
1172 if (V4L2_TYPE_IS_MULTIPLANAR (obj->type) && n_planes != group->n_mem) in gst_v4l2_allocator_import_userptr()
1175 for (i = 0; i < group->n_mem; i++) { in gst_v4l2_allocator_import_userptr()
1187 G_GSIZE_FORMAT, group->buffer.index, data[i], i, psize); in gst_v4l2_allocator_import_userptr()
1189 mem = (GstV4l2Memory *) group->mem[i]; in gst_v4l2_allocator_import_userptr()
1195 group->planes[i].length = maxsize; in gst_v4l2_allocator_import_userptr()
1196 group->planes[i].bytesused = psize; in gst_v4l2_allocator_import_userptr()
1197 group->planes[i].m.userptr = (unsigned long) data[i]; in gst_v4l2_allocator_import_userptr()
1198 group->planes[i].data_offset = 0; in gst_v4l2_allocator_import_userptr()
1203 group->buffer.bytesused = group->planes[0].bytesused; in gst_v4l2_allocator_import_userptr()
1204 group->buffer.length = group->planes[0].length; in gst_v4l2_allocator_import_userptr()
1205 group->buffer.m.userptr = group->planes[0].m.userptr; in gst_v4l2_allocator_import_userptr()
1207 group->buffer.length = group->n_mem; in gst_v4l2_allocator_import_userptr()
1215 n_planes, group->n_mem); in gst_v4l2_allocator_import_userptr()
1231 GstV4l2MemoryGroup *group = allocator->groups[i]; in gst_v4l2_allocator_flush() local
1234 if (IS_QUEUED (group->buffer)) { in gst_v4l2_allocator_flush()
1235 UNSET_QUEUED (group->buffer); in gst_v4l2_allocator_flush()
1237 gst_v4l2_allocator_reset_group (allocator, group); in gst_v4l2_allocator_flush()
1239 for (n = 0; n < group->n_mem; n++) in gst_v4l2_allocator_flush()
1240 gst_memory_unref (group->mem[n]); in gst_v4l2_allocator_flush()
1250 GstV4l2MemoryGroup * group) in gst_v4l2_allocator_qbuf() argument
1260 for (i = 0; i < group->n_mem; i++) in gst_v4l2_allocator_qbuf()
1261 group->planes[i].bytesused = in gst_v4l2_allocator_qbuf()
1262 gst_memory_get_sizes (group->mem[i], NULL, NULL); in gst_v4l2_allocator_qbuf()
1264 group->buffer.bytesused = gst_memory_get_sizes (group->mem[0], NULL, NULL); in gst_v4l2_allocator_qbuf()
1268 for (i = 0; i < group->n_mem; i++) in gst_v4l2_allocator_qbuf()
1269 gst_memory_ref (group->mem[i]); in gst_v4l2_allocator_qbuf()
1271 if (obj->ioctl (obj->video_fd, VIDIOC_QBUF, &group->buffer) < 0) { in gst_v4l2_allocator_qbuf()
1273 group->buffer.index, g_strerror (errno)); in gst_v4l2_allocator_qbuf()
1276 for (i = 0; i < group->n_mem; i++) in gst_v4l2_allocator_qbuf()
1277 gst_memory_unref (group->mem[i]); in gst_v4l2_allocator_qbuf()
1280 if (IS_QUEUED (group->buffer)) { in gst_v4l2_allocator_qbuf()
1283 UNSET_QUEUED (group->buffer); in gst_v4l2_allocator_qbuf()
1289 group->buffer.index, group->buffer.flags); in gst_v4l2_allocator_qbuf()
1291 if (!IS_QUEUED (group->buffer)) { in gst_v4l2_allocator_qbuf()
1294 SET_QUEUED (group->buffer); in gst_v4l2_allocator_qbuf()
1310 GstV4l2MemoryGroup *group = NULL; in gst_v4l2_allocator_dqbuf() local
1325 group = allocator->groups[buffer.index]; in gst_v4l2_allocator_dqbuf()
1327 if (!IS_QUEUED (group->buffer)) { in gst_v4l2_allocator_dqbuf()
1333 group->buffer = buffer; in gst_v4l2_allocator_dqbuf()
1338 if (IS_QUEUED (group->buffer)) { in gst_v4l2_allocator_dqbuf()
1341 UNSET_QUEUED (group->buffer); in gst_v4l2_allocator_dqbuf()
1345 group->buffer.m.planes = group->planes; in gst_v4l2_allocator_dqbuf()
1346 memcpy (group->planes, buffer.m.planes, sizeof (planes)); in gst_v4l2_allocator_dqbuf()
1348 group->planes[0].bytesused = group->buffer.bytesused; in gst_v4l2_allocator_dqbuf()
1349 group->planes[0].length = group->buffer.length; in gst_v4l2_allocator_dqbuf()
1350 g_assert (sizeof (group->planes[0].m) == sizeof (group->buffer.m)); in gst_v4l2_allocator_dqbuf()
1351 memcpy (&group->planes[0].m, &group->buffer.m, sizeof (group->buffer.m)); in gst_v4l2_allocator_dqbuf()
1356 gst_v4l2_allocator_reset_size (allocator, group); in gst_v4l2_allocator_dqbuf()
1359 for (i = 0; i < group->n_mem; i++) { in gst_v4l2_allocator_dqbuf()
1364 group->planes[i].length, group->planes[i].bytesused, in gst_v4l2_allocator_dqbuf()
1365 group->planes[i].data_offset); in gst_v4l2_allocator_dqbuf()
1367 offset = group->planes[i].data_offset; in gst_v4l2_allocator_dqbuf()
1369 if (group->planes[i].bytesused >= group->planes[i].data_offset) { in gst_v4l2_allocator_dqbuf()
1370 size = group->planes[i].bytesused - group->planes[i].data_offset; in gst_v4l2_allocator_dqbuf()
1374 G_GUINT32_FORMAT, group->planes[i].bytesused, in gst_v4l2_allocator_dqbuf()
1375 group->planes[i].data_offset); in gst_v4l2_allocator_dqbuf()
1376 size = group->planes[i].bytesused; in gst_v4l2_allocator_dqbuf()
1379 if (G_LIKELY (size + offset <= group->mem[i]->maxsize)) in gst_v4l2_allocator_dqbuf()
1380 gst_memory_resize (group->mem[i], offset, size); in gst_v4l2_allocator_dqbuf()
1386 "bug.", size, group->mem[i]->maxsize); in gst_v4l2_allocator_dqbuf()
1387 gst_memory_resize (group->mem[i], 0, group->mem[i]->maxsize); in gst_v4l2_allocator_dqbuf()
1393 for (i = 0; i < group->n_mem; i++) in gst_v4l2_allocator_dqbuf()
1394 gst_memory_unref (group->mem[i]); in gst_v4l2_allocator_dqbuf()
1396 *group_out = group; in gst_v4l2_allocator_dqbuf()
1451 GstV4l2MemoryGroup * group) in gst_v4l2_allocator_reset_group() argument
1455 gst_v4l2_allocator_clear_userptr (allocator, group); in gst_v4l2_allocator_reset_group()
1458 gst_v4l2_allocator_clear_dmabufin (allocator, group); in gst_v4l2_allocator_reset_group()
1467 gst_v4l2_allocator_reset_size (allocator, group); in gst_v4l2_allocator_reset_group()