[Libva] [Libva-intel-driver][PATCH 2/2] Encode: Set cost for MODE_CHROMA_INTRA/MODE_REFID_COST

Xiang, Haihao haihao.xiang at intel.com
Mon Jul 25 08:53:08 UTC 2016

This fixes the remaining issues mentioned in https://bugs.freedesktop.org/show_bug.cgi?id=96703
after applying commit 3699c14

On GEN75+, driver copies vme_context->vme_state_message to VME kernel curbe buffer and
VME kernel uses the data in curbe buffer to initialize VME message payload.
vme_context->vme_state_message is set up in intel_vme_update_mbmv_cost(), which doesn't
set all costs for used modes in VME kernels. The uninitialized mode cost will result in
difference in VME output. Thanks for Elaine's finding that the issue disappears after
initializing VME state message buffer with zeros.

Signed-off-by: Elaine Wang <elaine.wang at intel.com>
Signed-off-by: Xiang, Haihao <haihao.xiang at intel.com>
 src/gen6_mfc_common.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/gen6_mfc_common.c b/src/gen6_mfc_common.c
index 2f9f761..c3e4d80 100644
--- a/src/gen6_mfc_common.c
+++ b/src/gen6_mfc_common.c
@@ -790,6 +790,11 @@ void intel_vme_update_mbmv_cost(VADriverContextP ctx,
     assert(qp <= QP_MAX); 
     lambda = intel_lambda_qp(qp);
+    m_cost = lambda;
+    vme_state_message[MODE_CHROMA_INTRA] = intel_format_lutvalue(m_cost, 0x8f);
+    vme_state_message[MODE_REFID_COST] = intel_format_lutvalue(m_cost, 0x8f);
     if (slice_type == SLICE_TYPE_I) {
         vme_state_message[MODE_INTRA_16X16] = 0;
         m_cost = lambda * 4;

More information about the Libva mailing list