Commit Graph

31 Commits

Author SHA1 Message Date
Hoppe, Mateusz e1eaf3ded0 Fix bug in VA sharing multithreaded scenario
- createGraphicsAllocationFromSharedHandle was not threadsafe,
instead of reusing BufferObject for a single handle when
multiple threads were creating memory objects from a single VASurface,
new BO could be created and placed in container with BOs for reuse.
This was leading to errors in ioctl calls.

- add lock for following set of operations:
 1. find BufferObject with a given handle in container
 2. create shared BO when not found
 3. add shared BO to container
 prevents creating multiple BOs for a single handle

- replace recursive mutex with regular mutex as mutex shouldn't
be locked recursively

Change-Id: I0937e2abf3bf1c672c6d77422d46e441f7216a68
2018-08-02 12:55:05 +02:00
Hoppe, Mateusz 4441387969 Refactor allocateGraphicsMemoryInPreferredPool
- extend AllocationType to code necessary flags
- remove redundant args
- refactor Buffer::create()

Change-Id: Ic4b2e0931fad8198ad1cf4f79de210d815048ccf
2018-07-31 08:05:55 +02:00
Dunajski, Bartosz 512978768e Pass renderCompressed information to GMM for 64kb allocations
Change-Id: I56302055c028e919bceeb3333557cab7451e1d09
2018-07-23 11:28:43 +02:00
Hoppe, Mateusz f125c8ff45 Add allocateGraphicsMemoryInDevicePool
- do not always expect failures in tests with failure injections
there is retry mechanism for some cases

Change-Id: If7589d2dacc41216d2f3b08f861209bbab179615
2018-07-20 13:00:00 +02:00
Hoppe, Mateusz 407227959a Add memoryPool to GraphicsAllocation
- new ExtendableEnum struct that serves as enum but can
be extended with values
- decrease dependencies on graphics_allocation.h header -
 use forward class declaration when possible
- memoryPool indicates what kind of memory is allocated
for a given GraphicsAllocation

Change-Id: I7a707c28dc4544cc73abc5f0ed5263ba5be17452
2018-07-17 20:10:33 +02:00
Hoppe, Mateusz 55a045ebe1 Refactor graphics memory allocation scheme
- replace createGraphicsAllocationWithRequiredBitness with more general
methodallocateGraphicsMemoryInPreferredPool based on passed
 AllocationData
- proper flags for allocation selected based on AllocationType

- remove allocateGraphicsMemory(size_t size, size_t alignment)
and use allocateGraphicsMemory(size_t size) instead where default
alignment is sufficient, otherwise use full options version:
allocateGraphicsMemory(size_t size, size_t alignment,
 bool forcePin, bool uncacheable)

Change-Id: I2da891f372ee181253cb840568a61b33c0d71fc9
2018-07-11 15:48:05 +02:00
Hoppe, Mateusz 684b1d75ba Refactor GraphicsAllocation::AllocationType and allocationType enums
- change GraphicsAllocatoin::AllocationType to scoped enumeration
so that ALLOCATION_TYPE_ prefix in every enum value can be removed
- all accesses are typed (example AllocationType::IMAGE)
- Rename allocationType to AllocationUsage to eliminate confusion
with multiple AllocationType enums / types

Change-Id: I16003297ecfcb0aaa5779ad00706c5d983914bbe
2018-07-06 13:00:08 +02:00
Dunajski, Bartosz e18e9fb94e Move static methods from Gmm to new GmmHelper class
Change-Id: I84fbe94f0e1072324164086b456c71a46ae5040c
2018-06-27 16:46:09 +02:00
Koska, Andrzej fe56c57318 Tracking the internal allocation when creating a buffer
This fix prevents the creation of a buffer from the pointer
obtained from clEnqueueMapBuffer

Change-Id: I203f2d5263eeb02fe0d73bc9db159438af3cf1fc
2018-06-08 07:33:07 +02:00
Mrozek, Michal d2817427af Remove createInternalGraphicsAllocation function.
- Route directly to allocate32BitGraphicsMemory

Change-Id: Ia6872bae655c530ff06b0ec270f419ca91d005ce
2018-05-21 04:11:43 +02:00
Hoppe, Mateusz baa7640c90 Rename MemoryType enum to AllocationOrigin
- better describes the meaning of INTERNAL and
EXTERNAL allocation types

Change-Id: Iacb97f5a9d63f45b60bc404cc6dd32c7ebd72ab3
2018-05-14 12:38:52 +02:00
Mrozek, Michal 06287af541 DrmGemCloseWorker - remove not used modes of operation.
Change-Id: Ie8524a8411f1022785536a523aad3e4ebea3a349
2018-05-10 15:34:20 +02:00
Mrozek, Michal 3f59acf54a [19/n] Internal 4GB allocator.
- Allocator now uses uint64_t instead of void*.
- This is due to the fact that it is required to work on 64 bit addresses
in 32 bit dll.

Change-Id: Ia715ea7913efc95a2974aff8dff390203d8125a8
2018-03-28 14:38:23 +02:00
Hoppe, Mateusz aa088da8d3 User pointer read-only memory fix
- do not store fragment in map until hostPointerValidation
is done
- set pointers to nullptr after delete in cleanOsHandles

