GNOME Bugzilla – Bug 750319
memory: subclasses don't know map flags in unmap
Last modified: 2015-06-12 06:15:32 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.
Created attachment 304466 [details] [review] memory: provide a mem_unmap vfunc that takes the map flags
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
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.
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.
Should decide before 1.6 if we want a full full with MapInfo * or just keep the Unmap with flags as it is now.
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