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
85f37a2c
Commit
85f37a2c
authored
Nov 18, 2009
by
Gwenole Beauchesne
Committed by
Xiang, Haihao
Nov 18, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify subpicture formats. make sure the returned VAImageFormats are correctly filled in
parent
78bf8f01
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
33 deletions
+74
-33
i965_drv_video/i965_drv_video.c
i965_drv_video/i965_drv_video.c
+68
-15
i965_drv_video/i965_drv_video.h
i965_drv_video/i965_drv_video.h
+2
-1
i965_drv_video/i965_render.c
i965_drv_video/i965_render.c
+4
-17
No files found.
i965_drv_video/i965_drv_video.c
View file @
85f37a2c
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#include "i965_media.h"
#include "i965_media.h"
#include "i965_drv_video.h"
#include "i965_drv_video.h"
#include "i965_defines.h"
#define CONFIG_ID_OFFSET 0x01000000
#define CONFIG_ID_OFFSET 0x01000000
#define CONTEXT_ID_OFFSET 0x02000000
#define CONTEXT_ID_OFFSET 0x02000000
...
@@ -47,6 +48,48 @@
...
@@ -47,6 +48,48 @@
#define IMAGE_ID_OFFSET 0x0a000000
#define IMAGE_ID_OFFSET 0x0a000000
#define SUBPIC_ID_OFFSET 0x10000000
#define SUBPIC_ID_OFFSET 0x10000000
enum
{
I965_SURFACETYPE_RGBA
=
1
,
I965_SURFACETYPE_YUV
,
I965_SURFACETYPE_INDEXED
};
/* List of supported subpicture formats */
typedef
struct
{
unsigned
int
type
;
unsigned
int
format
;
VAImageFormat
va_format
;
unsigned
int
va_flags
;
}
i965_subpic_format_map_t
;
static
const
i965_subpic_format_map_t
i965_subpic_formats_map
[
I965_MAX_SUBPIC_FORMATS
+
1
]
=
{
{
I965_SURFACETYPE_INDEXED
,
I965_SURFACEFORMAT_P4A4_UNORM
,
{
VA_FOURCC
(
'I'
,
'A'
,
'4'
,
'4'
),
VA_MSB_FIRST
,
8
,
},
0
},
{
I965_SURFACETYPE_INDEXED
,
I965_SURFACEFORMAT_A4P4_UNORM
,
{
VA_FOURCC
(
'A'
,
'I'
,
'4'
,
'4'
),
VA_MSB_FIRST
,
8
,
},
0
},
};
static
const
i965_subpic_format_map_t
*
get_subpic_format
(
const
VAImageFormat
*
va_format
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
i965_subpic_formats_map
)
/
sizeof
(
i965_subpic_formats_map
[
0
]);
i
++
)
{
const
i965_subpic_format_map_t
*
const
m
=
&
i965_subpic_formats_map
[
i
];
if
(
m
->
va_format
.
fourcc
==
va_format
->
fourcc
&&
(
m
->
type
==
I965_SURFACETYPE_RGBA
?
(
m
->
va_format
.
byte_order
==
va_format
->
byte_order
&&
m
->
va_format
.
red_mask
==
va_format
->
red_mask
&&
m
->
va_format
.
green_mask
==
va_format
->
green_mask
&&
m
->
va_format
.
blue_mask
==
va_format
->
blue_mask
&&
m
->
va_format
.
alpha_mask
==
va_format
->
alpha_mask
)
:
1
))
return
m
;
}
return
NULL
;
}
VAStatus
VAStatus
i965_QueryConfigProfiles
(
VADriverContextP
ctx
,
i965_QueryConfigProfiles
(
VADriverContextP
ctx
,
VAProfile
*
profile_list
,
/* out */
VAProfile
*
profile_list
,
/* out */
...
@@ -375,12 +418,19 @@ i965_QuerySubpictureFormats(VADriverContextP ctx,
...
@@ -375,12 +418,19 @@ i965_QuerySubpictureFormats(VADriverContextP ctx,
unsigned
int
*
flags
,
/* out */
unsigned
int
*
flags
,
/* out */
unsigned
int
*
num_formats
)
/* out */
unsigned
int
*
num_formats
)
/* out */
{
{
/*support 2 subpicture formats*/
int
n
;
*
num_formats
=
2
;
format_list
[
0
].
fourcc
=
FOURCC_IA44
;
for
(
n
=
0
;
i965_subpic_formats_map
[
n
].
va_format
.
fourcc
!=
0
;
n
++
)
{
format_list
[
0
].
byte_order
=
VA_LSB_FIRST
;
const
i965_subpic_format_map_t
*
const
m
=
&
i965_subpic_formats_map
[
n
];
format_list
[
1
].
fourcc
=
FOURCC_AI44
;
if
(
format_list
)
format_list
[
1
].
byte_order
=
VA_LSB_FIRST
;
format_list
[
n
]
=
m
->
va_format
;
if
(
flags
)
flags
[
n
]
=
m
->
va_flags
;
}
if
(
num_formats
)
*
num_formats
=
n
;
return
VA_STATUS_SUCCESS
;
return
VA_STATUS_SUCCESS
;
}
}
...
@@ -398,24 +448,27 @@ i965_CreateSubpicture(VADriverContextP ctx,
...
@@ -398,24 +448,27 @@ i965_CreateSubpicture(VADriverContextP ctx,
VASubpictureID
*
subpicture
)
/* out */
VASubpictureID
*
subpicture
)
/* out */
{
{
struct
i965_driver_data
*
i965
=
i965_driver_data
(
ctx
);
struct
i965_driver_data
*
i965
=
i965_driver_data
(
ctx
);
VAStatus
vaStatus
=
VA_STATUS_SUCCESS
;
VASubpictureID
subpicID
=
NEW_SUBPIC_ID
()
VASubpictureID
subpicID
=
NEW_SUBPIC_ID
()
struct
object_subpic
*
obj_subpic
=
SUBPIC
(
subpicID
);
struct
object_subpic
*
obj_subpic
=
SUBPIC
(
subpicID
);
if
(
!
obj_subpic
)
return
VA_STATUS_ERROR_ALLOCATION_FAILED
;
struct
object_image
*
obj_image
=
IMAGE
(
image
);
struct
object_image
*
obj_image
=
IMAGE
(
image
);
if
(
!
obj_image
)
if
(
NULL
==
obj_subpic
)
{
return
VA_STATUS_ERROR_INVALID_IMAGE
;
vaStatus
=
VA_STATUS_ERROR_ALLOCATION_FAILED
;
}
const
i965_subpic_format_map_t
*
const
m
=
get_subpic_format
(
&
obj_image
->
image
.
format
);
if
(
NULL
==
obj_image
)
{
if
(
!
m
)
vaStatus
=
VA_STATUS_ERROR_ALLOCATION_FAILED
;
return
VA_STATUS_ERROR_UNKNOWN
;
/* XXX: VA_STATUS_ERROR_UNSUPPORTED_FORMAT? */
}
*
subpicture
=
subpicID
;
*
subpicture
=
subpicID
;
obj_subpic
->
image
=
image
;
obj_subpic
->
image
=
image
;
obj_subpic
->
format
=
m
->
format
;
obj_subpic
->
width
=
obj_image
->
image
.
width
;
obj_subpic
->
width
=
obj_image
->
image
.
width
;
obj_subpic
->
height
=
obj_image
->
image
.
height
;
obj_subpic
->
height
=
obj_image
->
image
.
height
;
obj_subpic
->
bo
=
obj_image
->
bo
;
obj_subpic
->
bo
=
obj_image
->
bo
;
return
vaStatus
;
return
VA_STATUS_SUCCESS
;
}
}
VAStatus
VAStatus
...
...
i965_drv_video/i965_drv_video.h
View file @
85f37a2c
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
#define I965_MAX_ENTRYPOINTS 5
#define I965_MAX_ENTRYPOINTS 5
#define I965_MAX_CONFIG_ATTRIBUTES 10
#define I965_MAX_CONFIG_ATTRIBUTES 10
#define I965_MAX_IMAGE_FORMATS 10
#define I965_MAX_IMAGE_FORMATS 10
#define I965_MAX_SUBPIC_FORMATS
4
#define I965_MAX_SUBPIC_FORMATS
2
#define I965_MAX_DISPLAY_ATTRIBUTES 4
#define I965_MAX_DISPLAY_ATTRIBUTES 4
#define I965_STR_VENDOR "i965 Driver 0.1"
#define I965_STR_VENDOR "i965 Driver 0.1"
...
@@ -121,6 +121,7 @@ struct object_subpic
...
@@ -121,6 +121,7 @@ struct object_subpic
VAImageID
image
;
VAImageID
image
;
VARectangle
src_rect
;
VARectangle
src_rect
;
VARectangle
dst_rect
;
VARectangle
dst_rect
;
unsigned
int
format
;
int
width
;
int
width
;
int
height
;
int
height
;
dri_bo
*
bo
;
dri_bo
*
bo
;
...
...
i965_drv_video/i965_render.c
View file @
85f37a2c
...
@@ -586,25 +586,12 @@ i965_subpic_render_src_surface_state(VADriverContextP ctx,
...
@@ -586,25 +586,12 @@ i965_subpic_render_src_surface_state(VADriverContextP ctx,
int
index
,
int
index
,
dri_bo
*
region
,
dri_bo
*
region
,
unsigned
long
offset
,
unsigned
long
offset
,
int
w
,
int
h
,
int
fo
urcc
)
int
w
,
int
h
,
int
fo
rmat
)
{
{
struct
i965_driver_data
*
i965
=
i965_driver_data
(
ctx
);
struct
i965_driver_data
*
i965
=
i965_driver_data
(
ctx
);
struct
i965_render_state
*
render_state
=
&
i965
->
render_state
;
struct
i965_render_state
*
render_state
=
&
i965
->
render_state
;
struct
i965_surface_state
*
ss
;
struct
i965_surface_state
*
ss
;
dri_bo
*
ss_bo
;
dri_bo
*
ss_bo
;
int
surface_format
;
switch
(
fourcc
)
{
case
VA_FOURCC
(
'I'
,
'A'
,
'4'
,
'4'
):
surface_format
=
I965_SURFACEFORMAT_P4A4_UNORM
;
break
;
case
VA_FOURCC
(
'A'
,
'I'
,
'4'
,
'4'
):
surface_format
=
I965_SURFACEFORMAT_A4P4_UNORM
;
break
;
default:
assert
(
0
);
/* XXX: fix supported subpicture formats */
break
;
}
ss_bo
=
dri_bo_alloc
(
i965
->
intel
.
bufmgr
,
ss_bo
=
dri_bo_alloc
(
i965
->
intel
.
bufmgr
,
"surface state"
,
"surface state"
,
...
@@ -615,7 +602,7 @@ i965_subpic_render_src_surface_state(VADriverContextP ctx,
...
@@ -615,7 +602,7 @@ i965_subpic_render_src_surface_state(VADriverContextP ctx,
ss
=
ss_bo
->
virtual
;
ss
=
ss_bo
->
virtual
;
memset
(
ss
,
0
,
sizeof
(
*
ss
));
memset
(
ss
,
0
,
sizeof
(
*
ss
));
ss
->
ss0
.
surface_type
=
I965_SURFACE_2D
;
ss
->
ss0
.
surface_type
=
I965_SURFACE_2D
;
ss
->
ss0
.
surface_format
=
surface_
format
;
ss
->
ss0
.
surface_format
=
format
;
ss
->
ss0
.
writedisable_alpha
=
0
;
ss
->
ss0
.
writedisable_alpha
=
0
;
ss
->
ss0
.
writedisable_red
=
0
;
ss
->
ss0
.
writedisable_red
=
0
;
ss
->
ss0
.
writedisable_green
=
0
;
ss
->
ss0
.
writedisable_green
=
0
;
...
@@ -691,8 +678,8 @@ i965_subpic_render_src_surfaces_state(VADriverContextP ctx,
...
@@ -691,8 +678,8 @@ i965_subpic_render_src_surfaces_state(VADriverContextP ctx,
region
=
obj_surface
->
bo
;
region
=
obj_surface
->
bo
;
subpic_region
=
obj_image
->
bo
;
subpic_region
=
obj_image
->
bo
;
/*subpicture surface*/
/*subpicture surface*/
i965_subpic_render_src_surface_state
(
ctx
,
1
,
subpic_region
,
0
,
obj_
image
->
image
.
width
,
obj_image
->
image
.
height
,
obj_image
->
image
.
format
.
fourcc
);
i965_subpic_render_src_surface_state
(
ctx
,
1
,
subpic_region
,
0
,
obj_
subpic
->
width
,
obj_subpic
->
height
,
obj_subpic
->
format
);
i965_subpic_render_src_surface_state
(
ctx
,
2
,
subpic_region
,
0
,
obj_
image
->
image
.
width
,
obj_image
->
image
.
height
,
obj_image
->
image
.
format
.
fourcc
);
i965_subpic_render_src_surface_state
(
ctx
,
2
,
subpic_region
,
0
,
obj_
subpic
->
width
,
obj_subpic
->
height
,
obj_subpic
->
format
);
}
}
static
void
static
void
...
...
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