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
22bb5d1f
Commit
22bb5d1f
authored
Sep 10, 2015
by
Alexey Ershov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented sample build in fallback mode without interop
parent
f533c056
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
88 additions
and
11 deletions
+88
-11
OpenCVFindVA.cmake
cmake/OpenCVFindVA.cmake
+1
-1
CMakeLists.txt
samples/CMakeLists.txt
+1
-1
CMakeLists.txt
samples/va_intel/CMakeLists.txt
+1
-1
display.cpp.inc
samples/va_intel/display.cpp.inc
+71
-8
va_intel_interop.cpp
samples/va_intel/va_intel_interop.cpp
+14
-0
No files found.
cmake/OpenCVFindVA.cmake
View file @
22bb5d1f
...
...
@@ -12,7 +12,7 @@ endif()
if
(
VA_INCLUDE_DIR
)
set
(
HAVE_VA TRUE
)
set
(
VA_LIBRARIES
"-lva"
)
set
(
VA_LIBRARIES
"-lva"
"-lva-x11"
)
else
()
set
(
HAVE_VA FALSE
)
message
(
WARNING
"libva installation is not found."
)
...
...
samples/CMakeLists.txt
View file @
22bb5d1f
...
...
@@ -22,7 +22,7 @@ if((NOT ANDROID) AND HAVE_OPENGL)
add_subdirectory
(
opengl
)
endif
()
if
(
UNIX AND NOT ANDROID AND
HAVE_VA_INTEL
)
if
(
UNIX AND NOT ANDROID
AND
(
HAVE_VA OR HAVE_VA_INTEL
)
)
add_subdirectory
(
va_intel
)
endif
()
...
...
samples/va_intel/CMakeLists.txt
View file @
22bb5d1f
...
...
@@ -17,7 +17,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
set
(
the_target
"example_
${
project
}
_
${
name
}
"
)
add_executable
(
${
the_target
}
${
srcs
}
)
ocv_target_link_libraries
(
${
the_target
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS
}
${
VA_INTEL_LIBRARIES
}
)
ocv_target_link_libraries
(
${
the_target
}
${
OPENCV_LINKER_LIBS
}
${
OPENCV_VA_INTEL_SAMPLES_REQUIRED_DEPS
}
${
VA_
LIBRARIES
}
${
VA_
INTEL_LIBRARIES
}
)
set_target_properties
(
${
the_target
}
PROPERTIES
OUTPUT_NAME
"
${
project
}
-example-
${
name
}
"
...
...
samples/va_intel/display.cpp.inc
View file @
22bb5d1f
...
...
@@ -7,25 +7,39 @@
#include <sys/types.h>
#include <unistd.h>
#include <va/va.h>
#include <va/va_drm.h>
#include "cvconfig.h"
#define VA_INTEL_PCI_DIR "/sys/bus/pci/devices"
#define VA_INTEL_DRI_DIR "/dev/dri/"
#define VA_INTEL_PCI_DISPLAY_CONTROLLER_CLASS 0x03
#include <va/va.h>
#if defined(HAVE_VA_INTEL)
# include <va/va_drm.h>
#elif defined(HAVE_VA)
# include <va/va_x11.h>
# include <X11/Xlib.h>
#endif //HAVE_VA_INTEL / HAVE_VA
namespace
va
{
static
unsigned
readId
(
const
char
*
devName
,
const
char
*
idName
);
static
int
findAdapter
(
unsigned
desiredVendorId
);
#if defined(HAVE_VA_INTEL) || defined(HAVE_VA)
bool
openDisplay
();
void
closeDisplay
();
int
drmfd
=
-
1
;
VADisplay
display
=
NULL
;
bool
initialized
=
false
;
#endif //HAVE_VA_INTEL || HAVE_VA
#if defined(HAVE_VA_INTEL)
#define VA_INTEL_PCI_DIR "/sys/bus/pci/devices"
#define VA_INTEL_DRI_DIR "/dev/dri/"
#define VA_INTEL_PCI_DISPLAY_CONTROLLER_CLASS 0x03
static
unsigned
readId
(
const
char
*
devName
,
const
char
*
idName
);
static
int
findAdapter
(
unsigned
desiredVendorId
);
int
drmfd
=
-
1
;
class
Directory
{
typedef
int
(
*
fsort
)(
const
struct
dirent
**
,
const
struct
dirent
**
);
...
...
@@ -205,4 +219,53 @@ void closeDisplay()
}
}
#elif defined(HAVE_VA)
static
Display
*
x11Display
=
0
;
bool
openDisplay
()
{
if
(
!
initialized
)
{
display
=
0
;
x11Display
=
XOpenDisplay
(
""
);
if
(
x11Display
!=
0
)
{
display
=
vaGetDisplay
(
x11Display
);
if
(
display
)
{
int
majorVersion
=
0
,
minorVersion
=
0
;
if
(
vaInitialize
(
display
,
&
majorVersion
,
&
minorVersion
)
==
VA_STATUS_SUCCESS
)
{
initialized
=
true
;
return
true
;
}
display
=
0
;
}
XCloseDisplay
(
x11Display
);
x11Display
=
0
;
}
return
false
;
// Can't initialize X11/VA display
}
return
true
;
}
void
closeDisplay
()
{
if
(
initialized
)
{
if
(
display
)
vaTerminate
(
display
);
if
(
x11Display
)
XCloseDisplay
(
x11Display
);
display
=
0
;
x11Display
=
0
;
initialized
=
false
;
}
}
#endif // HAVE_VA_INTEL / HAVE_VA
}
// namespace va
samples/va_intel/va_intel_interop.cpp
View file @
22bb5d1f
...
...
@@ -42,6 +42,7 @@
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/core/va_intel.hpp"
#include "cvconfig.h"
#define CHECK_VASTATUS(va_status,func) \
if (va_status != VA_STATUS_SUCCESS) { \
...
...
@@ -362,14 +363,20 @@ public:
{
int
n
=
0
;
m_files
[
0
]
=
m_files
[
1
]
=
0
;
#if defined(HAVE_VA_INTEL)
m_interop
=
true
;
#elif defined(HAVE_VA)
m_interop
=
false
;
#endif //HAVE_VA_INTEL / HAVE_VA
for
(
int
i
=
1
;
i
<
m_argc
;
++
i
)
{
const
char
*
arg
=
m_argv
[
i
];
if
(
arg
[
0
]
==
'-'
)
// option
{
#if defined(HAVE_VA_INTEL)
if
(
!
strcmp
(
arg
,
"-f"
))
m_interop
=
false
;
#endif //HAVE_VA_INTEL
}
else
// parameter
{
...
...
@@ -400,8 +407,15 @@ int main(int argc, char** argv)
if
(
!
cmd
.
run
())
{
fprintf
(
stderr
,
#if defined(HAVE_VA_INTEL)
"Usage: va_intel_interop [-f] file1 file2
\n\n
"
"Interop ON/OFF version
\n\n
"
"where: -f option indicates interop is off (fallback mode); interop is on by default
\n
"
#elif defined(HAVE_VA)
"Usage: va_intel_interop file1 file2
\n\n
"
"Interop OFF only version
\n\n
"
"where:
\n
"
#endif //HAVE_VA_INTEL / HAVE_VA
" file1 is to be created, contains original surface data (NV12)
\n
"
" file2 is to be created, contains processed surface data (NV12)
\n
"
);
exit
(
0
);
...
...
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