summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElaine Wang <elaine.wang@intel.com>2012-10-23 16:04:59 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2013-06-19 14:24:12 +0800
commitcd08c78169c4b958f5c491fb409f09870f90ee5b (patch)
tree3e65152fcc490c0d2f1004bb1bbbd2fcda81f5c6
parent49bb3208eacb2fd7974c69d6bf42754e24a745a2 (diff)
vatrace: fix vatrace crash during video recording
Video recording crash when va trace is enabled. It's caused by using wrong buffer type to trace slice buffer. This patch distinguish buffer type VAEncSliceParameterBuffer from VAEncSliceParameterBufferH264 by the buffer size. Signed-off-by: Elaine Wang <elaine.wang@intel.com> Change-Id: Ibc5c6a17b155e305151a25580b4e613702665ad1 (cherry picked from commit b5b1933f60dfec8cf2cff19082362accbe6fce1d)
-rw-r--r--va/va_trace.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/va/va_trace.c b/va/va_trace.c
index b7ac041..0d51898 100644
--- a/va/va_trace.c
+++ b/va/va_trace.c
@@ -1348,6 +1348,8 @@ static void va_TraceVAEncSliceParameterBufferH264(
DPY2INDEX(dpy);
int i;
+ if (!p)
+ return;
va_TraceMsg(idx, "VAEncSliceParameterBufferH264\n");
va_TraceMsg(idx, "\tmacroblock_address = %d\n", p->macroblock_address);
va_TraceMsg(idx, "\tnum_macroblocks = %d\n", p->num_macroblocks);
@@ -1366,12 +1368,12 @@ static void va_TraceVAEncSliceParameterBufferH264(
if (p->slice_type == 0 || p->slice_type == 1) {
va_TraceMsg(idx, "\tRefPicList0 =");
- for (i = 0; i < p->num_ref_idx_l0_active_minus1 + 1; i++) {
+ for (i = 0; i < p->num_ref_idx_l0_active_minus1 + 1 && i < 32; i++) {
va_TraceMsg(idx, "%d-%d-0x%08x-%d\n", p->RefPicList0[i].TopFieldOrderCnt, p->RefPicList0[i].BottomFieldOrderCnt, p->RefPicList0[i].picture_id, p->RefPicList0[i].frame_idx);
}
if (p->slice_type == 1) {
va_TraceMsg(idx, "\tRefPicList1 =");
- for (i = 0; i < p->num_ref_idx_l1_active_minus1 + 1; i++)
+ for (i = 0; i < p->num_ref_idx_l1_active_minus1 + 1 && i < 32; i++)
{
va_TraceMsg(idx, "%d-%d-0x%08x-%d\n", p->RefPicList1[i].TopFieldOrderCnt, p->RefPicList1[i].BottomFieldOrderCnt, p->RefPicList1[i].picture_id, p->RefPicList1[i].frame_idx);
}
@@ -1381,7 +1383,7 @@ static void va_TraceVAEncSliceParameterBufferH264(
va_TraceMsg(idx, "\tluma_log2_weight_denom = %d\n", p->luma_log2_weight_denom);
va_TraceMsg(idx, "\tchroma_log2_weight_denom = %d\n", p->chroma_log2_weight_denom);
va_TraceMsg(idx, "\tluma_weight_l0_flag = %d\n", p->luma_weight_l0_flag);
- if (p->luma_weight_l0_flag) {
+ if (p->luma_weight_l0_flag && p->num_ref_idx_l0_active_minus1 < 32) {
for (i = 0; i <= p->num_ref_idx_l0_active_minus1; i++) {
va_TraceMsg(idx, "\t%d ", p->luma_weight_l0[i]);
va_TraceMsg(idx, "\t%d ", p->luma_offset_l0[i]);
@@ -1389,7 +1391,7 @@ static void va_TraceVAEncSliceParameterBufferH264(
}
va_TraceMsg(idx, "\tchroma_weight_l0_flag = %d\n", p->chroma_weight_l0_flag);
- if (p->chroma_weight_l0_flag) {
+ if (p->chroma_weight_l0_flag && p->num_ref_idx_l0_active_minus1 < 32) {
for (i = 0; i <= p->num_ref_idx_l0_active_minus1; i++) {
va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l0[i][0]);
va_TraceMsg(idx, "\t\t%d ", p->chroma_offset_l0[i][0]);
@@ -1399,7 +1401,7 @@ static void va_TraceVAEncSliceParameterBufferH264(
}
va_TraceMsg(idx, "\tluma_weight_l1_flag = %d\n", p->luma_weight_l1_flag);
- if (p->luma_weight_l1_flag) {
+ if (p->luma_weight_l1_flag && p->num_ref_idx_l1_active_minus1 < 32) {
for (i = 0; i <= p->num_ref_idx_l1_active_minus1; i++) {
va_TraceMsg(idx, "\t\t%d ", p->luma_weight_l1[i]);
va_TraceMsg(idx, "\t\t%d ", p->luma_offset_l1[i]);
@@ -1407,7 +1409,7 @@ static void va_TraceVAEncSliceParameterBufferH264(
}
va_TraceMsg(idx, "\tchroma_weight_l1_flag = %d\n", p->chroma_weight_l1_flag);
- if (p->chroma_weight_l1_flag) {
+ if (p->chroma_weight_l1_flag && p->num_ref_idx_l1_active_minus1 < 32) {
for (i = 0; i <= p->num_ref_idx_l1_active_minus1; i++) {
va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l1[i][0]);
va_TraceMsg(idx, "\t\t%d ", p->chroma_offset_l1[i][0]);
@@ -2031,7 +2033,10 @@ static void va_TraceH264Buf(
va_TraceVAEncPictureParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
break;
case VAEncSliceParameterBufferType:
- va_TraceVAEncSliceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
+ if (size == sizeof(VAEncSliceParameterBuffer))
+ va_TraceVAEncSliceParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
+ else
+ va_TraceVAEncSliceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
break;
case VAEncMiscParameterBufferType:
va_TraceVAEncMiscParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);