Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libva
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
libva
Commits
c4a03c10
Commit
c4a03c10
authored
Apr 27, 2010
by
Ren Zhaohan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libva backend
parent
24914b55
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
105 additions
and
20 deletions
+105
-20
va/Android.mk
va/Android.mk
+9
-4
va/android/va_android.c
va/android/va_android.c
+60
-7
va/va.c
va/va.c
+9
-1
va/va.h
va/va.h
+11
-0
va/va_android.h
va/va_android.h
+4
-4
va/va_backend.h
va/va_backend.h
+10
-3
va/x11/va_dricommon.h
va/x11/va_dricommon.h
+2
-1
No files found.
va/Android.mk
View file @
c4a03c10
LOCAL_PATH
:=
$(
call
my-dir
)
LOCAL_PATH
:=
$(
call
my-dir
)
LIBVA_MINOR_VERSION
:=
31
LIBVA_MAJOR_VERSION
:=
0
include
$(CLEAR_VARS)
include
$(CLEAR_VARS)
LOCAL_SRC_FILES
:=
\
LOCAL_SRC_FILES
:=
\
android/va_android.c
va.c
\
va_trace.c
\
android/va_android.c
\
LOCAL_CFLAGS
+=
-DHAVE_CONFIG_H
\
LOCAL_CFLAGS
+=
-DHAVE_CONFIG_H
\
-DIN_LIBVA
\
-DIN_LIBVA
\
-DANDROID
\
LOCAL_C_INCLUDES
+=
\
LOCAL_C_INCLUDES
+=
\
$(TOPDIR)
kernel/include
\
$(TOPDIR)
kernel/include
\
$(TARGET_OUT_HEADERS)
/libva
\
$(TARGET_OUT_HEADERS)
/libva
\
$(TOPDIR)
kernel/include/drm
$(TOPDIR)
kernel/include/drm
LOCAL_CC
:=
g++
LOCAL_COPY_HEADERS_TO
:=
libva/va
LOCAL_COPY_HEADERS_TO
:=
libva/va
...
@@ -21,6 +25,7 @@ LOCAL_COPY_HEADERS := \
...
@@ -21,6 +25,7 @@ LOCAL_COPY_HEADERS := \
va.h
\
va.h
\
va_backend.h
\
va_backend.h
\
va_version.h.in
\
va_version.h.in
\
x11/va_dricommon.h
\
va_android.h
va_android.h
LOCAL_MODULE
:=
libva_android
LOCAL_MODULE
:=
libva_android
...
...
va/android/va_android.c
View file @
c4a03c10
...
@@ -23,9 +23,10 @@
...
@@ -23,9 +23,10 @@
*/
*/
#define _GNU_SOURCE 1
#define _GNU_SOURCE 1
#include "../va.h"
#include "va.h"
#include "../va_backend.h"
#include "va_backend.h"
#include "../va_android.h"
#include "va_android.h"
#include "x11/va_dricommon.h"
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdarg.h>
...
@@ -34,10 +35,44 @@
...
@@ -34,10 +35,44 @@
#include <sys/types.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <fcntl.h>
#include <dlfcn.h>
#include <errno.h>
#include <errno.h>
#define CHECK_SYMBOL(func) { if (!func) printf("func %s not found\n", #func); return VA_STATUS_ERROR_UNKNOWN; }
#define DEVICE_NAME "/dev/dri/card0"
static
VADisplayContextP
pDisplayContexts
=
NULL
;
static
VADisplayContextP
pDisplayContexts
=
NULL
;
static
int
open_device
(
char
*
dev_name
)
{
struct
stat
st
;
int
fd
;
if
(
-
1
==
stat
(
dev_name
,
&
st
))
{
printf
(
"Cannot identify '%s': %d, %s
\n
"
,
dev_name
,
errno
,
strerror
(
errno
));
return
-
1
;
}
if
(
!
S_ISCHR
(
st
.
st_mode
))
{
printf
(
"%s is no device
\n
"
,
dev_name
);
return
-
1
;
}
fd
=
open
(
dev_name
,
O_RDWR
/* required */
|
O_NONBLOCK
,
0
);
if
(
-
1
==
fd
)
{
fprintf
(
stderr
,
"Cannot open '%s': %d, %s
\n
"
,
dev_name
,
errno
,
strerror
(
errno
));
return
-
1
;
}
return
fd
;
}
static
int
va_DisplayContextIsValid
(
static
int
va_DisplayContextIsValid
(
VADisplayContextP
pDisplayContext
VADisplayContextP
pDisplayContext
)
)
...
@@ -78,7 +113,7 @@ static VAStatus va_DisplayContextGetDriverName (
...
@@ -78,7 +113,7 @@ static VAStatus va_DisplayContextGetDriverName (
unsigned
int
device_id
;
unsigned
int
device_id
;
char
driver_name
[
64
];
char
driver_name
[
64
];
}
devices
[]
=
{
}
devices
[]
=
{
{
0x8086
,
0x4100
,
"
android
"
},
{
0x8086
,
0x4100
,
"
psb
"
},
};
};
if
(
driver_name
)
if
(
driver_name
)
...
@@ -111,13 +146,27 @@ VADisplay vaGetDisplay (
...
@@ -111,13 +146,27 @@ VADisplay vaGetDisplay (
pDisplayContext
=
pDisplayContext
->
pNext
;
pDisplayContext
=
pDisplayContext
->
pNext
;
}
}
if
(
!
dpy
)
if
(
!
dpy
)
{
{
/* create new entry */
/* create new entry */
VADriverContextP
pDriverContext
;
VADriverContextP
pDriverContext
;
struct
dri_state
*
dri_state
;
pDisplayContext
=
(
VADisplayContextP
)
calloc
(
1
,
sizeof
(
*
pDisplayContext
));
pDisplayContext
=
(
VADisplayContextP
)
calloc
(
1
,
sizeof
(
*
pDisplayContext
));
pDriverContext
=
(
VADriverContextP
)
calloc
(
1
,
sizeof
(
*
pDriverContext
));
pDriverContext
=
(
VADriverContextP
)
calloc
(
1
,
sizeof
(
*
pDriverContext
));
if
(
pDisplayContext
&&
pDriverContext
)
dri_state
=
(
struct
dri_state
*
)
calloc
(
1
,
sizeof
(
*
dri_state
));
/* assgin necessary dri_state struct variable */
dri_state
->
driConnectedFlag
=
VA_DRI2
;
dri_state
->
fd
=
open_device
(
DEVICE_NAME
);
dri_state
->
createDrawable
=
NULL
;
dri_state
->
destroyDrawable
=
NULL
;
dri_state
->
swapBuffer
=
NULL
;
dri_state
->
getRenderingBuffer
=
NULL
;
dri_state
->
close
=
NULL
;
if
(
pDisplayContext
&&
pDriverContext
&&
dri_state
)
{
{
pDisplayContext
->
vadpy_magic
=
VA_DISPLAY_MAGIC
;
pDisplayContext
->
vadpy_magic
=
VA_DISPLAY_MAGIC
;
...
@@ -128,6 +177,7 @@ VADisplay vaGetDisplay (
...
@@ -128,6 +177,7 @@ VADisplay vaGetDisplay (
pDisplayContext
->
vaDestroy
=
va_DisplayContextDestroy
;
pDisplayContext
->
vaDestroy
=
va_DisplayContextDestroy
;
pDisplayContext
->
vaGetDriverName
=
va_DisplayContextGetDriverName
;
pDisplayContext
->
vaGetDriverName
=
va_DisplayContextGetDriverName
;
pDisplayContexts
=
pDisplayContext
;
pDisplayContexts
=
pDisplayContext
;
pDriverContext
->
dri_state
=
dri_state
;
dpy
=
(
VADisplay
)
pDisplayContext
;
dpy
=
(
VADisplay
)
pDisplayContext
;
}
}
else
else
...
@@ -136,13 +186,14 @@ VADisplay vaGetDisplay (
...
@@ -136,13 +186,14 @@ VADisplay vaGetDisplay (
free
(
pDisplayContext
);
free
(
pDisplayContext
);
if
(
pDriverContext
)
if
(
pDriverContext
)
free
(
pDriverContext
);
free
(
pDriverContext
);
if
(
dri_state
)
free
(
dri_state
);
}
}
}
}
return
dpy
;
return
dpy
;
}
}
#define CTX(dpy) (((VADisplayContextP)dpy)->pDriverContext)
#define CTX(dpy) (((VADisplayContextP)dpy)->pDriverContext)
#define CHECK_DISPLAY(dpy) if( !vaDisplayIsValid(dpy) ) { return VA_STATUS_ERROR_INVALID_DISPLAY; }
#define CHECK_DISPLAY(dpy) if( !vaDisplayIsValid(dpy) ) { return VA_STATUS_ERROR_INVALID_DISPLAY; }
...
@@ -155,7 +206,8 @@ static int vaDisplayIsValid(VADisplay dpy)
...
@@ -155,7 +206,8 @@ static int vaDisplayIsValid(VADisplay dpy)
VAStatus
vaPutSurface
(
VAStatus
vaPutSurface
(
VADisplay
dpy
,
VADisplay
dpy
,
VASurfaceID
surface
,
VASurfaceID
surface
,
Surface
*
draw
,
/* Android Surface/Window */
//Surface *draw, /* Android Surface/Window */
void
*
draw
,
short
srcx
,
short
srcx
,
short
srcy
,
short
srcy
,
unsigned
short
srcw
,
unsigned
short
srcw
,
...
@@ -178,3 +230,4 @@ VAStatus vaPutSurface (
...
@@ -178,3 +230,4 @@ VAStatus vaPutSurface (
destx
,
desty
,
destw
,
desth
,
destx
,
desty
,
destw
,
desth
,
cliprects
,
number_cliprects
,
flags
);
cliprects
,
number_cliprects
,
flags
);
}
}
va/va.c
View file @
c4a03c10
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#define _GNU_SOURCE 1
#define _GNU_SOURCE 1
#include "va.h"
#include "va.h"
#include "va_backend.h"
#include "va_backend.h"
#include "config.h"
#include <assert.h>
#include <assert.h>
#include <stdarg.h>
#include <stdarg.h>
...
@@ -54,6 +55,10 @@ extern int trace_flag;
...
@@ -54,6 +55,10 @@ extern int trace_flag;
trace_func(__VA_ARGS__); \
trace_func(__VA_ARGS__); \
}
}
#define VA_MAJOR_VERSION (0)
#define VA_MINOR_VERSION (31)
#define VA_VERSION_S "0.31.1"
static
int
vaDisplayIsValid
(
VADisplay
dpy
)
static
int
vaDisplayIsValid
(
VADisplay
dpy
)
{
{
VADisplayContextP
pDisplayContext
=
(
VADisplayContextP
)
dpy
;
VADisplayContextP
pDisplayContext
=
(
VADisplayContextP
)
dpy
;
...
@@ -153,8 +158,11 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
...
@@ -153,8 +158,11 @@ static VAStatus va_openDriver(VADisplay dpy, char *driver_name)
strncat
(
driver_path
,
DRIVER_EXTENSION
,
strlen
(
DRIVER_EXTENSION
)
);
strncat
(
driver_path
,
DRIVER_EXTENSION
,
strlen
(
DRIVER_EXTENSION
)
);
va_infoMessage
(
"Trying to open %s
\n
"
,
driver_path
);
va_infoMessage
(
"Trying to open %s
\n
"
,
driver_path
);
#ifndef ANDROID
handle
=
dlopen
(
driver_path
,
RTLD_NOW
|
RTLD_GLOBAL
|
RTLD_NODELETE
);
handle
=
dlopen
(
driver_path
,
RTLD_NOW
|
RTLD_GLOBAL
|
RTLD_NODELETE
);
#else
handle
=
dlopen
(
driver_path
,
RTLD_NOW
|
RTLD_GLOBAL
);
#endif
if
(
!
handle
)
if
(
!
handle
)
{
{
/* Don't give errors for non-existing files */
/* Don't give errors for non-existing files */
...
...
va/va.h
View file @
c4a03c10
...
@@ -1789,6 +1789,17 @@ VAStatus vaSetDisplayAttributes (
...
@@ -1789,6 +1789,17 @@ VAStatus vaSetDisplayAttributes (
int
num_attributes
int
num_attributes
);
);
#ifdef ANDROID
#define Display unsigned int
#define Drawable unsigned int
#define XID unsigned int
#define Bool int
#define Status int
#define True 1
#define False 0
#define Xfree(ptr) free((ptr))
#endif
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
va/va_android.h
View file @
c4a03c10
...
@@ -2,16 +2,16 @@
...
@@ -2,16 +2,16 @@
#define _VA_ANDROID_H_
#define _VA_ANDROID_H_
#include <va/va.h>
#include <va/va.h>
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
#endif
#endif
//#define Surface void
/*
/*
* Returns a suitable VADisplay for VA API
* Returns a suitable VADisplay for VA API
*/
*/
VADisplay
vaGetDisplay
(
VADisplay
vaGetDisplay
(
void
*
dpy
Display
*
dpy
);
);
/*
/*
...
@@ -25,7 +25,8 @@ VADisplay vaGetDisplay (
...
@@ -25,7 +25,8 @@ VADisplay vaGetDisplay (
VAStatus
vaPutSurface
(
VAStatus
vaPutSurface
(
VADisplay
dpy
,
VADisplay
dpy
,
VASurfaceID
surface
,
VASurfaceID
surface
,
Surface
*
draw
,
/* Android Window/Surface */
//Surface *draw, /* Android Window/Surface */
void
*
draw
,
short
srcx
,
short
srcx
,
short
srcy
,
short
srcy
,
unsigned
short
srcw
,
unsigned
short
srcw
,
...
@@ -38,7 +39,6 @@ VAStatus vaPutSurface (
...
@@ -38,7 +39,6 @@ VAStatus vaPutSurface (
unsigned
int
number_cliprects
,
/* number of clip rects in the clip list */
unsigned
int
number_cliprects
,
/* number of clip rects in the clip list */
unsigned
int
flags
/* PutSurface flags */
unsigned
int
flags
/* PutSurface flags */
);
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
va/va_backend.h
View file @
c4a03c10
...
@@ -30,15 +30,18 @@
...
@@ -30,15 +30,18 @@
#define _VA_BACKEND_H_
#define _VA_BACKEND_H_
#include <va/va.h>
#include <va/va.h>
#ifndef ANDROID
#include <X11/Xlib.h>
#include <X11/Xlib.h>
#endif
#include <linux/videodev2.h>
#include <linux/videodev2.h>
#include <ui/Surface.h>
class
Surface
;
typedef
struct
VADriverContext
*
VADriverContextP
;
typedef
struct
VADriverContext
*
VADriverContextP
;
typedef
struct
VADisplayContext
*
VADisplayContextP
;
typedef
struct
VADisplayContext
*
VADisplayContextP
;
#ifdef ANDROID
#define Surface void
#endif
struct
VADriverVTable
struct
VADriverVTable
{
{
VAStatus
(
*
vaTerminate
)
(
VADriverContextP
ctx
);
VAStatus
(
*
vaTerminate
)
(
VADriverContextP
ctx
);
...
@@ -182,7 +185,11 @@ struct VADriverVTable
...
@@ -182,7 +185,11 @@ struct VADriverVTable
VAStatus
(
*
vaPutSurface
)
(
VAStatus
(
*
vaPutSurface
)
(
VADriverContextP
ctx
,
VADriverContextP
ctx
,
VASurfaceID
surface
,
VASurfaceID
surface
,
#ifdef ANDROID
Surface
*
draw
,
/* X Drawable */
Surface
*
draw
,
/* X Drawable */
#else
Drawable
draw
,
#endif
short
srcx
,
short
srcx
,
short
srcy
,
short
srcy
,
unsigned
short
srcw
,
unsigned
short
srcw
,
...
...
va/x11/va_dricommon.h
View file @
c4a03c10
#ifndef _VA_DRICOMMON_H_
#ifndef _VA_DRICOMMON_H_
#define _VA_DRICOMMON_H_
#define _VA_DRICOMMON_H_
#ifndef ANDROID
#include <X11/Xlib.h>
#include <X11/Xlib.h>
#endif
#include <xf86drm.h>
#include <xf86drm.h>
#include <drm.h>
#include <drm.h>
#include <drm_sarea.h>
#include <drm_sarea.h>
...
...
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