Commit 23b30e26 authored by Xiang, Haihao's avatar Xiang, Haihao

i965_drv_video: H.264 decoding on Sandybridge

Signed-off-by: default avatarXiang, Haihao <haihao.xiang@intel.com>
parent abc2523d
......@@ -43,7 +43,8 @@ i965_drv_video_la_SOURCES = \
i965_avc_bsd.c \
i965_avc_hw_scoreboard.c\
i965_avc_ildb.c \
i965_post_processing.c
i965_post_processing.c \
gen6_mfd.c
noinst_HEADERS = \
object_heap.h \
......@@ -61,4 +62,5 @@ noinst_HEADERS = \
i965_avc_bsd.h \
i965_avc_hw_scoreboard.h\
i965_avc_ildb.h \
i965_post_processing.h
i965_post_processing.h \
gen6_mfd.h
This diff is collapsed.
/*
* Copyright © 2010 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Authors:
* Xiang Haihao <haihao.xiang@intel.com>
*
*/
#ifndef _GEN6_MFD_H_
#define _GEN6_MFD_H_
#include <xf86drm.h>
#include <drm.h>
#include <i915_drm.h>
#include <intel_bufmgr.h>
struct gen6_mfd_surface
{
dri_bo *dmv_top;
dri_bo *dmv_bottom;
int dmv_bottom_flag;
};
#define MAX_MFX_REFERENCE_SURFACES 16
struct gen6_mfd_context
{
struct {
VASurfaceID surface_id;
int frame_store_id;
} reference_surface[MAX_MFX_REFERENCE_SURFACES];
struct {
dri_bo *bo;
int valid;
} post_deblocking_output;
struct {
dri_bo *bo;
int valid;
} pre_deblocking_output;
struct {
dri_bo *bo;
int valid;
} intra_row_store_scratch_buffer;
struct {
dri_bo *bo;
int valid;
} deblocking_filter_row_store_scratch_buffer;
struct {
dri_bo *bo;
int valid;
} bsd_mpc_row_store_scratch_buffer;
struct {
dri_bo *bo;
int valid;
} mpr_row_store_scratch_buffer;
struct {
dri_bo *bo;
int valid;
} bitplane_read_buffer;
};
struct decode_state;
Bool gen6_mfd_init(VADriverContextP ctx);
Bool gen6_mfd_terminate(VADriverContextP ctx);
void gen6_mfd_decode_picture(VADriverContextP ctx,
VAProfile profile,
struct decode_state *decode_state);
#endif /* _GEN6_MFD_H_ */
......@@ -44,13 +44,14 @@
(sub_opa) << 21 | \
(sub_opb) << 16)
#define MFX_STATE_PONTER MFX(2, 0, 0, 6)
#define MFX_PIPE_MODE_SELECT MFX(2, 0, 0, 0)
#define MFX_SURFACE_STATE MFX(0, 0, 0, 2) /* FIXME: right ? */
#define MFX_SURFACE_STATE MFX(2, 0, 0, 1)
#define MFX_PIPE_BUF_ADDR_STATE MFX(2, 0, 0, 2)
#define MFX_IND_OBJ_BASE_ADDR_STATE MFX(2, 0, 0, 3)
#define MFX_BSP_BUF_BASE_ADDR_STATE MFX(2, 0, 0, 4)
#define MFX_AES_STATE MFX(2, 0, 0, 5)
#define MFX_STATE_POINTER MFX(2, 0, 0, 6)
#define MFX_WAIT MFX(1, 0, 0, 0)
#define MFX_AVC_IMG_STATE MFX(2, 1, 0, 0)
......
......@@ -119,6 +119,7 @@ i965_QueryConfigProfiles(VADriverContextP ctx,
VAProfile *profile_list, /* out */
int *num_profiles) /* out */
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
int i = 0;
profile_list[i++] = VAProfileMPEG2Simple;
......@@ -127,6 +128,12 @@ i965_QueryConfigProfiles(VADriverContextP ctx,
profile_list[i++] = VAProfileH264Main;
profile_list[i++] = VAProfileH264High;
if (IS_GEN6(i965->intel.device_id)) {
profile_list[i++] = VAProfileVC1Simple;
profile_list[i++] = VAProfileVC1Main;
profile_list[i++] = VAProfileVC1Advanced;
}
/* If the assert fails then I965_MAX_PROFILES needs to be bigger */
assert(i <= I965_MAX_PROFILES);
*num_profiles = i;
......@@ -156,6 +163,13 @@ i965_QueryConfigEntrypoints(VADriverContextP ctx,
entrypoint_list[0] = VAEntrypointVLD;
break;
case VAProfileVC1Simple:
case VAProfileVC1Main:
case VAProfileVC1Advanced:
*num_entrypoints = 1;
entrypoint_list[0] = VAEntrypointVLD;
break;
default:
vaStatus = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
*num_entrypoints = 0;
......@@ -262,6 +276,17 @@ i965_CreateConfig(VADriverContextP ctx,
break;
case VAProfileVC1Simple:
case VAProfileVC1Main:
case VAProfileVC1Advanced:
if (VAEntrypointVLD == entrypoint) {
vaStatus = VA_STATUS_SUCCESS;
} else {
vaStatus = VA_STATUS_ERROR_UNSUPPORTED_ENTRYPOINT;
}
break;
default:
vaStatus = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
break;
......@@ -724,6 +749,9 @@ i965_CreateContext(VADriverContextP ctx,
return vaStatus;
}
if (IS_GEN6(i965->intel.device_id))
render_state->interleaved_uv = 1;
else {
switch (obj_config->profile) {
case VAProfileH264Baseline:
case VAProfileH264Main:
......@@ -733,6 +761,7 @@ i965_CreateContext(VADriverContextP ctx,
default:
render_state->interleaved_uv = 0;
}
}
obj_context->context_id = contextID;
*context = contextID;
......@@ -978,6 +1007,12 @@ i965_BeginPicture(VADriverContextP ctx,
vaStatus = VA_STATUS_SUCCESS;
break;
case VAProfileVC1Simple:
case VAProfileVC1Main:
case VAProfileVC1Advanced:
vaStatus = VA_STATUS_SUCCESS;
break;
default:
assert(0);
vaStatus = VA_STATUS_ERROR_UNSUPPORTED_PROFILE;
......
......@@ -39,6 +39,7 @@
#include "i965_defines.h"
#include "i965_media_mpeg2.h"
#include "i965_media_h264.h"
#include "gen6_mfd.h"
#include "i965_media.h"
#include "i965_drv_video.h"
......@@ -273,6 +274,11 @@ i965_media_decode_picture(VADriverContextP ctx,
struct i965_driver_data *i965 = i965_driver_data(ctx);
struct i965_media_state *media_state = &i965->media_state;
if (IS_GEN6(i965->intel.device_id)) {
gen6_mfd_decode_picture(ctx, profile, decode_state);
return;
}
i965_media_decode_init(ctx, profile, decode_state);
assert(media_state->media_states_setup);
media_state->media_states_setup(ctx, decode_state);
......@@ -282,6 +288,11 @@ i965_media_decode_picture(VADriverContextP ctx,
Bool
i965_media_init(VADriverContextP ctx)
{
struct i965_driver_data *i965 = i965_driver_data(ctx);
if (IS_GEN6(i965->intel.device_id))
return gen6_mfd_init(ctx);
return True;
}
......@@ -292,6 +303,9 @@ i965_media_terminate(VADriverContextP ctx)
struct i965_media_state *media_state = &i965->media_state;
int i;
if (IS_GEN6(i965->intel.device_id))
return gen6_mfd_terminate(ctx);
if (media_state->free_private_context)
media_state->free_private_context(&media_state->private_context);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment