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
5ebd469c
Commit
5ebd469c
authored
Jun 02, 2010
by
Xiang, Haihao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
i965_drv_video: fix graphics memory usage
parent
6da7b5d6
Changes
13
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
232 additions
and
122 deletions
+232
-122
i965_drv_video/i965_avc_bsd.c
i965_drv_video/i965_avc_bsd.c
+122
-44
i965_drv_video/i965_avc_bsd.h
i965_drv_video/i965_avc_bsd.h
+9
-13
i965_drv_video/i965_avc_hw_scoreboard.c
i965_drv_video/i965_avc_hw_scoreboard.c
+12
-6
i965_drv_video/i965_avc_hw_scoreboard.h
i965_drv_video/i965_avc_hw_scoreboard.h
+1
-0
i965_drv_video/i965_drv_video.c
i965_drv_video/i965_drv_video.c
+42
-27
i965_drv_video/i965_drv_video.h
i965_drv_video/i965_drv_video.h
+4
-2
i965_drv_video/i965_media.c
i965_drv_video/i965_media.c
+4
-4
i965_drv_video/i965_media_h264.c
i965_drv_video/i965_media_h264.c
+19
-20
i965_drv_video/i965_media_h264.h
i965_drv_video/i965_media_h264.h
+1
-1
i965_drv_video/i965_media_mpeg2.c
i965_drv_video/i965_media_mpeg2.c
+10
-1
i965_drv_video/i965_media_mpeg2.h
i965_drv_video/i965_media_mpeg2.h
+1
-1
i965_drv_video/i965_render.c
i965_drv_video/i965_render.c
+6
-1
i965_drv_video/i965_render.h
i965_drv_video/i965_render.h
+1
-2
No files found.
i965_drv_video/i965_avc_bsd.c
View file @
5ebd469c
This diff is collapsed.
Click to expand it.
i965_drv_video/i965_avc_bsd.h
View file @
5ebd469c
...
...
@@ -29,12 +29,7 @@
#ifndef __I965_AVC_BSD_H__
#define __I965_AVC_BSD_H__
struct
i965_avc_bsd_surface
{
dri_bo
*
direct_mv_wr_top_bo
;
dri_bo
*
direct_mv_wr_bottom_bo
;
int
direct_mv_flag
;
};
#define DMV_SIZE 0x88000
/* 557056 bytes for a frame */
struct
i965_avc_bsd_context
{
...
...
@@ -46,14 +41,15 @@ struct i965_avc_bsd_context
dri_bo
*
bo
;
}
mpr_row_store
;
struct
{
dri_bo
*
bo
;
}
avc_it_command_mb_info
;
int
init
;
};
struct
{
dri_bo
*
bo
;
long
write_offset
;
}
avc_it_data
;
struct
i965_avc_bsd_surface
{
struct
i965_avc_bsd_context
*
ctx
;
dri_bo
*
dmv_top
;
dri_bo
*
dmv_bottom
;
int
dmv_bottom_flag
;
};
void
i965_avc_bsd_pipeline
(
VADriverContextP
,
struct
decode_state
*
);
...
...
i965_drv_video/i965_avc_hw_scoreboard.c
View file @
5ebd469c
...
...
@@ -176,11 +176,15 @@ i965_avc_hw_scoreboard_upload_constants(struct i965_avc_hw_scoreboard_context *a
{
unsigned
char
*
constant_buffer
;
if
(
avc_hw_scoreboard_context
->
curbe
.
upload
)
return
;
dri_bo_map
(
avc_hw_scoreboard_context
->
curbe
.
bo
,
1
);
assert
(
avc_hw_scoreboard_context
->
curbe
.
bo
->
virtual
);
constant_buffer
=
avc_hw_scoreboard_context
->
curbe
.
bo
->
virtual
;
memcpy
(
constant_buffer
,
avc_hw_scoreboard_constants
,
sizeof
(
avc_hw_scoreboard_constants
));
dri_bo_unmap
(
avc_hw_scoreboard_context
->
curbe
.
bo
);
avc_hw_scoreboard_context
->
curbe
.
upload
=
1
;
}
static
void
...
...
@@ -358,12 +362,14 @@ i965_avc_hw_scoreboard_decode_init(VADriverContextP ctx)
struct
i965_avc_hw_scoreboard_context
*
avc_hw_scoreboard_context
=
&
i965_h264_context
->
avc_hw_scoreboard_context
;
dri_bo
*
bo
;
dri_bo_unreference
(
avc_hw_scoreboard_context
->
curbe
.
bo
);
if
(
avc_hw_scoreboard_context
->
curbe
.
bo
==
NULL
)
{
bo
=
dri_bo_alloc
(
i965
->
intel
.
bufmgr
,
"constant buffer"
,
4096
,
64
);
assert
(
bo
);
avc_hw_scoreboard_context
->
curbe
.
bo
=
bo
;
avc_hw_scoreboard_context
->
curbe
.
upload
=
0
;
}
dri_bo_unreference
(
avc_hw_scoreboard_context
->
surface
.
s_bo
);
avc_hw_scoreboard_context
->
surface
.
s_bo
=
i965_h264_context
->
avc_it_command_mb_info
.
bo
;
...
...
i965_drv_video/i965_avc_hw_scoreboard.h
View file @
5ebd469c
...
...
@@ -57,6 +57,7 @@ struct i965_avc_hw_scoreboard_context
struct
{
dri_bo
*
bo
;
int
upload
;
}
curbe
;
struct
{
...
...
i965_drv_video/i965_drv_video.c
View file @
5ebd469c
...
...
@@ -367,11 +367,8 @@ i965_CreateSurfaces(VADriverContextP ctx,
obj_surface
->
width
=
ALIGN
(
width
,
16
);
obj_surface
->
height
=
ALIGN
(
height
,
16
);
obj_surface
->
size
=
SIZE_YUV420
(
obj_surface
->
width
,
obj_surface
->
height
);
obj_surface
->
bo
=
dri_bo_alloc
(
i965
->
intel
.
bufmgr
,
"vaapi surface"
,
obj_surface
->
size
,
64
);
assert
(
obj_surface
->
bo
);
obj_surface
->
flags
=
SURFACE_REFERENCED
;
obj_surface
->
bo
=
NULL
;
obj_surface
->
private_data
=
NULL
;
obj_surface
->
free_private_data
=
NULL
;
}
...
...
@@ -1327,7 +1324,7 @@ i965_CreateImage(VADriverContextP ctx,
*
out_image
=
*
image
;
return
VA_STATUS_SUCCESS
;
error:
error:
i965_DestroyImage
(
ctx
,
image_id
);
return
va_status
;
}
...
...
@@ -1439,6 +1436,13 @@ i965_PutSurface(VADriverContextP ctx,
if
(
dri_state
->
driConnectedFlag
!=
VA_DRI2
)
return
VA_STATUS_ERROR_UNKNOWN
;
/* Some broken sources such as H.264 conformance case FM2_SVA_C
* will get here
*/
obj_surface
=
SURFACE
(
surface
);
if
(
obj_surface
->
bo
==
NULL
)
return
VA_STATUS_SUCCESS
;
dri_drawable
=
dri_get_drawable
(
ctx
,
draw
);
assert
(
dri_drawable
);
...
...
@@ -1480,13 +1484,24 @@ i965_PutSurface(VADriverContextP ctx,
i965_render_put_surface
(
ctx
,
surface
,
srcx
,
srcy
,
srcw
,
srch
,
destx
,
desty
,
destw
,
desth
);
obj_surface
=
SURFACE
(
surface
);
if
(
obj_surface
->
subpic
!=
VA_INVALID_ID
)
{
i965_render_put_subpic
(
ctx
,
surface
,
srcx
,
srcy
,
srcw
,
srch
,
destx
,
desty
,
destw
,
desth
);
}
dri_swap_buffer
(
ctx
,
dri_drawable
);
obj_surface
->
flags
|=
SURFACE_DISPLAYED
;
if
(
!
(
obj_surface
->
flags
&
SURFACE_REFERENCED
))
{
dri_bo_unreference
(
obj_surface
->
bo
);
obj_surface
->
bo
=
NULL
;
obj_surface
->
flags
=
0
;
if
(
obj_surface
->
free_private_data
)
obj_surface
->
free_private_data
(
&
obj_surface
->
private_data
);
}
return
VA_STATUS_SUCCESS
;
}
...
...
i965_drv_video/i965_drv_video.h
View file @
5ebd469c
...
...
@@ -94,6 +94,9 @@ struct object_context
struct
decode_state
decode_state
;
};
#define SURFACE_REFERENCED (1 << 0)
#define SURFACE_DISPLAYED (1 << 1)
struct
object_surface
{
struct
object_base
base
;
...
...
@@ -102,6 +105,7 @@ struct object_surface
int
width
;
int
height
;
int
size
;
int
flags
;
dri_bo
*
bo
;
void
(
*
free_private_data
)(
void
**
data
);
void
*
private_data
;
...
...
@@ -137,8 +141,6 @@ struct object_subpic
dri_bo
*
bo
;
};
struct
i965_driver_data
{
struct
intel_driver_data
intel
;
...
...
i965_drv_video/i965_media.c
View file @
5ebd469c
...
...
@@ -199,7 +199,7 @@ i965_media_pipeline_setup(VADriverContextP ctx, struct decode_state *decode_stat
}
static
void
i965_media_decode_init
(
VADriverContextP
ctx
,
VAProfile
profile
)
i965_media_decode_init
(
VADriverContextP
ctx
,
VAProfile
profile
,
struct
decode_state
*
decode_state
)
{
int
i
;
struct
i965_driver_data
*
i965
=
i965_driver_data
(
ctx
);
...
...
@@ -250,13 +250,13 @@ i965_media_decode_init(VADriverContextP ctx, VAProfile profile)
switch
(
profile
)
{
case
VAProfileMPEG2Simple
:
case
VAProfileMPEG2Main
:
i965_media_mpeg2_decode_init
(
ctx
);
i965_media_mpeg2_decode_init
(
ctx
,
decode_state
);
break
;
case
VAProfileH264Baseline
:
case
VAProfileH264Main
:
case
VAProfileH264High
:
i965_media_h264_decode_init
(
ctx
);
i965_media_h264_decode_init
(
ctx
,
decode_state
);
break
;
default:
...
...
@@ -273,7 +273,7 @@ i965_media_decode_picture(VADriverContextP ctx,
struct
i965_driver_data
*
i965
=
i965_driver_data
(
ctx
);
struct
i965_media_state
*
media_state
=
&
i965
->
media_state
;
i965_media_decode_init
(
ctx
,
profile
);
i965_media_decode_init
(
ctx
,
profile
,
decode_state
);
assert
(
media_state
->
media_states_setup
);
media_state
->
media_states_setup
(
ctx
,
decode_state
);
i965_media_pipeline_setup
(
ctx
,
decode_state
);
...
...
i965_drv_video/i965_media_h264.c
View file @
5ebd469c
...
...
@@ -702,21 +702,9 @@ i965_media_h264_states_setup(VADriverContextP ctx, struct decode_state *decode_s
struct
i965_driver_data
*
i965
=
i965_driver_data
(
ctx
);
struct
i965_media_state
*
media_state
=
&
i965
->
media_state
;
struct
i965_h264_context
*
i965_h264_context
;
VAPictureParameterBufferH264
*
pic_param
;
assert
(
media_state
->
private_context
);
i965_h264_context
=
(
struct
i965_h264_context
*
)
media_state
->
private_context
;
assert
(
decode_state
->
pic_param
&&
decode_state
->
pic_param
->
buffer
);
pic_param
=
(
VAPictureParameterBufferH264
*
)
decode_state
->
pic_param
->
buffer
;
i965_h264_context
->
picture
.
width_in_mbs
=
((
pic_param
->
picture_width_in_mbs_minus1
+
1
)
&
0xff
);
i965_h264_context
->
picture
.
height_in_mbs
=
((
pic_param
->
picture_height_in_mbs_minus1
+
1
)
&
0xff
)
/
(
1
+
!!
pic_param
->
pic_fields
.
bits
.
field_pic_flag
);
/* picture height */
i965_h264_context
->
picture
.
mbaff_frame_flag
=
(
pic_param
->
seq_fields
.
bits
.
mb_adaptive_frame_field_flag
&&
!
pic_param
->
pic_fields
.
bits
.
field_pic_flag
);
i965_h264_context
->
avc_it_command_mb_info
.
mbs
=
(
i965_h264_context
->
picture
.
width_in_mbs
*
i965_h264_context
->
picture
.
height_in_mbs
);
i965_avc_bsd_pipeline
(
ctx
,
decode_state
);
...
...
@@ -792,13 +780,14 @@ i965_media_h264_free_private_context(void **data)
}
void
i965_media_h264_decode_init
(
VADriverContextP
ctx
)
i965_media_h264_decode_init
(
VADriverContextP
ctx
,
struct
decode_state
*
decode_state
)
{
struct
i965_driver_data
*
i965
=
i965_driver_data
(
ctx
);
struct
i965_media_state
*
media_state
=
&
i965
->
media_state
;
struct
i965_h264_context
*
i965_h264_context
;
dri_bo
*
bo
;
int
i
;
VAPictureParameterBufferH264
*
pic_param
;
i965_h264_context
=
media_state
->
private_context
;
...
...
@@ -829,7 +818,7 @@ i965_media_h264_decode_init(VADriverContextP ctx)
struct
media_kernel
*
kernel
=
&
h264_avc_kernels
[
i
];
kernel
->
bo
=
dri_bo_alloc
(
i965
->
intel
.
bufmgr
,
kernel
->
name
,
kernel
->
size
,
64
);
kernel
->
size
,
0x1000
);
assert
(
kernel
->
bo
);
dri_bo_subdata
(
kernel
->
bo
,
0
,
kernel
->
size
,
kernel
->
bin
);
}
...
...
@@ -865,12 +854,20 @@ i965_media_h264_decode_init(VADriverContextP ctx)
media_state
->
media_objects
=
i965_media_h264_objects
;
}
i965_h264_context
->
enable_avc_ildb
=
0
;
assert
(
decode_state
->
pic_param
&&
decode_state
->
pic_param
->
buffer
);
pic_param
=
(
VAPictureParameterBufferH264
*
)
decode_state
->
pic_param
->
buffer
;
i965_h264_context
->
picture
.
width_in_mbs
=
((
pic_param
->
picture_width_in_mbs_minus1
+
1
)
&
0xff
);
i965_h264_context
->
picture
.
height_in_mbs
=
((
pic_param
->
picture_height_in_mbs_minus1
+
1
)
&
0xff
)
/
(
1
+
!!
pic_param
->
pic_fields
.
bits
.
field_pic_flag
);
/* picture height */
i965_h264_context
->
picture
.
mbaff_frame_flag
=
(
pic_param
->
seq_fields
.
bits
.
mb_adaptive_frame_field_flag
&&
!
pic_param
->
pic_fields
.
bits
.
field_pic_flag
);
i965_h264_context
->
avc_it_command_mb_info
.
mbs
=
(
i965_h264_context
->
picture
.
width_in_mbs
*
i965_h264_context
->
picture
.
height_in_mbs
);
dri_bo_unreference
(
i965_h264_context
->
avc_it_command_mb_info
.
bo
);
bo
=
dri_bo_alloc
(
i965
->
intel
.
bufmgr
,
"avc it command mb info"
,
0x80000
*
(
1
+
i965_h264_context
->
use_avc_hw_scoreboard
),
/* at least 522240 bytes */
i965_h264_context
->
avc_it_command_mb_info
.
mbs
*
MB_CMD_IN_BYTES
*
(
1
+
i965_h264_context
->
use_avc_hw_scoreboard
)
+
4
,
0x1000
);
assert
(
bo
);
i965_h264_context
->
avc_it_command_mb_info
.
bo
=
bo
;
...
...
@@ -878,8 +875,10 @@ i965_media_h264_decode_init(VADriverContextP ctx)
dri_bo_unreference
(
i965_h264_context
->
avc_it_data
.
bo
);
bo
=
dri_bo_alloc
(
i965
->
intel
.
bufmgr
,
"avc it data"
,
0x1000000
,
/* at least 16711680 bytes */
4096
);
i965_h264_context
->
avc_it_command_mb_info
.
mbs
*
0x800
*
(
1
+
!!
pic_param
->
pic_fields
.
bits
.
field_pic_flag
),
0x1000
);
assert
(
bo
);
i965_h264_context
->
avc_it_data
.
bo
=
bo
;
i965_h264_context
->
avc_it_data
.
write_offset
=
0
;
...
...
@@ -891,8 +890,8 @@ i965_media_h264_decode_init(VADriverContextP ctx)
dri_bo_unreference
(
i965_h264_context
->
avc_ildb_data
.
bo
);
bo
=
dri_bo_alloc
(
i965
->
intel
.
bufmgr
,
"AVC-ILDB Data Buffer"
,
0x100000
,
/* at least 1044480 bytes */
64
);
i965_h264_context
->
avc_it_command_mb_info
.
mbs
*
64
*
2
,
0x1000
);
assert
(
bo
);
i965_h264_context
->
avc_ildb_data
.
bo
=
bo
;
...
...
i965_drv_video/i965_media_h264.h
View file @
5ebd469c
...
...
@@ -60,6 +60,6 @@ struct i965_h264_context
}
fsid_list
[
16
];
};
void
i965_media_h264_decode_init
(
VADriverContextP
ctx
);
void
i965_media_h264_decode_init
(
VADriverContextP
ctx
,
struct
decode_state
*
decode_state
);
#endif
/* _I965_MEDIA_H264_H_ */
i965_drv_video/i965_media_mpeg2.c
View file @
5ebd469c
...
...
@@ -518,6 +518,15 @@ i965_media_mpeg2_surface_setup(VADriverContextP ctx,
int
w
=
obj_surface
->
width
;
int
h
=
obj_surface
->
height
;
if
(
obj_surface
->
bo
==
NULL
)
{
struct
i965_driver_data
*
i965
=
i965_driver_data
(
ctx
);
obj_surface
->
bo
=
dri_bo_alloc
(
i965
->
intel
.
bufmgr
,
"vaapi surface"
,
obj_surface
->
size
,
0x1000
);
}
if
(
picture_structure
==
MPEG_FRAME
)
{
i965_media_mpeg2_surface_state
(
ctx
,
base_index
+
0
,
obj_surface
,
0
,
w
,
h
,
...
...
@@ -897,7 +906,7 @@ i965_media_mpeg2_free_private_context(void **data)
}
void
i965_media_mpeg2_decode_init
(
VADriverContextP
ctx
)
i965_media_mpeg2_decode_init
(
VADriverContextP
ctx
,
struct
decode_state
*
decode_state
)
{
struct
i965_driver_data
*
i965
=
i965_driver_data
(
ctx
);
struct
i965_media_state
*
media_state
=
&
i965
->
media_state
;
...
...
i965_drv_video/i965_media_mpeg2.h
View file @
5ebd469c
...
...
@@ -39,6 +39,6 @@
struct
decode_state
;
void
i965_media_mpeg2_decode_init
(
VADriverContextP
ctx
);
void
i965_media_mpeg2_decode_init
(
VADriverContextP
ctx
,
struct
decode_state
*
decode_state
);
#endif
/* _I965_MEDIA_MPEG2_H_ */
i965_drv_video/i965_render.c
View file @
5ebd469c
...
...
@@ -921,6 +921,9 @@ i965_render_upload_constants(VADriverContextP ctx)
struct
i965_render_state
*
render_state
=
&
i965
->
render_state
;
unsigned
short
*
constant_buffer
;
if
(
render_state
->
curbe
.
upload
)
return
;
dri_bo_map
(
render_state
->
curbe
.
bo
,
1
);
assert
(
render_state
->
curbe
.
bo
->
virtual
);
constant_buffer
=
render_state
->
curbe
.
bo
->
virtual
;
...
...
@@ -931,6 +934,7 @@ i965_render_upload_constants(VADriverContextP ctx)
*
constant_buffer
=
0
;
dri_bo_unmap
(
render_state
->
curbe
.
bo
);
render_state
->
curbe
.
upload
=
1
;
}
static
void
...
...
@@ -1508,7 +1512,7 @@ i965_render_init(VADriverContextP ctx)
struct
render_kernel
*
kernel
=
&
render_kernels
[
i
];
kernel
->
bo
=
dri_bo_alloc
(
i965
->
intel
.
bufmgr
,
kernel
->
name
,
kernel
->
size
,
64
);
kernel
->
size
,
0x1000
);
assert
(
kernel
->
bo
);
dri_bo_subdata
(
kernel
->
bo
,
0
,
kernel
->
size
,
kernel
->
bin
);
}
...
...
@@ -1518,6 +1522,7 @@ i965_render_init(VADriverContextP ctx)
"constant buffer"
,
4096
,
64
);
assert
(
render_state
->
curbe
.
bo
);
render_state
->
curbe
.
upload
=
0
;
return
True
;
}
...
...
i965_drv_video/i965_render.h
View file @
5ebd469c
...
...
@@ -43,7 +43,6 @@ struct i965_render_state
struct
{
dri_bo
*
state
;
dri_bo
*
prog
;
}
sf
;
struct
{
...
...
@@ -52,7 +51,6 @@ struct i965_render_state
dri_bo
*
surface
[
MAX_RENDER_SURFACES
];
dri_bo
*
binding_table
;
dri_bo
*
state
;
dri_bo
*
prog
;
}
wm
;
struct
{
...
...
@@ -62,6 +60,7 @@ struct i965_render_state
struct
{
dri_bo
*
bo
;
int
upload
;
}
curbe
;
int
interleaved_uv
;
...
...
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