1 /*--------------------------------------------------------------------------
2 Copyright (c) 2010-2018, The Linux Foundation. All rights reserved.
3
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions are
6 met:
7 * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above
10 copyright notice, this list of conditions and the following
11 disclaimer in the documentation and/or other materials provided
12 with the distribution.
13 * Neither the name of The Linux Foundation nor the names of its
14 contributors may be used to endorse or promote products derived
15 from this software without specific prior written permission.
16
17 THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
18 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
20 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
21 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 --------------------------------------------------------------------------*/
29
30 #include "vidc_debug.h"
31
print_omx_buffer(const char * str,OMX_BUFFERHEADERTYPE * pHeader)32 void print_omx_buffer(const char *str, OMX_BUFFERHEADERTYPE *pHeader)
33 {
34 if (!pHeader)
35 return;
36
37 DEBUG_PRINT_HIGH("%s: Header %p buffer %p alloclen %d offset %d filledlen %d timestamp %lld flags %#x",
38 str, pHeader, pHeader->pBuffer, pHeader->nAllocLen,
39 pHeader->nOffset, pHeader->nFilledLen,
40 pHeader->nTimeStamp, pHeader->nFlags);
41 }
42
print_v4l2_buffer(const char * str,struct v4l2_buffer * v4l2)43 void print_v4l2_buffer(const char *str, struct v4l2_buffer *v4l2)
44 {
45 if (!v4l2)
46 return;
47
48 if (v4l2->length == 1)
49 DEBUG_PRINT_HIGH(
50 "%s: %s: idx %2d userptr %#lx fd %d off %d size %d filled %d flags %#x\n",
51 str, v4l2->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ?
52 "OUTPUT" : "CAPTURE", v4l2->index,
53 v4l2->m.planes[0].m.userptr, v4l2->m.planes[0].reserved[MSM_VIDC_BUFFER_FD],
54 v4l2->m.planes[0].reserved[MSM_VIDC_DATA_OFFSET], v4l2->m.planes[0].length,
55 v4l2->m.planes[0].bytesused, v4l2->flags);
56 else
57 DEBUG_PRINT_HIGH(
58 "%s: %s: idx %2d userptr %#lx fd %d off %d size %d filled %d flags %#x, extradata: fd %d off %d size %d filled %d\n",
59 str, v4l2->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ?
60 "OUTPUT" : "CAPTURE", v4l2->index,
61 v4l2->m.planes[0].m.userptr, v4l2->m.planes[0].reserved[MSM_VIDC_BUFFER_FD],
62 v4l2->m.planes[0].reserved[MSM_VIDC_DATA_OFFSET], v4l2->m.planes[0].length,
63 v4l2->m.planes[0].bytesused, v4l2->m.planes[1].reserved[MSM_VIDC_BUFFER_FD],
64 v4l2->flags, v4l2->m.planes[1].reserved[MSM_VIDC_DATA_OFFSET],
65 v4l2->m.planes[1].length, v4l2->m.planes[1].bytesused);
66 }
67
print_debug_color_aspects(ColorAspects * a,const char * prefix)68 void print_debug_color_aspects(ColorAspects *a, const char *prefix)
69 {
70 DEBUG_PRINT_HIGH("%s : Color aspects : Primaries = %d(%s) Range = %d(%s) Tx = %d(%s) Matrix = %d(%s)",
71 prefix, a->mPrimaries, asString(a->mPrimaries), a->mRange, asString(a->mRange),
72 a->mTransfer, asString(a->mTransfer), a->mMatrixCoeffs, asString(a->mMatrixCoeffs));
73
74 }
75
print_debug_hdr_color_info(HDRStaticInfo * hdr_info,const char * prefix)76 void print_debug_hdr_color_info(HDRStaticInfo *hdr_info, const char *prefix)
77 {
78 if (!hdr_info->mID) {
79 DEBUG_PRINT_LOW("%s : HDRstaticinfo MDC: mR.x = %d mR.y = %d", prefix,
80 hdr_info->sType1.mR.x, hdr_info->sType1.mR.y);
81 DEBUG_PRINT_LOW("%s : HDRstaticinfo MDC: mG.x = %d mG.y = %d", prefix,
82 hdr_info->sType1.mG.x, hdr_info->sType1.mG.y);
83 DEBUG_PRINT_LOW("%s : HDRstaticinfo MDC: mB.x = %d mB.y = %d", prefix,
84 hdr_info->sType1.mB.x, hdr_info->sType1.mB.y);
85 DEBUG_PRINT_LOW("%s : HDRstaticinfo MDC: mW.x = %d mW.y = %d", prefix,
86 hdr_info->sType1.mW.x, hdr_info->sType1.mW.y);
87 DEBUG_PRINT_LOW("%s : HDRstaticinfo MDC: maxDispLum = %d minDispLum = %d", prefix,
88 hdr_info->sType1.mMaxDisplayLuminance, hdr_info->sType1.mMinDisplayLuminance);
89 DEBUG_PRINT_LOW("%s : HDRstaticinfo CLL: CLL = %d FLL = %d", prefix,
90 hdr_info->sType1.mMaxContentLightLevel, hdr_info->sType1.mMaxFrameAverageLightLevel);
91 }
92
93 }
94
print_debug_hdr_color_info_mdata(ColorMetaData * color_mdata)95 void print_debug_hdr_color_info_mdata(ColorMetaData* color_mdata)
96 {
97 DEBUG_PRINT_LOW("setMetaData COLOR_METADATA : color_primaries = %u, range = %u, transfer = %u, matrix = %u",
98 color_mdata->colorPrimaries, color_mdata->range,
99 color_mdata->transfer, color_mdata->matrixCoefficients);
100
101 for(uint8_t i = 0; i < 3; i++) {
102 for(uint8_t j = 0; j < 2; j++) {
103 DEBUG_PRINT_LOW("setMetadata COLOR_METADATA : rgbPrimaries[%d][%d] = %d", i, j, color_mdata->masteringDisplayInfo.primaries.rgbPrimaries[i][j]);
104 }
105 }
106
107 DEBUG_PRINT_LOW("setMetadata COLOR_METADATA : whitepoint[0] = %d whitepoint[1] = %d",
108 color_mdata->masteringDisplayInfo.primaries.whitePoint[0],
109 color_mdata->masteringDisplayInfo.primaries.whitePoint[1]);
110
111 DEBUG_PRINT_LOW("setMetadata COLOR_METADATA : maxDispLum = %d minDispLum = %d",
112 color_mdata->masteringDisplayInfo.maxDisplayLuminance,
113 color_mdata->masteringDisplayInfo.minDisplayLuminance);
114
115 DEBUG_PRINT_LOW("setMetadata COLOR_METADATA : maxCLL = %d maxFLL = %d",
116 color_mdata->contentLightLevel.maxContentLightLevel,
117 color_mdata->contentLightLevel.minPicAverageLightLevel);
118 }
119
print_debug_hdr10plus_metadata(ColorMetaData & color_mdata)120 void print_debug_hdr10plus_metadata(ColorMetaData& color_mdata)
121 {
122 DEBUG_PRINT_LOW("HDR10+ valid data length: %d", color_mdata.dynamicMetaDataLen);
123 for (uint32_t i = 0 ; i < color_mdata.dynamicMetaDataLen && i+3 < HDR_DYNAMIC_META_DATA_SZ; i=i+4) {
124 DEBUG_PRINT_LOW("HDR10+ mdata: %02X %02X %02X %02X", color_mdata.dynamicMetaDataPayload[i],
125 color_mdata.dynamicMetaDataPayload[i+1],
126 color_mdata.dynamicMetaDataPayload[i+2],
127 color_mdata.dynamicMetaDataPayload[i+3]);
128 }
129
130 }
131
132