Lines Matching refs:alloc
101 check_fd (GstKMSAllocator * alloc) in check_fd() argument
103 return alloc->priv->fd > -1; in check_fd()
257 GstKMSAllocator *alloc; in gst_kms_allocator_free() local
260 alloc = GST_KMS_ALLOCATOR (allocator); in gst_kms_allocator_free()
263 gst_kms_allocator_memory_reset (alloc, kmsmem); in gst_kms_allocator_free()
271 GstKMSAllocator *alloc; in gst_kms_allocator_set_property() local
273 alloc = GST_KMS_ALLOCATOR (object); in gst_kms_allocator_set_property()
279 alloc->priv->fd = dup (fd); in gst_kms_allocator_set_property()
292 GstKMSAllocator *alloc; in gst_kms_allocator_get_property() local
294 alloc = GST_KMS_ALLOCATOR (object); in gst_kms_allocator_get_property()
298 g_value_set_int (value, alloc->priv->fd); in gst_kms_allocator_get_property()
309 GstKMSAllocator *alloc; in gst_kms_allocator_finalize() local
311 alloc = GST_KMS_ALLOCATOR (obj); in gst_kms_allocator_finalize()
313 gst_kms_allocator_clear_cache (GST_ALLOCATOR (alloc)); in gst_kms_allocator_finalize()
315 if (alloc->priv->dmabuf_alloc) in gst_kms_allocator_finalize()
316 gst_object_unref (alloc->priv->dmabuf_alloc); in gst_kms_allocator_finalize()
318 if (check_fd (alloc)) in gst_kms_allocator_finalize()
319 close (alloc->priv->fd); in gst_kms_allocator_finalize()
350 GstKMSAllocator *alloc; in gst_kms_memory_map() local
355 alloc = (GstKMSAllocator *) mem->allocator; in gst_kms_memory_map()
357 if (!check_fd (alloc)) in gst_kms_memory_map()
371 err = drmIoctl (alloc->priv->fd, DRM_IOCTL_MODE_MAP_DUMB, &arg); in gst_kms_memory_map()
373 GST_ERROR_OBJECT (alloc, "Failed to get offset of buffer object: %s %d", in gst_kms_memory_map()
379 PROT_READ | PROT_WRITE, MAP_SHARED, alloc->priv->fd, arg.offset); in gst_kms_memory_map()
381 GST_ERROR_OBJECT (alloc, "Failed to map dumb buffer object: %s %d", in gst_kms_memory_map()
413 GstAllocator *alloc; in gst_kms_allocator_init() local
415 alloc = GST_ALLOCATOR_CAST (allocator); in gst_kms_allocator_init()
420 alloc->mem_type = GST_KMS_MEMORY_TYPE; in gst_kms_allocator_init()
421 alloc->mem_map = gst_kms_memory_map; in gst_kms_allocator_init()
422 alloc->mem_unmap = gst_kms_memory_unmap; in gst_kms_allocator_init()
431 GstAllocator *alloc; in gst_kms_allocator_new() local
433 alloc = g_object_new (GST_TYPE_KMS_ALLOCATOR, "name", in gst_kms_allocator_new()
435 gst_object_ref_sink (alloc); in gst_kms_allocator_new()
437 return alloc; in gst_kms_allocator_new()
443 gst_kms_allocator_add_fb (GstKMSAllocator * alloc, GstKMSMemory * kmsmem, in gst_kms_allocator_add_fb() argument
469 GST_DEBUG_OBJECT (alloc, "bo handles: %d, %d, %d, %d", bo_handles[0], in gst_kms_allocator_add_fb()
501 ret = drmModeAddFB2WithModifiers (alloc->priv->fd, w, h, _fmt, _handles, in gst_kms_allocator_add_fb()
507 ret = drmModeAddFB2WithModifiers (alloc->priv->fd, w, h, fmt, bo_handles, in gst_kms_allocator_add_fb()
510 ret = drmModeAddFB2 (alloc->priv->fd, w, h, fmt, bo_handles, pitches, in gst_kms_allocator_add_fb()
513 ret = drmModeAddFB2 (alloc->priv->fd, w, h, DRM_FORMAT_NV15, bo_handles, in gst_kms_allocator_add_fb()
517 GST_ERROR_OBJECT (alloc, "Failed to bind to framebuffer: %s (%d)", in gst_kms_allocator_add_fb()
528 GstKMSAllocator *alloc; in gst_kms_allocator_bo_alloc() local
536 alloc = GST_KMS_ALLOCATOR (allocator); in gst_kms_allocator_bo_alloc()
540 if (!gst_kms_allocator_memory_create (alloc, kmsmem, vinfo)) { in gst_kms_allocator_bo_alloc()
548 if (!gst_kms_allocator_add_fb (alloc, kmsmem, vinfo->offset, vinfo)) in gst_kms_allocator_bo_alloc()
563 GstKMSAllocator *alloc; in gst_kms_allocator_dmabuf_import() local
579 alloc = GST_KMS_ALLOCATOR (allocator); in gst_kms_allocator_dmabuf_import()
581 ret = drmPrimeFDToHandle (alloc->priv->fd, prime_fds[i], in gst_kms_allocator_dmabuf_import()
587 if (!gst_kms_allocator_add_fb (alloc, kmsmem, offsets, vinfo)) in gst_kms_allocator_dmabuf_import()
599 err = drmIoctl (alloc->priv->fd, DRM_IOCTL_GEM_CLOSE, &arg); in gst_kms_allocator_dmabuf_import()
612 GST_ERROR_OBJECT (alloc, "Failed to import prime fd %d: %s (%d)", in gst_kms_allocator_dmabuf_import()
628 GstKMSAllocator *alloc = GST_KMS_ALLOCATOR (allocator); in gst_kms_allocator_dmabuf_export() local
637 ret = drmPrimeHandleToFD (alloc->priv->fd, kmsmem->bo->handle, in gst_kms_allocator_dmabuf_export()
642 if (G_UNLIKELY (alloc->priv->dmabuf_alloc == NULL)) in gst_kms_allocator_dmabuf_export()
643 alloc->priv->dmabuf_alloc = gst_dmabuf_allocator_new (); in gst_kms_allocator_dmabuf_export()
645 mem = gst_dmabuf_allocator_alloc (alloc->priv->dmabuf_alloc, prime_fd, in gst_kms_allocator_dmabuf_export()
652 GST_DEBUG_OBJECT (alloc, "Exported bo handle %d as %d", kmsmem->bo->handle, in gst_kms_allocator_dmabuf_export()
660 GST_ERROR_OBJECT (alloc, "Failed to export bo handle %d: %s (%d)", in gst_kms_allocator_dmabuf_export()
675 cached_kmsmem_disposed_cb (GstKMSAllocator * alloc, GstMiniObject * obj) in cached_kmsmem_disposed_cb() argument
677 GST_OBJECT_LOCK (alloc); in cached_kmsmem_disposed_cb()
678 alloc->priv->mem_cache = g_list_remove (alloc->priv->mem_cache, obj); in cached_kmsmem_disposed_cb()
679 GST_OBJECT_UNLOCK (alloc); in cached_kmsmem_disposed_cb()
685 GstKMSAllocator *alloc = GST_KMS_ALLOCATOR (allocator); in gst_kms_allocator_clear_cache() local
688 GST_OBJECT_LOCK (alloc); in gst_kms_allocator_clear_cache()
690 iter = alloc->priv->mem_cache; in gst_kms_allocator_clear_cache()
694 (GstMiniObjectNotify) cached_kmsmem_disposed_cb, alloc); in gst_kms_allocator_clear_cache()
700 g_list_free (alloc->priv->mem_cache); in gst_kms_allocator_clear_cache()
701 alloc->priv->mem_cache = NULL; in gst_kms_allocator_clear_cache()
703 GST_OBJECT_UNLOCK (alloc); in gst_kms_allocator_clear_cache()
711 GstKMSAllocator *alloc = GST_KMS_ALLOCATOR (allocator); in gst_kms_allocator_cache() local
713 GST_OBJECT_LOCK (alloc); in gst_kms_allocator_cache()
715 (GstMiniObjectNotify) cached_kmsmem_disposed_cb, alloc); in gst_kms_allocator_cache()
716 alloc->priv->mem_cache = g_list_prepend (alloc->priv->mem_cache, mem); in gst_kms_allocator_cache()
717 GST_OBJECT_UNLOCK (alloc); in gst_kms_allocator_cache()