Hi,
I thought I'd share this with you as DirectFB since 1.2 did not accelerate
with preallocated surfaces anymore, but the support is even better than ever
now.
-------- Original Message --------
Subject: {DirectFB} PreAlloc: Revival of real preallocated memory support also
via secure fusion
Date: 30 Oct 2011 14:11:24 +0100
From: [email protected]
To: [email protected]
New commits:
http://git.directfb.org/?p=core/DirectFB.git;a=commit;h=5094bdbdb6d8536e9b4fc398f81f53b0a2a0583d
commit 5094bdbdb6d8536e9b4fc398f81f53b0a2a0583d
Author: Denis Oliver Kropp <[email protected]>
Date: Tue Oct 25 11:25:37 2011 +0200
PreAlloc: Revival of real preallocated memory support also via secure fusion
Revive preallocated surface pool and add a new preallocated surface pool
bridge
for transfer between preallocated (slave) memory and surface allocations in
the
master process.
IDirectFBSurface
- Allow DSCAPS_STATIC_ALLOC to be used in combination with
DSDESC_PREALLOCATED
to request that any further Lock() will always return the original
preallocated
buffer pointer even if that requires lots of transfers back and forth.
Otherwise,
the allocation might be moved to shared memory. This especially requires
the
application to correctly use Lock() with the READ and WRITE flags as
appropriate.
Core
- Add PreAlloc() function to surface pool interface to check the surface
description
for a supported preallocation, e.g. DSCAPS_VIDEOONLY for a preallocation
in an
accelerated pool. This is called on the slave side!
- Add preallocated_pool_id to the surface configuration that is filled by
the
slave to indicate in which pool it likes to create a preallocated surface.
Also add more fields to the preallocated entries like offset or phys.
- Add CoreSlave interface for master to call into slave processes. This
contains
methods for sending or receiving data, e.g. to or from preallocated
memory areas.
Access to such areas is checked against permissions, though the master
should be
a trusted process in the DirectFB session :-)
- For preallocated surfaces allocate the buffers during their creation in
the
preallocated pool already to ensure this already exists as the first
allocation.
- Tweak dfb_surface_buffer_find_allocation() to implement
DSCAPS_STATIC_ALLOC and
to avoid locking non-shared preallocated allocations from other
processes. It
is possible to create a preallocated hardware buffer from a slave and use
hardware
accceleration with this in the master via secure fusion, if implemented
by the
surface pool(s) for the hardware accelerator.
PreAlloc Pool Bridge
- The preallocated surface pool bridge uses CoreSlave::Get/PutData() to
transfer
line by line data from/to other allocations either using Lock/Unlock or
Write/Read
on the surface pool.
PreAlloc Pool
- Add preallocPrealloc() implemention in the preallocated surface pool to
fill
out the new surface configuration entries for the preallocated buffers
before
the CreateSurface call goes to master.
- In preallocTestConfig() check the core identity against the buffer
identity
and reject allocation for other processes than the creator of the
preallocated
surface. This should not happen though.
- In preallocAllocateBuffer() remove CSALF_VOLATILE flag from allocation to
ensure the allocation will not be removed before the buffer is destroyed.
- In preallocLock() check the core identity against the buffer identity and
reject locking for other processes than the creator of the preallocated
surface. This should not happen though.
--
Change ICoreSurface::PreLockBuffer, PreReadBuffer and PreWriteBuffer to take
a CoreSurfaceBuffer object rather than the buffer index which is not safe
against race conditions.
In ICoreSurface::PreLockBuffer, PreReadBuffer and PreWriteBuffer check for
the surface buffer being decoupled and return DFB_BUFFEREMPTY.
In dfb_surface_read/write/lock_buffer() work around a race condition until
the allocations are objects as well by looping as long as DFB_BUFFEREMPTY
is returned.
--
Core
- Add dfb_core_memory_permissions_add/remove/check() for management of areas
where the master may read/write within slave memory via CoreSlave
interface.
- Put secure/insecure mode into shared memory and fail in slave init when
the configuration does not match.
- In Core_GetIdentity() return local core identity if stack is empty.
- In Core_PushIdentity() if argument is 0, push local identity on stack.
- Use Core_PushIdentity(0) before locking surfaces for actual execution of
software or hardware rendering functions.
- Add new initialize/join calls for surface pools to pass context data.
- Add dfb_surface_pools_lookup() for lookup by ID.
- Implement priorities for surface pool bridges.
dfbtest_prealloc
- Add dfbtest_prealloc for testing preallocated surfaces with and without
the usage of DSCAPS_STATIC_ALLOC.
dfbtest_resize
- Add Read/Write tests to dfbtest_resize that revealed a few bugs being
fixed
in this commit.
src/core/.gitignore | 2 +
src/core/CoreDFB.flux | 7 +
src/core/CoreDFB_includes.h | 72 ++++++
src/core/CoreDFB_real.cpp | 12 +-
src/core/CoreSlave.flux | 60 +++++
src/core/CoreSlave_includes.h | 37 +++
src/core/CoreSlave_real.cpp | 94 ++++++++
src/core/CoreSurface.flux | 18 +-
src/core/CoreSurface_real.cpp | 36 ++--
src/core/Makefile.am | 9 +-
src/core/core.c | 171 +++++++++++++-
src/core/core.h | 37 +++-
src/core/gfxcard.c | 14 +-
src/core/prealloc_surface_pool.c | 87 ++++++-
src/core/prealloc_surface_pool_bridge.c | 393 +++++++++++++++++++++++++++++++
src/core/surface.c | 43 +++-
src/core/surface.h | 16 +-
src/core/surface_buffer.c | 112 ++++++++-
src/core/surface_buffer.h | 5 +
src/core/surface_core.c | 58 +++--
src/core/surface_core.h | 52 ++++
src/core/surface_pool.c | 127 +++++++++-
src/core/surface_pool.h | 29 +++
src/core/surface_pool_bridge.c | 108 +++++++--
src/core/surface_pool_bridge.h | 2 +
src/display/idirectfbsurface.c | 57 +++++
src/display/idirectfbsurface.h | 4 +
src/gfx/generic/generic.c | 10 +-
src/idirectfb.c | 116 ++++-----
tests/Makefile.am | 4 +
tests/dfbtest_prealloc.c | 296 +++++++++++++++++++++++
tests/dfbtest_resize.c | 17 ++
32 files changed, 1892 insertions(+), 213 deletions(-)
_______________________________________________
directfb-cvs mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-cvs
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev