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
4e542a65
Commit
4e542a65
authored
Dec 22, 2017
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10390 from alalek:ocl_option_buffer_rect
parents
636b7ec0
534645a1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
ocl.cpp
modules/core/src/ocl.cpp
+14
-12
No files found.
modules/core/src/ocl.cpp
View file @
4e542a65
...
@@ -151,6 +151,8 @@ struct DummyImpl
...
@@ -151,6 +151,8 @@ struct DummyImpl
#define CV_OCL_DBG_CHECK_(expr, check_result) expr; (void)check_result
#define CV_OCL_DBG_CHECK_(expr, check_result) expr; (void)check_result
#define CV_OCL_DBG_CHECK(expr) do { cl_int __cl_result = (expr); CV_OCL_CHECK_RESULT(__cl_result, #expr); } while (0)
#define CV_OCL_DBG_CHECK(expr) do { cl_int __cl_result = (expr); CV_OCL_CHECK_RESULT(__cl_result, #expr); } while (0)
static
const
bool
CV_OPENCL_DISABLE_BUFFER_RECT_OPERATIONS
=
false
;
#else // HAVE_OPENCL
#else // HAVE_OPENCL
#ifndef _DEBUG
#ifndef _DEBUG
...
@@ -225,6 +227,15 @@ static const bool CV_OPENCL_CACHE_CLEANUP = utils::getConfigurationParameterBool
...
@@ -225,6 +227,15 @@ static const bool CV_OPENCL_CACHE_CLEANUP = utils::getConfigurationParameterBool
static
const
bool
CV_OPENCL_VALIDATE_BINARY_PROGRAMS_VALUE
=
utils
::
getConfigurationParameterBool
(
"OPENCV_OPENCL_VALIDATE_BINARY_PROGRAMS"
,
false
);
static
const
bool
CV_OPENCL_VALIDATE_BINARY_PROGRAMS_VALUE
=
utils
::
getConfigurationParameterBool
(
"OPENCV_OPENCL_VALIDATE_BINARY_PROGRAMS"
,
false
);
#endif
#endif
// Option to disable calls clEnqueueReadBufferRect / clEnqueueWriteBufferRect / clEnqueueCopyBufferRect
static
const
bool
CV_OPENCL_DISABLE_BUFFER_RECT_OPERATIONS
=
utils
::
getConfigurationParameterBool
(
"OPENCV_OPENCL_DISABLE_BUFFER_RECT_OPERATIONS"
,
#ifdef __APPLE__
true
#else
false
#endif
);
#endif // HAVE_OPENCL
#endif // HAVE_OPENCL
struct
UMat2D
struct
UMat2D
...
@@ -5206,8 +5217,7 @@ public:
...
@@ -5206,8 +5217,7 @@ public:
CV_OCL_CHECK
(
clEnqueueReadBuffer
(
q
,
(
cl_mem
)
u
->
handle
,
CL_TRUE
,
CV_OCL_CHECK
(
clEnqueueReadBuffer
(
q
,
(
cl_mem
)
u
->
handle
,
CL_TRUE
,
srcrawofs
,
total
,
alignedPtr
.
getAlignedPtr
(),
0
,
0
,
0
));
srcrawofs
,
total
,
alignedPtr
.
getAlignedPtr
(),
0
,
0
,
0
));
}
}
#ifdef __APPLE__
else
if
(
CV_OPENCL_DISABLE_BUFFER_RECT_OPERATIONS
)
else
{
{
const
size_t
padding
=
CV_OPENCL_DATA_PTR_ALIGNMENT
;
const
size_t
padding
=
CV_OPENCL_DATA_PTR_ALIGNMENT
;
size_t
new_srcrawofs
=
srcrawofs
&
~
(
padding
-
1
);
size_t
new_srcrawofs
=
srcrawofs
&
~
(
padding
-
1
);
...
@@ -5224,7 +5234,6 @@ public:
...
@@ -5224,7 +5234,6 @@ public:
for
(
size_t
i
=
0
;
i
<
new_sz
[
1
];
i
++
)
for
(
size_t
i
=
0
;
i
<
new_sz
[
1
];
i
++
)
memcpy
(
(
uchar
*
)
dstptr
+
i
*
new_dststep
[
0
],
ptr
+
i
*
new_srcstep
[
0
]
+
membuf_ofs
,
new_sz
[
0
]);
memcpy
(
(
uchar
*
)
dstptr
+
i
*
new_dststep
[
0
],
ptr
+
i
*
new_srcstep
[
0
]
+
membuf_ofs
,
new_sz
[
0
]);
}
}
#else
else
else
{
{
AlignedDataPtr2D
<
false
,
true
>
alignedPtr
((
uchar
*
)
dstptr
,
new_sz
[
1
],
new_sz
[
0
],
new_dststep
[
0
],
CV_OPENCL_DATA_PTR_ALIGNMENT
);
AlignedDataPtr2D
<
false
,
true
>
alignedPtr
((
uchar
*
)
dstptr
,
new_sz
[
1
],
new_sz
[
0
],
new_dststep
[
0
],
CV_OPENCL_DATA_PTR_ALIGNMENT
);
...
@@ -5236,7 +5245,6 @@ public:
...
@@ -5236,7 +5245,6 @@ public:
new_dststep
[
0
],
0
,
new_dststep
[
0
],
0
,
ptr
,
0
,
0
,
0
));
ptr
,
0
,
0
,
0
));
}
}
#endif
}
}
}
}
...
@@ -5343,8 +5351,7 @@ public:
...
@@ -5343,8 +5351,7 @@ public:
CV_OCL_CHECK
(
clEnqueueWriteBuffer
(
q
,
(
cl_mem
)
u
->
handle
,
CL_TRUE
,
CV_OCL_CHECK
(
clEnqueueWriteBuffer
(
q
,
(
cl_mem
)
u
->
handle
,
CL_TRUE
,
dstrawofs
,
total
,
alignedPtr
.
getAlignedPtr
(),
0
,
0
,
0
));
dstrawofs
,
total
,
alignedPtr
.
getAlignedPtr
(),
0
,
0
,
0
));
}
}
#ifdef __APPLE__
else
if
(
CV_OPENCL_DISABLE_BUFFER_RECT_OPERATIONS
)
else
{
{
const
size_t
padding
=
CV_OPENCL_DATA_PTR_ALIGNMENT
;
const
size_t
padding
=
CV_OPENCL_DATA_PTR_ALIGNMENT
;
size_t
new_dstrawofs
=
dstrawofs
&
~
(
padding
-
1
);
size_t
new_dstrawofs
=
dstrawofs
&
~
(
padding
-
1
);
...
@@ -5366,7 +5373,6 @@ public:
...
@@ -5366,7 +5373,6 @@ public:
CV_OCL_CHECK
(
clEnqueueWriteBuffer
(
q
,
(
cl_mem
)
u
->
handle
,
CL_TRUE
,
CV_OCL_CHECK
(
clEnqueueWriteBuffer
(
q
,
(
cl_mem
)
u
->
handle
,
CL_TRUE
,
new_dstrawofs
,
total
,
ptr
,
0
,
0
,
0
));
new_dstrawofs
,
total
,
ptr
,
0
,
0
,
0
));
}
}
#else
else
else
{
{
AlignedDataPtr2D
<
true
,
false
>
alignedPtr
((
uchar
*
)
srcptr
,
new_sz
[
1
],
new_sz
[
0
],
new_srcstep
[
0
],
CV_OPENCL_DATA_PTR_ALIGNMENT
);
AlignedDataPtr2D
<
true
,
false
>
alignedPtr
((
uchar
*
)
srcptr
,
new_sz
[
1
],
new_sz
[
0
],
new_srcstep
[
0
],
CV_OPENCL_DATA_PTR_ALIGNMENT
);
...
@@ -5378,7 +5384,6 @@ public:
...
@@ -5378,7 +5384,6 @@ public:
new_srcstep
[
0
],
0
,
new_srcstep
[
0
],
0
,
ptr
,
0
,
0
,
0
));
ptr
,
0
,
0
,
0
));
}
}
#endif
}
}
u
->
markHostCopyObsolete
(
true
);
u
->
markHostCopyObsolete
(
true
);
#ifdef HAVE_OPENCL_SVM
#ifdef HAVE_OPENCL_SVM
...
@@ -5520,8 +5525,7 @@ public:
...
@@ -5520,8 +5525,7 @@ public:
CV_OCL_CHECK
(
retval
=
clEnqueueCopyBuffer
(
q
,
(
cl_mem
)
src
->
handle
,
(
cl_mem
)
dst
->
handle
,
CV_OCL_CHECK
(
retval
=
clEnqueueCopyBuffer
(
q
,
(
cl_mem
)
src
->
handle
,
(
cl_mem
)
dst
->
handle
,
srcrawofs
,
dstrawofs
,
total
,
0
,
0
,
0
));
srcrawofs
,
dstrawofs
,
total
,
0
,
0
,
0
));
}
}
#ifdef __APPLE__
else
if
(
CV_OPENCL_DISABLE_BUFFER_RECT_OPERATIONS
)
else
{
{
const
size_t
padding
=
CV_OPENCL_DATA_PTR_ALIGNMENT
;
const
size_t
padding
=
CV_OPENCL_DATA_PTR_ALIGNMENT
;
size_t
new_srcrawofs
=
srcrawofs
&
~
(
padding
-
1
);
size_t
new_srcrawofs
=
srcrawofs
&
~
(
padding
-
1
);
...
@@ -5554,7 +5558,6 @@ public:
...
@@ -5554,7 +5558,6 @@ public:
CV_OCL_CHECK
(
clEnqueueWriteBuffer
(
q
,
(
cl_mem
)
dst
->
handle
,
CL_TRUE
,
CV_OCL_CHECK
(
clEnqueueWriteBuffer
(
q
,
(
cl_mem
)
dst
->
handle
,
CL_TRUE
,
new_dstrawofs
,
dst_total
,
dstptr
,
0
,
0
,
0
));
new_dstrawofs
,
dst_total
,
dstptr
,
0
,
0
,
0
));
}
}
#else
else
else
{
{
CV_OCL_CHECK
(
retval
=
clEnqueueCopyBufferRect
(
q
,
(
cl_mem
)
src
->
handle
,
(
cl_mem
)
dst
->
handle
,
CV_OCL_CHECK
(
retval
=
clEnqueueCopyBufferRect
(
q
,
(
cl_mem
)
src
->
handle
,
(
cl_mem
)
dst
->
handle
,
...
@@ -5563,7 +5566,6 @@ public:
...
@@ -5563,7 +5566,6 @@ public:
new_dststep
[
0
],
0
,
new_dststep
[
0
],
0
,
0
,
0
,
0
));
0
,
0
,
0
));
}
}
#endif
}
}
if
(
retval
==
CL_SUCCESS
)
if
(
retval
==
CL_SUCCESS
)
{
{
...
...
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