memobj

Share graphics buffer memory between processes

Synopsis:

struct memobj {
    off64_t                      shm_offset;
    int                          shm_fd;
    size_t                       nbytes;
    pthread_mutex_t              mutex;
    SLIST_HEAD(, memobj_mapping) mapping_list;
    _Bool                        mutex_valid;
    struct memobj_phys_segment   *phys_pages;
    unsigned                     lock_phys_count;
    _Bool                        overrode_cache_settings;
    struct memobj_wrapper        *wrapper;
    unsigned                     is_wrapped: 1;
};

Arguments:

shm_offset
Shared memory object's offset to support page-alignment.
shm_fd
Shared memory object's file descriptor, which is created either with shm_open() or dup (_IO_DUP) into side channel when libmemobj object is wrapping or sharing an existing shared memory object. Each libmemobj has its own shm_fd, which gets closed when its corresponding memobj is closed.
nbytes
The size of the memory, in bytes.
mutex, mutex_valid
Each memobj can support multiple memory mappings, which are stored in the linked list. Any modifications to this list are protected by mutex, which is specific for each libmemobj object.
mapping_list
Link list of all memory mappings for the object. Each mapping item contains the size and virutal address of the mapped area.
phy_pages
Physical memory information, obtained via the _ MEM_OBJ_INFO procnto message.
lock_phys_count
Atomic reference count for each lock and unlock (memobj_lock_phys(), memobj_unlock_phys()) call. If the lock_phys_count is 0, physical layout information (i.e., phys_pages) aren't returned.
Note:
For objects that are created with shm_ctl(), there is no need to do any explicit lock call.
overrode_cache_settings
If true, this flag ensures that no attempt is made to map this object with the PROT_NOCACHE protection type.
wrapper
If the memobj is wrapping already existing memory (i.e., if the object was created with the memobj_create_wrapped() call), you can also specify the destructor call for the wrapped memory. The wrapped structure keeps count of all of the memobj objects created from this wrapped memory. The destructor is called on the closure of the last memobj object from this group.
is_wrapped
A flag to indicate if the memobj was created via memobj_create_wrapped().

Description:

The memobj structure works with shared memory objects, which enables to share graphics buffer memory between different processes (e.g., a client's application and Screen server).

Page updated: