Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
eacadf0e
Commit
eacadf0e
authored
Sep 24, 2019
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core(ocl): add flag OPENCV_OPENCL_ENABLE_MEM_USE_HOST_PTR
to control CL_MEM_USE_HOST_PTR usage
parent
3cf91851
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
ocl.cpp
modules/core/src/ocl.cpp
+14
-3
No files found.
modules/core/src/ocl.cpp
View file @
eacadf0e
...
...
@@ -267,6 +267,9 @@ static const String getBuildExtraOptions()
return
param_buildExtraOptions
;
}
static
const
bool
CV_OPENCL_ENABLE_MEM_USE_HOST_PTR
=
utils
::
getConfigurationParameterBool
(
"OPENCV_OPENCL_ENABLE_MEM_USE_HOST_PTR"
,
true
);
static
const
size_t
CV_OPENCL_ALIGNMENT_MEM_USE_HOST_PTR
=
utils
::
getConfigurationParameterSizeT
(
"OPENCV_OPENCL_ALIGNMENT_MEM_USE_HOST_PTR"
,
4
);
#endif // HAVE_OPENCL
struct
UMat2D
...
...
@@ -4675,6 +4678,9 @@ public:
bool
allocate
(
UMatData
*
u
,
int
accessFlags
,
UMatUsageFlags
usageFlags
)
const
CV_OVERRIDE
{
#ifndef HAVE_OPENCL
return
false
;
#else
if
(
!
u
)
return
false
;
...
...
@@ -4749,8 +4755,12 @@ public:
#endif
{
tempUMatFlags
=
UMatData
::
TEMP_UMAT
;
if
(
u
->
origdata
==
cv
::
alignPtr
(
u
->
origdata
,
4
)
// There are OpenCL runtime issues for less aligned data
&&
!
(
u
->
originalUMatData
&&
u
->
originalUMatData
->
handle
)
// Avoid sharing of host memory between OpenCL buffers
if
(
CV_OPENCL_ENABLE_MEM_USE_HOST_PTR
// There are OpenCL runtime issues for less aligned data
&&
(
CV_OPENCL_ALIGNMENT_MEM_USE_HOST_PTR
!=
0
&&
u
->
origdata
==
cv
::
alignPtr
(
u
->
origdata
,
(
int
)
CV_OPENCL_ALIGNMENT_MEM_USE_HOST_PTR
))
// Avoid sharing of host memory between OpenCL buffers
&&
!
(
u
->
originalUMatData
&&
u
->
originalUMatData
->
handle
)
)
{
handle
=
clCreateBuffer
(
ctx_handle
,
CL_MEM_USE_HOST_PTR
|
createFlags
,
...
...
@@ -4780,6 +4790,7 @@ public:
u
->
markHostCopyObsolete
(
true
);
opencl_allocator_stats
.
onAllocate
(
u
->
size
);
return
true
;
#endif // HAVE_OPENCL
}
/*void sync(UMatData* u) const
...
...
@@ -4908,7 +4919,7 @@ public:
(
CL_MAP_READ
|
CL_MAP_WRITE
),
0
,
u
->
size
,
0
,
0
,
0
,
&
retval
);
CV_OCL_CHECK_RESULT
(
retval
,
cv
::
format
(
"clEnqueueMapBuffer(handle=%p, sz=%lld) => %p"
,
(
void
*
)
u
->
handle
,
(
long
long
int
)
u
->
size
,
data
).
c_str
());
CV_Assert
(
u
->
origdata
==
data
);
CV_Assert
(
u
->
origdata
==
data
&&
"Details: https://github.com/opencv/opencv/issues/6293"
);
if
(
u
->
originalUMatData
)
{
CV_Assert
(
u
->
originalUMatData
->
data
==
data
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment