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 750319 - memory: subclasses don't know map flags in unmap
memory: subclasses don't know map flags in unmap
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal blocker
: 1.5.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-06-03 08:21 UTC by Matthew Waters (ystreet00)
Modified: 2015-06-12 06:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
memory: provide a mem_unmap vfunc that takes the map flags (3.57 KB, patch)
2015-06-03 08:22 UTC, Matthew Waters (ystreet00)
committed Details | Review
memory: provide a mem_map_full that takes the GstMapInfo (4.80 KB, patch)
2015-06-03 14:26 UTC, Matthew Waters (ystreet00)
none Details | Review

Description Matthew Waters (ystreet00) 2015-06-03 08:21:58 UTC
There are gstmemory's available that operate in two memory domains and need to ensure consistent access between these domains.
    
Imagine a scenario where e.g. the GLMemory is mapped twice in both the GPU and the CPU domain.  On unmap or a subsequent map, it would like to ensure that the most recent data is available in the memory domain requested.  Either by flushing the writes and/or initiating a DMA transfer.  Without knowing which domain is being unmapped, the memory does not know where the most recent data is to transfer to the other memory domain.
Comment 1 Matthew Waters (ystreet00) 2015-06-03 08:22:38 UTC
Created attachment 304466 [details] [review]
memory: provide a mem_unmap vfunc that takes the map flags
Comment 2 Matthew Waters (ystreet00) 2015-06-03 10:43:51 UTC
commit 7130230ddb349d0ca7942abdba26b7558df055d1
Author: Matthew Waters <matthew@centricular.com>
Date:   Wed Jun 3 18:03:36 2015 +1000

    memory: provide a mem_unmap function that takes the flags to unmap
    
    There are gstmemory's available that operate in two memory domains
    and need to ensure consistent access between these domains.
    
    Imagine a scenario where e.g. the GLMemory is mapped twice in both
    the GPU and the CPU domain.  On unmap or a subsequent map, it would
    like to ensure that the most recent data is available in the memory
    domain requested.  Either by flushing the writes and/or initiating a
    DMA transfer.  Without knowing which domain is being unmapped, the
    memory does not know where the most recent data is to transfer to
    the other memory domain.
    
    Note: this still does not allow downgrading a memory map.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=750319
Comment 3 Tim-Philipp Müller 2015-06-03 13:30:52 UTC
Maybe we should pass the MapInfo * pointer instead of just the flags? And also add a MapFull function with a MapInfo * pointer?

That would also allow the memory subclass to use the four private pointers in the MapInfo struct in case that's ever useful.
Comment 4 Matthew Waters (ystreet00) 2015-06-03 14:26:34 UTC
Created attachment 304522 [details] [review]
memory: provide a mem_map_full that takes the GstMapInfo

Something like this?  One potential question API-wise is whether to keep the map flags outside the map info or not in the MapFull function definition.  I've decided not in this patch.  gst_memory_map will set them before it calls the subclass.
Comment 5 Tim-Philipp Müller 2015-06-09 11:18:22 UTC
Should decide before 1.6 if we want a full full with MapInfo * or just keep the Unmap with flags as it is now.
Comment 6 Matthew Waters (ystreet00) 2015-06-12 06:15:11 UTC
Pushed a slightly different implementation that sets as much info on the GstMapInfo as it can before calling the subclass.

commit d61ba381187beba4256a73962338a51b53b754a4
Author: Matthew Waters <matthew@centricular.com>
Date:   Thu Jun 4 00:03:16 2015 +1000

    memory: provide a mem_map_full that takes the GstMapInfo
    
    Follow up of 7130230ddb349d0ca7942abdba26b7558df055d1
    
    Provide the memory implementation the GstMapInfo that will be used to
    map/unmap the memory.  This allows the memory implementation to use
    some scratch space in GstMapInfo to e.g. track different map/unmap
    behaviour or store extra implementation defined data about the map
    in use.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=750319