Change-Id: I0bf99c3215c4b91ce059bb4e94716671c49f1946
2018-03-28 12:42:31 +02:00
Hoppe, Mateusz eec43f65a7 Free allocated BOs for read-only user pointer
- when pinning fails with EFAULT due to read-only memory
used for allocation (BO), mark the allocated fragments
to be freed, as cpu copy will be used.
- prevent possible leaks

Change-Id: I200ba276da5e3a8557df28fe2e411ef30d69a86a
2018-03-20 17:31:18 +01:00
Dunajski, Bartosz 7e2fa723a5 Cleanup casts and memsets in linux code
Change-Id: Ie7ed0232a2974152fde13438aeb0830d43eddf2a
2018-03-20 11:02:14 +01:00
Artur Harasimiuk 507544a999 add i915 uapi headers
Change-Id: I8b19ebc56c5aa394758177641b2946f7fca13eff
2018-03-16 17:30:48 +01:00
Mrozek, Michal 385fcdb7ca Fix Linux Global Mem Size computation.
- we need to use getContextParam instead of get aperture size.

Change-Id: I83f39654019ef63eb5fc59566c013ffd5cb5ba25
2018-03-15 17:42:56 +01:00
Hoppe, Mateusz 756aafe3dd Fix indexing of allocated bos in populateOsHandles
- when fragment is already allocated, allcoating is
skipped and index is incremented,
separate index must be used for allocated bos array

Change-Id: I856a99ba4ebdad5375829a43d721c7e1490b18d3
2018-03-15 12:13:29 +00:00
Hoppe, Mateusz a1a20a3b34 Service read only memory passed as host_ptr
- read only memory cannot be used for allocation,
Oses cannot create graphics alocation for such memory
- if memory allocation fails for host_ptr passed
to enqueueWrite calls, then try doing new allocation
and copy host_ptr on cpu

Change-Id: I415a4673ae1319ea8f77e53bd8fba7489fe85218
2018-03-14 13:16:36 +01:00
Mrozek, Michal 2119d5db08 [13/n] Internal 4GB allocator.
- Add common function for all memory managers to obtain internal heap base.

Change-Id: Iacdaaf598e8786dad046b3f4550f9c80ce3f15d9
2018-03-12 16:19:24 +01:00
Slawomir Milczarek f217c9198c Add support for resource lock / unlock on Linux OS
This commit fixes the issue with image contents writes
in the configuration of CSR HW with AUB dump.

Change-Id: Id0c4f36d4f9eee5175267384d42cb75bf41062f3
2018-03-01 15:01:49 +01:00
Mrozek, Michal 0b8234117b Add support for createInternalGraphicsAllocation in DRM
Change-Id: I84090dfc4774506dee993e9c0c78c336367c43fd
2018-03-01 11:30:38 +01:00
Mrozek, Michal 0b6acb4d7a [3/n] Internal 4GB allocator.
-Do not create allocator 32 bit with every DRM memory manager
-This is not needed for apps that do not use this.
-Add allocation of allocator to setForce32BitAddressing

Change-Id: I836b60f6b74eecf678cc9d56851797d0db176107
2018-02-28 16:54:49 +01:00
Mrozek, Michal 0e3f2bf361 [4/n] Internal 4GB allocator
-Allocate internal 4GB allocator when DRM memory manager is created.

Change-Id: I072e81de219415a6c02ab1fd1b41b6a8338ee67c
2018-02-28 12:52:31 +01:00
Mrozek, Michal 19c68a608f [1/n] Internal 4GB allocator
- Add new entry point in memory manager for internal allocations.
- Route to allocate32BitGraphicsMemory
- Add new enum to control memory region
- Change mm to memoryManager

Change-Id: I2ee069aa9baf7f69f652022e026569ec4fdb9d77
2018-02-27 16:35:12 +01:00
Mrozek, Michal 75d883c075 Do not use virtual functions in constructor.
Change-Id: Ic720843b3b290b234577e1bc4913dfc07a75733c
2018-02-21 10:26:17 +01:00
Zdanowicz, Zbigniew e42d43953d Restrict system memory allocations to certain address range
Change-Id: Ibe8c1183368ce48f2c820d0f1a71f0b15703ffcd
2018-01-26 15:16:41 +01:00
Zdanowicz, Zbigniew 21f92d8258 Add preemption WA to make CSR surface uncacheable
Change-Id: Ia468c6f5df16522c3bc9aae22802895f2badc431
2018-01-05 22:44:26 +01:00
Mrozek, Michal 03646887bf Make UNRECOVERABLE_IF fail in tests.
- Fix tests that were triggering the UNRECOVERABLE scenario
- Change UNRECOVERABLE to DEBUG_BREAK in some places

Change-Id: I479baac4941b485af9ea81a61a1a03d2f3f42e6a
2017-12-22 11:26:06 +01:00
Brandon Fliflet 7e9ad41290 Initial commit
Change-Id: I4bf1707bd3dfeadf2c17b0a7daff372b1925ebbd
2017-12-21 00:45:38 +01:00