After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 703659 - allocators: dmabuf: allow testing allocator type
allocators: dmabuf: allow testing allocator type
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
1.x
Other Linux
: Normal enhancement
: 1.1.3
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-07-05 14:34 UTC by Benjamin Gaignard
Modified: 2013-07-15 13:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
allocators: dmabuf: allow testing allocator type (2.39 KB, patch)
2013-07-05 14:34 UTC, Benjamin Gaignard
needs-work Details | Review
allocators: dmabuf: allow testing allocator type (2.16 KB, patch)
2013-07-08 10:23 UTC, Benjamin Gaignard
none Details | Review
allocators: dmabuf: allow testing allocator type (3.28 KB, patch)
2013-07-15 13:27 UTC, Benjamin Gaignard
committed Details | Review

Description Benjamin Gaignard 2013-07-05 14:34:58 UTC
Created attachment 248464 [details] [review]
allocators: dmabuf: allow testing allocator type

In decide_allocation function some element may when to test the proposed allocator type.

For example like this:
if (gst_query_get_n_allocation_params (query) > 0) {
	GstAllocator * allocator;
	GstAllocationParams params;
	gst_query_parse_nth_allocation_param (query, 0, &allocator, &params);
	if (gst_is_dmabuf_allocator(allocator))
		GST_DEBUG("got dmabuf allocator");
	else
		GST_DEBUG("got an other allocator");
}

This patch add gst_is_dmabuf_allocator function and fix indentation in .h file.
Comment 1 Tim-Philipp Müller 2013-07-05 15:06:07 UTC
Comment on attachment 248464 [details] [review]
allocators: dmabuf: allow testing allocator type

1) how is

     gst_is_dmabuf_allocator(allocator)

a huge improvement on

    GST_IS_DMABUF_ALLOCATOR (allocator)

?

2) please drop the header changes. They are unrelated, but also make things worse. Headers are not indented with gst-indent, only .c files. The headers are nicely aligned as they are now.
Comment 2 Benjamin Gaignard 2013-07-08 10:23:35 UTC
Created attachment 248601 [details] [review]
allocators: dmabuf: allow testing allocator type

if your platform doesn't support mmap GST_IS_DMABUF_ALLOCATOR isn't defined, so I wrote gst_is_dmabuf_allocator for the both cases.

The second patch fix indentations issues in .h file.
Comment 3 Sebastian Dröge (slomo) 2013-07-08 14:12:44 UTC
So, if that macro and the type and everything does not exist if support for it isn't there, you will have to conditionally compile the code anyway. And if it is available you can just use GST_IS_DMABUF_ALLOCATOR().

I don't see the point of this change :)
Comment 4 Benjamin Gaignard 2013-07-08 16:47:52 UTC
For me it is exactly like the function gst_is_dmabuf_memory above it return false if dmabuf isn't implemented.

I would like avoid propagate compilation everywhere: for example in v4l2src it should help us to know if we can use dmabuf ioctl or not.
Comment 5 Sebastian Dröge (slomo) 2013-07-09 07:24:56 UTC
Then make the macros be defined if dmabuf is not available too, and let them return sensible values for that. There's really not point in adding new API for something that already exists.
Comment 6 Benjamin Gaignard 2013-07-15 13:27:53 UTC
Created attachment 249198 [details] [review]
allocators: dmabuf: allow testing allocator type

This version of the patch export the allocator name and not create new functions to test it type.
The example in the commit header has been change to show how use allocator->mem_type field.

Make gst_is_dmabuf_memory use gst_memory_is_type instead of duplicated the code.
Comment 7 Sebastian Dröge (slomo) 2013-07-15 13:43:46 UTC
commit 84a09348832407a2f7e21dbae8cfa1e834116ccf
Author: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Date:   Mon Jul 15 15:23:17 2013 +0200

    allocators: dmabuf: allow testing allocator type
    
    In decide_allocation function some element may when to test the proposed allocator.
    For example like this:
    if (gst_query_get_n_allocation_params (query) > 0) {
        GstAllocator * allocator;
        GstAllocationParams params;
        gst_query_parse_nth_allocation_param (query, 0, &allocator, &params);
        if (g_strcmp0(allocator->mem_type, GST_ALLOCATOR_DMABUF) == 0)
                GST_DEBUG("got dmabuf allocator");
        else
                GST_DEBUG("got an other allocator");
    }
    
    https://bugzilla.gnome.org/show_bug.cgi?id=703659