Commit 87a90c60 authored by Xiang, Haihao's avatar Xiang, Haihao

i965_drv_video: create media_state per context

Also clean up some codes
parent f159aca3
This diff is collapsed.
...@@ -26,19 +26,20 @@ ...@@ -26,19 +26,20 @@
* *
*/ */
#ifndef _GEN6_MFC_BCS_H_ #ifndef _GEN6_MFC_H_
#define _GEN6_MFC_BCS_H_ #define _GEN6_MFC_H_
#include <xf86drm.h> #include <xf86drm.h>
#include <drm.h> #include <drm.h>
#include <i915_drm.h> #include <i915_drm.h>
#include <intel_bufmgr.h> #include <intel_bufmgr.h>
struct mfc_encode_state; struct encode_state;
#define MAX_MFC_REFERENCE_SURFACES 16 #define MAX_MFC_REFERENCE_SURFACES 16
#define NUM_MFC_DMV_BUFFERS 34 #define NUM_MFC_DMV_BUFFERS 34
struct gen6_mfc_bcs_state
struct gen6_mfc_context
{ {
struct { struct {
unsigned int width; unsigned int width;
...@@ -94,8 +95,12 @@ struct gen6_mfc_bcs_state ...@@ -94,8 +95,12 @@ struct gen6_mfc_bcs_state
}direct_mv_buffers[NUM_MFC_DMV_BUFFERS]; //INTERNAL: 0-31 as input,32 and 33 as output }direct_mv_buffers[NUM_MFC_DMV_BUFFERS]; //INTERNAL: 0-31 as input,32 and 33 as output
}; };
VAStatus gen6_mfc_pipeline(VADriverContextP ctx, VAStatus
VAContextID context, gen6_mfc_pipeline(VADriverContextP ctx,
struct mfc_encode_state *encode_state); VAProfile profile,
struct encode_state *encode_state,
struct gen6_encoder_context *gen6_encoder_context);
Bool gen6_mfc_context_init(VADriverContextP ctx, struct gen6_mfc_context *mfc_context);
Bool gen6_mfc_context_destroy(struct gen6_mfc_context *mfc_context);
#endif /* _GEN6_MFC_BCS_H_ */ #endif /* _GEN6_MFC_BCS_H_ */
This diff is collapsed.
...@@ -59,8 +59,12 @@ struct gen6_vc1_surface ...@@ -59,8 +59,12 @@ struct gen6_vc1_surface
}; };
#define MAX_MFX_REFERENCE_SURFACES 16 #define MAX_MFX_REFERENCE_SURFACES 16
struct hw_context;
struct gen6_mfd_context struct gen6_mfd_context
{ {
struct hw_context base;
struct { struct {
VASurfaceID surface_id; VASurfaceID surface_id;
int frame_store_id; int frame_store_id;
...@@ -102,11 +106,4 @@ struct gen6_mfd_context ...@@ -102,11 +106,4 @@ struct gen6_mfd_context
} bitplane_read_buffer; } 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_ */ #endif /* _GEN6_MFD_H_ */
This diff is collapsed.
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
* *
*/ */
#ifndef _GEN6_MEDIA_H_ #ifndef _GEN6_VME_H_
#define _GEN6_MEDIA_H_ #define _GEN6_VME_H_
#include <xf86drm.h> #include <xf86drm.h>
#include <drm.h> #include <drm.h>
...@@ -38,9 +38,10 @@ ...@@ -38,9 +38,10 @@
#define MAX_INTERFACE_DESC_GEN6 32 #define MAX_INTERFACE_DESC_GEN6 32
#define MAX_MEDIA_SURFACES_GEN6 34 #define MAX_MEDIA_SURFACES_GEN6 34
struct mfc_encode_state; struct encode_state;
struct gen6_encoder_context;
struct gen6_media_state struct gen6_vme_context
{ {
struct { struct {
dri_bo *bo; dri_bo *bo;
...@@ -78,10 +79,11 @@ struct gen6_media_state ...@@ -78,10 +79,11 @@ struct gen6_media_state
} vme_output; } vme_output;
}; };
VAStatus gen6_vme_media_pipeline(VADriverContextP ctx, VAStatus gen6_vme_pipeline(VADriverContextP ctx,
VAContextID context, VAProfile profile,
struct mfc_encode_state *encode_state); struct encode_state *encode_state,
Bool gen6_vme_init(VADriverContextP ctx); struct gen6_encoder_context *gen6_encoder_context);
Bool gen6_vme_terminate(VADriverContextP ctx); Bool gen6_vme_context_init(VADriverContextP ctx, struct gen6_vme_context *vme_context);
Bool gen6_vme_context_destroy(struct gen6_vme_context *vme_context);
#endif /* _GEN6_MEDIA_H_ */ #endif /* _GEN6_VME_H_ */
This diff is collapsed.
...@@ -40,8 +40,6 @@ struct i965_avc_bsd_context ...@@ -40,8 +40,6 @@ struct i965_avc_bsd_context
struct { struct {
dri_bo *bo; dri_bo *bo;
} mpr_row_store; } mpr_row_store;
int init;
}; };
struct i965_avc_bsd_surface struct i965_avc_bsd_surface
...@@ -52,8 +50,8 @@ struct i965_avc_bsd_surface ...@@ -52,8 +50,8 @@ struct i965_avc_bsd_surface
int dmv_bottom_flag; int dmv_bottom_flag;
}; };
void i965_avc_bsd_pipeline(VADriverContextP, struct decode_state *); void i965_avc_bsd_pipeline(VADriverContextP, struct decode_state *, void *h264_context);
void i965_avc_bsd_decode_init(VADriverContextP); void i965_avc_bsd_decode_init(VADriverContextP, void *h264_context);
Bool i965_avc_bsd_ternimate(struct i965_avc_bsd_context *); Bool i965_avc_bsd_ternimate(struct i965_avc_bsd_context *);
#endif /* __I965_AVC_BSD_H__ */ #endif /* __I965_AVC_BSD_H__ */
......
...@@ -322,11 +322,9 @@ i965_avc_hw_scoreboard_pipeline_setup(VADriverContextP ctx, struct i965_avc_hw_s ...@@ -322,11 +322,9 @@ i965_avc_hw_scoreboard_pipeline_setup(VADriverContextP ctx, struct i965_avc_hw_s
} }
void void
i965_avc_hw_scoreboard(VADriverContextP ctx, struct decode_state *decode_state) i965_avc_hw_scoreboard(VADriverContextP ctx, struct decode_state *decode_state, void *h264_context)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_h264_context *i965_h264_context = (struct i965_h264_context *)h264_context;
struct i965_media_state *media_state = &i965->media_state;
struct i965_h264_context *i965_h264_context = (struct i965_h264_context *)media_state->private_context;
if (i965_h264_context->use_avc_hw_scoreboard) { if (i965_h264_context->use_avc_hw_scoreboard) {
struct i965_avc_hw_scoreboard_context *avc_hw_scoreboard_context = &i965_h264_context->avc_hw_scoreboard_context; struct i965_avc_hw_scoreboard_context *avc_hw_scoreboard_context = &i965_h264_context->avc_hw_scoreboard_context;
...@@ -352,11 +350,10 @@ i965_avc_hw_scoreboard(VADriverContextP ctx, struct decode_state *decode_state) ...@@ -352,11 +350,10 @@ i965_avc_hw_scoreboard(VADriverContextP ctx, struct decode_state *decode_state)
} }
void void
i965_avc_hw_scoreboard_decode_init(VADriverContextP ctx) i965_avc_hw_scoreboard_decode_init(VADriverContextP ctx, void *h264_context)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); 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 = (struct i965_h264_context *)h264_context;
struct i965_h264_context *i965_h264_context = (struct i965_h264_context *)media_state->private_context;
if (i965_h264_context->use_avc_hw_scoreboard) { if (i965_h264_context->use_avc_hw_scoreboard) {
struct i965_avc_hw_scoreboard_context *avc_hw_scoreboard_context = &i965_h264_context->avc_hw_scoreboard_context; struct i965_avc_hw_scoreboard_context *avc_hw_scoreboard_context = &i965_h264_context->avc_hw_scoreboard_context;
......
...@@ -77,8 +77,8 @@ struct i965_avc_hw_scoreboard_context ...@@ -77,8 +77,8 @@ struct i965_avc_hw_scoreboard_context
} urb; } urb;
}; };
void i965_avc_hw_scoreboard(VADriverContextP, struct decode_state *); void i965_avc_hw_scoreboard(VADriverContextP, struct decode_state *, void *h264_context);
void i965_avc_hw_scoreboard_decode_init(VADriverContextP); void i965_avc_hw_scoreboard_decode_init(VADriverContextP, void *h264_context);
Bool i965_avc_hw_scoreboard_ternimate(struct i965_avc_hw_scoreboard_context *); Bool i965_avc_hw_scoreboard_ternimate(struct i965_avc_hw_scoreboard_context *);
#endif /* __I965_AVC_HW_SCOREBOARD_H__ */ #endif /* __I965_AVC_HW_SCOREBOARD_H__ */
......
...@@ -129,11 +129,11 @@ extern struct media_kernel *h264_avc_kernels; ...@@ -129,11 +129,11 @@ extern struct media_kernel *h264_avc_kernels;
static unsigned long *avc_ildb_kernel_offset = NULL; static unsigned long *avc_ildb_kernel_offset = NULL;
static void static void
i965_avc_ildb_surface_state(VADriverContextP ctx, struct decode_state *decode_state) i965_avc_ildb_surface_state(VADriverContextP ctx,
struct decode_state *decode_state,
struct i965_h264_context *i965_h264_context)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); 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 = (struct i965_h264_context *)media_state->private_context;
struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context; struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context;
struct i965_surface_state *ss; struct i965_surface_state *ss;
struct object_surface *obj_surface; struct object_surface *obj_surface;
...@@ -237,11 +237,8 @@ i965_avc_ildb_surface_state(VADriverContextP ctx, struct decode_state *decode_st ...@@ -237,11 +237,8 @@ i965_avc_ildb_surface_state(VADriverContextP ctx, struct decode_state *decode_st
} }
static void static void
i965_avc_ildb_binding_table(VADriverContextP ctx) i965_avc_ildb_binding_table(VADriverContextP ctx, struct i965_h264_context *i965_h264_context)
{ {
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 = (struct i965_h264_context *)media_state->private_context;
struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context; struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context;
unsigned int *binding_table; unsigned int *binding_table;
dri_bo *bo = avc_ildb_context->binding_table.bo; dri_bo *bo = avc_ildb_context->binding_table.bo;
...@@ -265,11 +262,8 @@ i965_avc_ildb_binding_table(VADriverContextP ctx) ...@@ -265,11 +262,8 @@ i965_avc_ildb_binding_table(VADriverContextP ctx)
} }
static void static void
i965_avc_ildb_interface_descriptor_table(VADriverContextP ctx) i965_avc_ildb_interface_descriptor_table(VADriverContextP ctx, struct i965_h264_context *i965_h264_context)
{ {
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 = (struct i965_h264_context *)media_state->private_context;
struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context; struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context;
struct i965_interface_descriptor *desc; struct i965_interface_descriptor *desc;
dri_bo *bo; dri_bo *bo;
...@@ -311,11 +305,8 @@ i965_avc_ildb_interface_descriptor_table(VADriverContextP ctx) ...@@ -311,11 +305,8 @@ i965_avc_ildb_interface_descriptor_table(VADriverContextP ctx)
} }
static void static void
i965_avc_ildb_vfe_state(VADriverContextP ctx) i965_avc_ildb_vfe_state(VADriverContextP ctx, struct i965_h264_context *i965_h264_context)
{ {
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 = (struct i965_h264_context *)media_state->private_context;
struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context; struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context;
struct i965_vfe_state *vfe_state; struct i965_vfe_state *vfe_state;
dri_bo *bo; dri_bo *bo;
...@@ -341,11 +332,11 @@ i965_avc_ildb_vfe_state(VADriverContextP ctx) ...@@ -341,11 +332,11 @@ i965_avc_ildb_vfe_state(VADriverContextP ctx)
} }
static void static void
i965_avc_ildb_upload_constants(VADriverContextP ctx, struct decode_state *decode_state) i965_avc_ildb_upload_constants(VADriverContextP ctx,
struct decode_state *decode_state,
struct i965_h264_context *i965_h264_context)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); 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 = (struct i965_h264_context *)media_state->private_context;
struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context; struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context;
VAPictureParameterBufferH264 *pic_param; VAPictureParameterBufferH264 *pic_param;
struct avc_ildb_root_input *root_input; struct avc_ildb_root_input *root_input;
...@@ -395,13 +386,15 @@ i965_avc_ildb_upload_constants(VADriverContextP ctx, struct decode_state *decode ...@@ -395,13 +386,15 @@ i965_avc_ildb_upload_constants(VADriverContextP ctx, struct decode_state *decode
} }
static void static void
i965_avc_ildb_states_setup(VADriverContextP ctx, struct decode_state *decode_state) i965_avc_ildb_states_setup(VADriverContextP ctx,
struct decode_state *decode_state,
struct i965_h264_context *i965_h264_context)
{ {
i965_avc_ildb_surface_state(ctx, decode_state); i965_avc_ildb_surface_state(ctx, decode_state, i965_h264_context);
i965_avc_ildb_binding_table(ctx); i965_avc_ildb_binding_table(ctx, i965_h264_context);
i965_avc_ildb_interface_descriptor_table(ctx); i965_avc_ildb_interface_descriptor_table(ctx, i965_h264_context);
i965_avc_ildb_vfe_state(ctx); i965_avc_ildb_vfe_state(ctx, i965_h264_context);
i965_avc_ildb_upload_constants(ctx, decode_state); i965_avc_ildb_upload_constants(ctx, decode_state, i965_h264_context);
} }
static void static void
...@@ -413,11 +406,9 @@ i965_avc_ildb_pipeline_select(VADriverContextP ctx) ...@@ -413,11 +406,9 @@ i965_avc_ildb_pipeline_select(VADriverContextP ctx)
} }
static void static void
i965_avc_ildb_urb_layout(VADriverContextP ctx) i965_avc_ildb_urb_layout(VADriverContextP ctx, struct i965_h264_context *i965_h264_context)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); 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 = (struct i965_h264_context *)media_state->private_context;
struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context; struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context;
unsigned int vfe_fence, cs_fence; unsigned int vfe_fence, cs_fence;
...@@ -463,11 +454,8 @@ i965_avc_ildb_state_base_address(VADriverContextP ctx) ...@@ -463,11 +454,8 @@ i965_avc_ildb_state_base_address(VADriverContextP ctx)
} }
static void static void
i965_avc_ildb_state_pointers(VADriverContextP ctx) i965_avc_ildb_state_pointers(VADriverContextP ctx, struct i965_h264_context *i965_h264_context)
{ {
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 = (struct i965_h264_context *)media_state->private_context;
struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context; struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context;
BEGIN_BATCH(ctx, 3); BEGIN_BATCH(ctx, 3);
...@@ -478,11 +466,8 @@ i965_avc_ildb_state_pointers(VADriverContextP ctx) ...@@ -478,11 +466,8 @@ i965_avc_ildb_state_pointers(VADriverContextP ctx)
} }
static void static void
i965_avc_ildb_cs_urb_layout(VADriverContextP ctx) i965_avc_ildb_cs_urb_layout(VADriverContextP ctx, struct i965_h264_context *i965_h264_context)
{ {
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 = (struct i965_h264_context *)media_state->private_context;
struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context; struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context;
BEGIN_BATCH(ctx, 2); BEGIN_BATCH(ctx, 2);
...@@ -494,11 +479,8 @@ i965_avc_ildb_cs_urb_layout(VADriverContextP ctx) ...@@ -494,11 +479,8 @@ i965_avc_ildb_cs_urb_layout(VADriverContextP ctx)
} }
static void static void
i965_avc_ildb_constant_buffer(VADriverContextP ctx) i965_avc_ildb_constant_buffer(VADriverContextP ctx, struct i965_h264_context *i965_h264_context)
{ {
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 = (struct i965_h264_context *)media_state->private_context;
struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context; struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context;
BEGIN_BATCH(ctx, 2); BEGIN_BATCH(ctx, 2);
...@@ -510,11 +492,8 @@ i965_avc_ildb_constant_buffer(VADriverContextP ctx) ...@@ -510,11 +492,8 @@ i965_avc_ildb_constant_buffer(VADriverContextP ctx)
} }
static void static void
i965_avc_ildb_objects(VADriverContextP ctx) i965_avc_ildb_objects(VADriverContextP ctx, struct i965_h264_context *i965_h264_context)
{ {
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 = (struct i965_h264_context *)media_state->private_context;
struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context; struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context;
BEGIN_BATCH(ctx, 6); BEGIN_BATCH(ctx, 6);
...@@ -547,37 +526,34 @@ i965_avc_ildb_objects(VADriverContextP ctx) ...@@ -547,37 +526,34 @@ i965_avc_ildb_objects(VADriverContextP ctx)
} }
static void static void
i965_avc_ildb_pipeline_setup(VADriverContextP ctx) i965_avc_ildb_pipeline_setup(VADriverContextP ctx, struct i965_h264_context *i965_h264_context)
{ {
intel_batchbuffer_emit_mi_flush(ctx); intel_batchbuffer_emit_mi_flush(ctx);
i965_avc_ildb_pipeline_select(ctx); i965_avc_ildb_pipeline_select(ctx);
i965_avc_ildb_state_base_address(ctx); i965_avc_ildb_state_base_address(ctx);
i965_avc_ildb_state_pointers(ctx); i965_avc_ildb_state_pointers(ctx, i965_h264_context);
i965_avc_ildb_urb_layout(ctx); i965_avc_ildb_urb_layout(ctx, i965_h264_context);
i965_avc_ildb_cs_urb_layout(ctx); i965_avc_ildb_cs_urb_layout(ctx, i965_h264_context);
i965_avc_ildb_constant_buffer(ctx); i965_avc_ildb_constant_buffer(ctx, i965_h264_context);
i965_avc_ildb_objects(ctx); i965_avc_ildb_objects(ctx, i965_h264_context);
} }
void void
i965_avc_ildb(VADriverContextP ctx, struct decode_state *decode_state) i965_avc_ildb(VADriverContextP ctx, struct decode_state *decode_state, void *h264_context)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); struct i965_h264_context *i965_h264_context = (struct i965_h264_context *)h264_context;
struct i965_media_state *media_state = &i965->media_state;
struct i965_h264_context *i965_h264_context = (struct i965_h264_context *)media_state->private_context;
if (i965_h264_context->enable_avc_ildb) { if (i965_h264_context->enable_avc_ildb) {
i965_avc_ildb_states_setup(ctx, decode_state); i965_avc_ildb_states_setup(ctx, decode_state, i965_h264_context);
i965_avc_ildb_pipeline_setup(ctx); i965_avc_ildb_pipeline_setup(ctx, i965_h264_context);
} }
} }
void void
i965_avc_ildb_decode_init(VADriverContextP ctx) i965_avc_ildb_decode_init(VADriverContextP ctx, void *h264_context)
{ {
struct i965_driver_data *i965 = i965_driver_data(ctx); 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 = (struct i965_h264_context *)h264_context;
struct i965_h264_context *i965_h264_context = (struct i965_h264_context *)media_state->private_context;
struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context;; struct i965_avc_ildb_context *avc_ildb_context = &i965_h264_context->avc_ildb_context;;
dri_bo *bo; dri_bo *bo;
int i; int i;
......
...@@ -88,8 +88,8 @@ struct i965_avc_ildb_context ...@@ -88,8 +88,8 @@ struct i965_avc_ildb_context
int mbs_per_picture; int mbs_per_picture;
}; };
void i965_avc_ildb(VADriverContextP, struct decode_state *); void i965_avc_ildb(VADriverContextP, struct decode_state *, void *h264_context);
void i965_avc_ildb_decode_init(VADriverContextP); void i965_avc_ildb_decode_init(VADriverContextP, void *h264_context);
Bool i965_avc_ildb_ternimate(struct i965_avc_ildb_context *); Bool i965_avc_ildb_ternimate(struct i965_avc_ildb_context *);
#endif /* __I965_AVC_ILDB_H__ */ #endif /* __I965_AVC_ILDB_H__ */
......
This diff is collapsed.
...@@ -37,12 +37,8 @@ ...@@ -37,12 +37,8 @@
#include "intel_driver.h" #include "intel_driver.h"
#include "i965_media.h"
#include "i965_render.h" #include "i965_render.h"
#include "gen6_vme.h"
#include "gen6_mfc.h"
#define I965_MAX_PROFILES 11 #define I965_MAX_PROFILES 11
#define I965_MAX_ENTRYPOINTS 5 #define I965_MAX_ENTRYPOINTS 5
#define I965_MAX_CONFIG_ATTRIBUTES 10 #define I965_MAX_CONFIG_ATTRIBUTES 10
...@@ -51,6 +47,15 @@ ...@@ -51,6 +47,15 @@
#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"
struct media_kernel
{
char *name;
int interface;
unsigned int (*bin)[4];
int size;
dri_bo *bo;
};
struct buffer_store struct buffer_store
{ {
unsigned char *buffer; unsigned char *buffer;
...@@ -84,8 +89,7 @@ struct decode_state ...@@ -84,8 +89,7 @@ struct decode_state
int num_slice_datas; int num_slice_datas;
}; };
//keeping mfc encoder's stuff here struct encode_state
struct mfc_encode_state
{ {
struct buffer_store *seq_param; struct buffer_store *seq_param;
struct buffer_store *pic_param; struct buffer_store *pic_param;
...@@ -98,6 +102,24 @@ struct mfc_encode_state ...@@ -98,6 +102,24 @@ struct mfc_encode_state
int num_slice_params; int num_slice_params;
}; };
#define CODEC_DEC 0
#define CODEC_ENC 1
union codec_state
{
struct decode_state dec;
struct encode_state enc;
};
struct hw_context
{
void (*run)(VADriverContextP ctx,
VAProfile profile,
union codec_state *codec_state,
struct hw_context *hw_context);
void (*destroy)(void *);
};
struct object_context struct object_context
{ {
struct object_base base; struct object_base base;
...@@ -108,8 +130,9 @@ struct object_context ...@@ -108,8 +130,9 @@ struct object_context
int picture_width; int picture_width;
int picture_height; int picture_height;
int flags; int flags;
struct decode_state decode_state; int codec_type;
struct mfc_encode_state encode_state; union codec_state codec_state;
struct hw_context *hw_context;
}; };
#define SURFACE_REFERENCED (1 << 0) #define SURFACE_REFERENCED (1 << 0)
...@@ -175,6 +198,12 @@ struct object_subpic ...@@ -175,6 +198,12 @@ struct object_subpic
dri_bo *bo; dri_bo *bo;
}; };
struct hw_codec_info
{
struct hw_context *(*dec_hw_context_init)(VADriverContextP, VAProfile);
struct hw_context *(*enc_hw_context_init)(VADriverContextP, VAProfile);
};
struct i965_driver_data struct i965_driver_data
{ {
struct intel_driver_data intel; struct intel_driver_data intel;
...@@ -184,11 +213,9 @@ struct i965_driver_data ...@@ -184,11 +213,9 @@ struct i965_driver_data
struct object_heap buffer_heap; struct object_heap buffer_heap;
struct object_heap image_heap; struct object_heap image_heap;
struct object_heap subpic_heap; struct object_heap subpic_heap;
struct i965_media_state media_state;
struct i965_render_state render_state; struct i965_render_state render_state;
struct hw_codec_info *codec_info;
void *pp_context; void *pp_context;
struct gen6_media_state gen6_media_state;
struct gen6_mfc_bcs_state gen6_mfc_bcs_state;
}; };
#define NEW_CONFIG_ID() object_heap_allocate(&i965->config_heap); #define NEW_CONFIG_ID() object_heap_allocate(&i965->config_heap);
......
This diff is collapsed.
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
* *
*/ */
#ifndef _GEN6_MFC_H_ #ifndef _I965_ENCODER_H_
#define _GEN6_MFC_H_ #define _I965_ENCODER_H_
#include <xf86drm.h> #include <xf86drm.h>
#include <drm.h> #include <drm.h>
...@@ -36,40 +36,16 @@ ...@@ -36,40 +36,16 @@
#include "i965_structs.h" #include "i965_structs.h"
#include "i965_drv_video.h" #include "i965_drv_video.h"
#include "gen6_vme.h"
#include "gen6_mfc.h"
VAStatus i965_encoder_create_context( struct gen6_encoder_context
VADriverContextP ctx, {
VAConfigID config_id, struct hw_context base;
int picture_width, struct gen6_vme_context vme_context;
int picture_height, struct gen6_mfc_context mfc_context;
int flag, };
VASurfaceID *render_targets,
int num_render_targets,
struct object_context *obj_context
);
VAStatus i965_encoder_begin_picture( #endif /* _I965_ENCODER_H_ */
VADriverContextP ctx,
VAContextID context,
VASurfaceID render_target
);
VAStatus i965_encoder_render_picture(VADriverContextP ctx,
VAContextID context,
VABufferID *buffers,
int num_buffers
);
VAStatus i965_encoder_end_picture(VADriverContextP ctx,
VAContextID context
);
void i965_encoder_destroy_context(struct object_heap *heap, struct object_base *obj);
Bool i965_encoder_init(VADriverContextP ctx);
Bool i965_encoder_terminate(VADriverContextP ctx);
#endif /* _GEN6_MFC_H_ */
This diff is collapsed.
...@@ -46,17 +46,10 @@ ...@@ -46,17 +46,10 @@
struct decode_state; struct decode_state;
struct media_kernel struct i965_media_context
{ {
char *name; struct hw_context base;
int interface;
unsigned int (*bin)[4];
int size;
dri_bo *bo;
};
struct i965_media_state
{
struct { struct {
dri_bo *bo; dri_bo *bo;
} surface_state[MAX_MEDIA_SURFACES]; } surface_state[MAX_MEDIA_SURFACES];
...@@ -99,14 +92,9 @@ struct i965_media_state ...@@ -99,14 +92,9 @@ struct i965_media_state
} urb; } urb;
void *private_context; void *private_context;
void (*media_states_setup)(VADriverContextP ctx, struct decode_state *decode_state); void (*media_states_setup)(VADriverContextP ctx, struct decode_state *decode_state, struct i965_media_context *media_context);
void (*media_objects)(VADriverContextP ctx, struct decode_state *decode_state); void (*media_objects)(VADriverContextP ctx, struct decode_state *decode_state, struct i965_media_context *media_context);
void (*free_private_context)(void **data); void (*free_private_context)(void **data);
}; };
Bool i965_media_init(VADriverContextP ctx);
Bool i965_media_terminate(VADriverContextP ctx);
void i965_media_decode_picture(VADriverContextP ctx,
VAProfile profile,
struct decode_state *decode_state);
#endif /* _I965_MEDIA_H_ */ #endif /* _I965_MEDIA_H_ */
This diff is collapsed.
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
#include "i965_avc_hw_scoreboard.h" #include "i965_avc_hw_scoreboard.h"
#include "i965_avc_ildb.h" #include "i965_avc_ildb.h"
struct decode_state;
struct i965_media_context;
#define INST_UNIT_GEN4 16 #define INST_UNIT_GEN4 16
#define INST_UNIT_GEN5 8 #define INST_UNIT_GEN5 8
...@@ -61,6 +64,7 @@ struct i965_h264_context ...@@ -61,6 +64,7 @@ struct i965_h264_context
} fsid_list[16]; } fsid_list[16];
}; };
void i965_media_h264_decode_init(VADriverContextP ctx, struct decode_state *decode_state); void i965_media_h264_decode_init(VADriverContextP ctx, struct decode_state *decode_state, struct i965_media_context *media_context);
void i965_media_h264_dec_context_init(VADriverContextP ctx, struct i965_media_context *media_context);
#endif /* _I965_MEDIA_H264_H_ */ #endif /* _I965_MEDIA_H264_H_ */
This diff is collapsed.
...@@ -35,10 +35,10 @@ ...@@ -35,10 +35,10 @@
#include <i915_drm.h> #include <i915_drm.h>
#include <intel_bufmgr.h> #include <intel_bufmgr.h>
#include "i965_structs.h"
struct decode_state; struct decode_state;
struct i965_media_context;
void i965_media_mpeg2_decode_init(VADriverContextP ctx, struct decode_state * decode_state); void i965_media_mpeg2_decode_init(VADriverContextP ctx, struct decode_state * decode_state, struct i965_media_context *media_context);
void i965_media_mpeg2_dec_context_init(VADriverContextP ctx, struct i965_media_context *media_context);
#endif /* _I965_MEDIA_MPEG2_H_ */ #endif /* _I965_MEDIA_MPEG2_H_ */
...@@ -35,8 +35,9 @@ ...@@ -35,8 +35,9 @@
#include "intel_batchbuffer.h" #include "intel_batchbuffer.h"
#include "intel_driver.h" #include "intel_driver.h"
#include "i965_defines.h" #include "i965_defines.h"
#include "i965_structs.h"
#include "i965_post_processing.h" #include "i965_post_processing.h"
#include "i965_render.h" #include "i965_render.h"
#include "i965_drv_video.h" #include "i965_drv_video.h"
......
...@@ -41,10 +41,11 @@ ...@@ -41,10 +41,11 @@
#include "intel_batchbuffer.h" #include "intel_batchbuffer.h"
#include "intel_driver.h" #include "intel_driver.h"
#include "i965_defines.h" #include "i965_defines.h"
#include "i965_render.h"
#include "i965_drv_video.h" #include "i965_drv_video.h"
#include "i965_structs.h"
#include "i965_render.h"
#define SF_KERNEL_NUM_GRF 16 #define SF_KERNEL_NUM_GRF 16
#define SF_MAX_THREADS 1 #define SF_MAX_THREADS 1
......
...@@ -23,7 +23,7 @@ struct intel_batchbuffer ...@@ -23,7 +23,7 @@ struct intel_batchbuffer
int (*run)(drm_intel_bo *bo, int used, int (*run)(drm_intel_bo *bo, int used,
drm_clip_rect_t *cliprects, int num_cliprects, drm_clip_rect_t *cliprects, int num_cliprects,
int DR4, int ring_flag); int DR4, unsigned int ring_flag);
}; };
Bool intel_batchbuffer_init(struct intel_driver_data *intel); Bool intel_batchbuffer_init(struct intel_driver_data *intel);
......
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