diff options
author | Xiang, Haihao <haihao.xiang@intel.com> | 2009-07-23 11:09:53 +0800 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2009-07-24 10:48:00 +0800 |
commit | 9a45ace207199eb40e95dc6d2670b3096e66ecd9 (patch) | |
tree | b9a45f29f7a1239345f552db99b37a88bbbdc0e1 | |
parent | 043b4a866ab51acffc52d2d71db3475007747571 (diff) |
XvMC: enable XvMC/XvMC-VLD on IGDNG
-rw-r--r-- | src/i830_hwmc.c | 2 | ||||
-rw-r--r-- | src/i965_hwmc.c | 1 | ||||
-rw-r--r-- | src/i965_hwmc.h | 1 | ||||
-rw-r--r-- | src/xvmc/xvmc_vld.c | 137 |
4 files changed, 122 insertions, 19 deletions
diff --git a/src/i830_hwmc.c b/src/i830_hwmc.c index 72385de7..c6099d6b 100644 --- a/src/i830_hwmc.c +++ b/src/i830_hwmc.c @@ -62,7 +62,7 @@ Bool intel_xvmc_probe(ScrnInfoPtr pScrn) if (IS_I9XX(pI830)) { if (IS_I915(pI830)) ret = intel_xvmc_set_driver(&i915_xvmc_driver); - else if (IS_G4X(pI830)) + else if (IS_G4X(pI830) || IS_IGDNG(pI830)) ret = intel_xvmc_set_driver(&vld_xvmc_driver); else ret = intel_xvmc_set_driver(&i965_xvmc_driver); diff --git a/src/i965_hwmc.c b/src/i965_hwmc.c index 7163330e..e7b5de1b 100644 --- a/src/i965_hwmc.c +++ b/src/i965_hwmc.c @@ -73,6 +73,7 @@ static int create_context(ScrnInfoPtr pScrn, private_context->is_g4x = IS_G4X(I830); private_context->is_965_q = IS_965_Q(I830); + private_context->is_igdng = IS_IGDNG(I830); private_context->comm.kernel_exec_fencing = I830->kernel_exec_fencing; private_context->comm.type = xvmc_driver->flag; diff --git a/src/i965_hwmc.h b/src/i965_hwmc.h index fb61516c..12d977b2 100644 --- a/src/i965_hwmc.h +++ b/src/i965_hwmc.h @@ -24,4 +24,5 @@ struct i965_xvmc_context { struct i965_xvmc_surface *surfaces[I965_MAX_SURFACES]; unsigned int is_g4x:1; unsigned int is_965_q:1; + unsigned int is_igdng:1; }; diff --git a/src/xvmc/xvmc_vld.c b/src/xvmc/xvmc_vld.c index a2c2c159..d964fc1b 100644 --- a/src/xvmc/xvmc_vld.c +++ b/src/xvmc/xvmc_vld.c @@ -111,6 +111,32 @@ static uint32_t field_f_b_kernel[][4] = { #include "shader/vld/field_f_b.g4b" }; +/* on IGDNG */ +static uint32_t lib_kernel_gen5[][4] = { + #include "shader/vld/lib.g4b.gen5" +}; +static uint32_t ipicture_kernel_gen5[][4] = { + #include "shader/vld/ipicture.g4b.gen5" +}; +static uint32_t frame_forward_kernel_gen5[][4] = { + #include "shader/vld/frame_forward.g4b.gen5" +}; +static uint32_t frame_backward_kernel_gen5[][4] = { + #include "shader/vld/frame_backward.g4b.gen5" +}; +static uint32_t frame_f_b_kernel_gen5[][4] = { + #include "shader/vld/frame_f_b.g4b.gen5" +}; +static uint32_t field_forward_kernel_gen5[][4] = { + #include "shader/vld/field_forward.g4b.gen5" +}; +static uint32_t field_backward_kernel_gen5[][4] = { + #include "shader/vld/field_backward.g4b.gen5" +}; +static uint32_t field_f_b_kernel_gen5[][4] = { + #include "shader/vld/field_f_b.g4b.gen5" +}; + /*kernels for mc mode*/ static uint32_t lib_kernel_idct[][4] = { #include "shader/mc/lib_igd.g4b" @@ -137,10 +163,37 @@ static uint32_t field_f_b_kernel_idct[][4] = { #include "shader/mc/field_f_b_igd.g4b" }; +/* on IGDNG */ +static uint32_t lib_kernel_idct_gen5[][4] = { + #include "shader/mc/lib_igd.g4b.gen5" +}; +static uint32_t ipicture_kernel_idct_gen5[][4] = { + #include "shader/mc/ipicture_igd.g4b.gen5" +}; +static uint32_t frame_forward_kernel_idct_gen5[][4] = { + #include "shader/mc/frame_forward_igd.g4b.gen5" +}; +static uint32_t frame_backward_kernel_idct_gen5[][4] = { + #include "shader/mc/frame_backward_igd.g4b.gen5" +}; +static uint32_t frame_f_b_kernel_idct_gen5[][4] = { + #include "shader/mc/frame_f_b_igd.g4b.gen5" +}; +static uint32_t field_forward_kernel_idct_gen5[][4] = { + #include "shader/mc/field_forward_igd.g4b.gen5" +}; +static uint32_t field_backward_kernel_idct_gen5[][4] = { + #include "shader/mc/field_backward_igd.g4b.gen5" +}; +static uint32_t field_f_b_kernel_idct_gen5[][4] = { + #include "shader/mc/field_f_b_igd.g4b.gen5" +}; + struct media_kernel { uint32_t (*bin)[4]; int size; -}media_kernels[] = { +}; +static struct media_kernel media_kernels[] = { /*kernels for vld mode*/ {ipicture_kernel, sizeof(ipicture_kernel)}, {frame_forward_kernel, sizeof(frame_forward_kernel)}, @@ -161,6 +214,27 @@ struct media_kernel { {lib_kernel_idct, sizeof(lib_kernel_idct)} }; +static struct media_kernel media_gen5_kernels[] = { + /*kernels for vld mode*/ + {ipicture_kernel_gen5, sizeof(ipicture_kernel_gen5)}, + {frame_forward_kernel_gen5, sizeof(frame_forward_kernel_gen5)}, + {frame_backward_kernel_gen5, sizeof(frame_backward_kernel_gen5)}, + {frame_f_b_kernel_gen5, sizeof(frame_f_b_kernel_gen5)}, + {field_forward_kernel_gen5, sizeof(field_forward_kernel_gen5)}, + {field_backward_kernel_gen5, sizeof(field_backward_kernel_gen5)}, + {field_f_b_kernel_gen5, sizeof(field_f_b_kernel_gen5)}, + {lib_kernel_gen5, sizeof(lib_kernel_gen5)}, + /*kernels for mc mode*/ + {ipicture_kernel_idct_gen5, sizeof(ipicture_kernel_idct_gen5)}, + {frame_forward_kernel_idct_gen5, sizeof(frame_forward_kernel_idct_gen5)}, + {frame_backward_kernel_idct_gen5, sizeof(frame_backward_kernel_idct_gen5)}, + {frame_f_b_kernel_idct_gen5, sizeof(frame_f_b_kernel_idct_gen5)}, + {field_forward_kernel_idct_gen5, sizeof(field_forward_kernel_idct_gen5)}, + {field_backward_kernel_idct_gen5, sizeof(field_backward_kernel_idct_gen5)}, + {field_f_b_kernel_idct_gen5, sizeof(field_f_b_kernel_idct_gen5)}, + {lib_kernel_idct_gen5, sizeof(lib_kernel_idct_gen5)} +}; + #define MEDIA_KERNEL_NUM (sizeof(media_kernels)/sizeof(media_kernels[0])) struct media_kernel_obj { @@ -346,21 +420,33 @@ static Status interface_descriptor() return Success; } -static int setup_media_kernels() +static int setup_media_kernels(struct i965_xvmc_context *i965_ctx) { int i; + assert(MEDIA_KERNEL_NUM == sizeof(media_gen5_kernels) / sizeof(media_gen5_kernels[0])); + for (i = 0; i < MEDIA_KERNEL_NUM; i++) { - media_state.vfe_state.interface.kernels[i].bo = + if (i965_ctx->is_igdng) + media_state.vfe_state.interface.kernels[i].bo = drm_intel_bo_alloc(xvmc_driver->bufmgr, "kernel", - media_kernels[i].size, 0x1000); + media_gen5_kernels[i].size, 0x1000); + else + media_state.vfe_state.interface.kernels[i].bo = + drm_intel_bo_alloc(xvmc_driver->bufmgr, "kernels", + media_kernels[i].size, 0x1000); + if (!media_state.vfe_state.interface.kernels[i].bo) goto out; } for (i = 0; i < MEDIA_KERNEL_NUM; i++) { dri_bo *bo = media_state.vfe_state.interface.kernels[i].bo; - drm_intel_bo_subdata(bo, 0, media_kernels[i].size, media_kernels[i].bin); + + if (i965_ctx->is_igdng) + drm_intel_bo_subdata(bo, 0, media_gen5_kernels[i].size, media_gen5_kernels[i].bin); + else + drm_intel_bo_subdata(bo, 0, media_kernels[i].size, media_kernels[i].bin); } return 0; out: @@ -433,7 +519,7 @@ static Status create_context(Display *display, XvMCContext *context, if (alloc_object(&media_state)) return BadAlloc; - if (setup_media_kernels()) + if (setup_media_kernels(i965_ctx)) return BadAlloc; return Success; } @@ -658,19 +744,32 @@ static Status put_slice(Display *display, XvMCContext *context, return Success; } -static void state_base_address() +static void state_base_address(struct i965_xvmc_context *i965_ctx) { BATCH_LOCALS; - BEGIN_BATCH(6); - OUT_BATCH(BRW_STATE_BASE_ADDRESS|4); - OUT_BATCH(0 | BASE_ADDRESS_MODIFY); - OUT_BATCH(0 | BASE_ADDRESS_MODIFY); - OUT_BATCH(0 | BASE_ADDRESS_MODIFY); - OUT_BATCH(0 | BASE_ADDRESS_MODIFY); - OUT_BATCH(0 | BASE_ADDRESS_MODIFY); - ADVANCE_BATCH(); -} + if (i965_ctx->is_igdng) { + BEGIN_BATCH(8); + OUT_BATCH(BRW_STATE_BASE_ADDRESS|6); + OUT_BATCH(0 | BASE_ADDRESS_MODIFY); + OUT_BATCH(0 | BASE_ADDRESS_MODIFY); + OUT_BATCH(0 | BASE_ADDRESS_MODIFY); + OUT_BATCH(0 | BASE_ADDRESS_MODIFY); + OUT_BATCH(0 | BASE_ADDRESS_MODIFY); + OUT_BATCH(0 | BASE_ADDRESS_MODIFY); + OUT_BATCH(0 | BASE_ADDRESS_MODIFY); + ADVANCE_BATCH(); + } else { + BEGIN_BATCH(6); + OUT_BATCH(BRW_STATE_BASE_ADDRESS|4); + OUT_BATCH(0 | BASE_ADDRESS_MODIFY); + OUT_BATCH(0 | BASE_ADDRESS_MODIFY); + OUT_BATCH(0 | BASE_ADDRESS_MODIFY); + OUT_BATCH(0 | BASE_ADDRESS_MODIFY); + OUT_BATCH(0 | BASE_ADDRESS_MODIFY); + ADVANCE_BATCH(); + } +} static void pipeline_select() { BATCH_LOCALS; @@ -834,7 +933,7 @@ static Status put_slice2(Display *display, XvMCContext *context, intel_ctx = intel_xvmc_find_context(context->context_id); LOCK_HARDWARE(intel_ctx->hw_context); - state_base_address(); + state_base_address(i965_ctx); pipeline_select(); media_state_pointers(VFE_VLD_MODE); urb_layout(); @@ -884,6 +983,7 @@ static Status render_surface(Display *display, unsigned short *block_ptr; int i, j; int block_offset = 0; + struct i965_xvmc_context *i965_ctx; intel_ctx = intel_xvmc_find_context(context->context_id); if (!intel_ctx) { @@ -891,6 +991,7 @@ static Status render_surface(Display *display, return BadValue; } + i965_ctx = (struct i965_xvmc_context *)context->privData; priv_target = target_surface->privData; priv_past = past_surface?past_surface->privData:NULL; priv_future = future_surface?future_surface->privData:NULL; @@ -975,7 +1076,7 @@ static Status render_surface(Display *display, } LOCK_HARDWARE(intel_ctx->hw_context); - state_base_address(); + state_base_address(i965_ctx); flush(); pipeline_select(); urb_layout(); |