hardware/intel/common/libva
リビジョン | 3115508fb01b0d74949d9d84c6a9490a4a08df91 (tree) |
---|---|
日時 | 2017-09-27 13:48:16 |
作者 | Mark Thompson <sw@jkqx...> |
コミッター | Xiang, Haihao |
Add namespace prefix to globals
Add "va_" prefix to trace_flag, fool_codec and fool_postp to avoid
polluting the global namespace.
Signed-off-by: Mark Thompson <sw@jkqxz.net>
@@ -166,8 +166,8 @@ VADisplay vaGetDisplay ( | ||
166 | 166 | |
167 | 167 | |
168 | 168 | extern "C" { |
169 | - extern int fool_postp; /* do nothing for vaPutSurface if set */ | |
170 | - extern int trace_flag; /* trace vaPutSurface parameters */ | |
169 | + extern int va_fool_postp; /* do nothing for vaPutSurface if set */ | |
170 | + extern int va_trace_flag; /* trace vaPutSurface parameters */ | |
171 | 171 | |
172 | 172 | void va_TracePutSurface ( |
173 | 173 | VADisplay dpy, |
@@ -62,14 +62,14 @@ | ||
62 | 62 | |
63 | 63 | |
64 | 64 | /* global settings */ |
65 | -int fool_codec = 0; | |
66 | -int fool_postp = 0; | |
65 | +int va_fool_codec = 0; | |
66 | +int va_fool_postp = 0; | |
67 | 67 | |
68 | 68 | #define FOOL_BUFID_MAGIC 0x12345600 |
69 | 69 | #define FOOL_BUFID_MASK 0xffffff00 |
70 | 70 | |
71 | 71 | struct fool_context { |
72 | - int enabled; /* fool_codec is global, and it is for concurent encode/decode */ | |
72 | + int enabled; /* va_fool_codec is global, and it is for concurent encode/decode */ | |
73 | 73 | char *fn_enc;/* file pattern with codedbuf content for encode */ |
74 | 74 | char *segbuf_enc; /* the segment buffer of coded buffer, load frome fn_enc */ |
75 | 75 | int file_count; |
@@ -114,22 +114,22 @@ void va_FoolInit(VADisplay dpy) | ||
114 | 114 | return; |
115 | 115 | |
116 | 116 | if (va_parseConfig("LIBVA_FOOL_POSTP", NULL) == 0) { |
117 | - fool_postp = 1; | |
117 | + va_fool_postp = 1; | |
118 | 118 | va_infoMessage(dpy, "LIBVA_FOOL_POSTP is on, dummy vaPutSurface\n"); |
119 | 119 | } |
120 | 120 | |
121 | 121 | if (va_parseConfig("LIBVA_FOOL_DECODE", NULL) == 0) { |
122 | - fool_codec |= VA_FOOL_FLAG_DECODE; | |
122 | + va_fool_codec |= VA_FOOL_FLAG_DECODE; | |
123 | 123 | va_infoMessage(dpy, "LIBVA_FOOL_DECODE is on, dummy decode\n"); |
124 | 124 | } |
125 | 125 | if (va_parseConfig("LIBVA_FOOL_ENCODE", &env_value[0]) == 0) { |
126 | - fool_codec |= VA_FOOL_FLAG_ENCODE; | |
126 | + va_fool_codec |= VA_FOOL_FLAG_ENCODE; | |
127 | 127 | fool_ctx->fn_enc = strdup(env_value); |
128 | 128 | va_infoMessage(dpy, "LIBVA_FOOL_ENCODE is on, load encode data from file with patten %s\n", |
129 | 129 | fool_ctx->fn_enc); |
130 | 130 | } |
131 | 131 | if (va_parseConfig("LIBVA_FOOL_JPEG", &env_value[0]) == 0) { |
132 | - fool_codec |= VA_FOOL_FLAG_JPEG; | |
132 | + va_fool_codec |= VA_FOOL_FLAG_JPEG; | |
133 | 133 | fool_ctx->fn_jpg = strdup(env_value); |
134 | 134 | va_infoMessage(dpy, "LIBVA_FOOL_JPEG is on, load encode data from file with patten %s\n", |
135 | 135 | fool_ctx->fn_jpg); |
@@ -177,15 +177,15 @@ int va_FoolCreateConfig( | ||
177 | 177 | fool_ctx->entrypoint = entrypoint; |
178 | 178 | |
179 | 179 | /* |
180 | - * check fool_codec to align with current context | |
181 | - * e.g. fool_codec = decode then for encode, the | |
180 | + * check va_fool_codec to align with current context | |
181 | + * e.g. va_fool_codec = decode then for encode, the | |
182 | 182 | * vaBegin/vaRender/vaEnd also run into fool path |
183 | 183 | * which is not desired |
184 | 184 | */ |
185 | - if (((fool_codec & VA_FOOL_FLAG_DECODE) && (entrypoint == VAEntrypointVLD)) || | |
186 | - ((fool_codec & VA_FOOL_FLAG_JPEG) && (entrypoint == VAEntrypointEncPicture))) | |
185 | + if (((va_fool_codec & VA_FOOL_FLAG_DECODE) && (entrypoint == VAEntrypointVLD)) || | |
186 | + ((va_fool_codec & VA_FOOL_FLAG_JPEG) && (entrypoint == VAEntrypointEncPicture))) | |
187 | 187 | fool_ctx->enabled = 1; |
188 | - else if ((fool_codec & VA_FOOL_FLAG_ENCODE) && (entrypoint == VAEntrypointEncSlice)) { | |
188 | + else if ((va_fool_codec & VA_FOOL_FLAG_ENCODE) && (entrypoint == VAEntrypointEncSlice)) { | |
189 | 189 | /* H264 is desired */ |
190 | 190 | if (((profile == VAProfileH264Baseline || |
191 | 191 | profile == VAProfileH264Main || |
@@ -32,15 +32,15 @@ | ||
32 | 32 | extern "C" { |
33 | 33 | #endif |
34 | 34 | |
35 | -extern int fool_codec; | |
36 | -extern int fool_postp; | |
35 | +extern int va_fool_codec; | |
36 | +extern int va_fool_postp; | |
37 | 37 | |
38 | 38 | #define VA_FOOL_FLAG_DECODE 0x1 |
39 | 39 | #define VA_FOOL_FLAG_ENCODE 0x2 |
40 | 40 | #define VA_FOOL_FLAG_JPEG 0x4 |
41 | 41 | |
42 | 42 | #define VA_FOOL_FUNC(fool_func,...) \ |
43 | - if (fool_codec) { \ | |
43 | + if (va_fool_codec) { \ | |
44 | 44 | if (fool_func(__VA_ARGS__)) \ |
45 | 45 | return VA_STATUS_SUCCESS; \ |
46 | 46 | } |
@@ -67,7 +67,7 @@ | ||
67 | 67 | /* global settings */ |
68 | 68 | |
69 | 69 | /* LIBVA_TRACE */ |
70 | -int trace_flag = 0; | |
70 | +int va_trace_flag = 0; | |
71 | 71 | |
72 | 72 | #define MAX_TRACE_CTX_NUM 64 |
73 | 73 | #define TRACE_CTX_ID_MASK (MAX_TRACE_CTX_NUM - 1) |
@@ -745,7 +745,7 @@ void va_TraceInit(VADisplay dpy) | ||
745 | 745 | trace_ctx->plog_file = start_tracing2log_file(pva_trace); |
746 | 746 | if(trace_ctx->plog_file) { |
747 | 747 | trace_ctx->plog_file_list[0] = trace_ctx->plog_file; |
748 | - trace_flag = VA_TRACE_FLAG_LOG; | |
748 | + va_trace_flag = VA_TRACE_FLAG_LOG; | |
749 | 749 | |
750 | 750 | va_infoMessage("LIBVA_TRACE is on, save log into %s\n", |
751 | 751 | trace_ctx->plog_file->fn_log); |
@@ -755,8 +755,8 @@ void va_TraceInit(VADisplay dpy) | ||
755 | 755 | } |
756 | 756 | |
757 | 757 | /* may re-get the global settings for multiple context */ |
758 | - if ((trace_flag & VA_TRACE_FLAG_LOG) && (va_parseConfig("LIBVA_TRACE_BUFDATA", NULL) == 0)) { | |
759 | - trace_flag |= VA_TRACE_FLAG_BUFDATA; | |
758 | + if ((va_trace_flag & VA_TRACE_FLAG_LOG) && (va_parseConfig("LIBVA_TRACE_BUFDATA", NULL) == 0)) { | |
759 | + va_trace_flag |= VA_TRACE_FLAG_BUFDATA; | |
760 | 760 | |
761 | 761 | va_infoMessage(dpy, "LIBVA_TRACE_BUFDATA is on, dump buffer into log file\n"); |
762 | 762 | } |
@@ -764,7 +764,7 @@ void va_TraceInit(VADisplay dpy) | ||
764 | 764 | /* per-context setting */ |
765 | 765 | if (va_parseConfig("LIBVA_TRACE_CODEDBUF", &env_value[0]) == 0) { |
766 | 766 | pva_trace->fn_codedbuf_env = strdup(env_value); |
767 | - trace_flag |= VA_TRACE_FLAG_CODEDBUF; | |
767 | + va_trace_flag |= VA_TRACE_FLAG_CODEDBUF; | |
768 | 768 | } |
769 | 769 | |
770 | 770 | if (va_parseConfig("LIBVA_TRACE_SURFACE", &env_value[0]) == 0) { |
@@ -777,11 +777,11 @@ void va_TraceInit(VADisplay dpy) | ||
777 | 777 | * if no dec/enc in file name, set both |
778 | 778 | */ |
779 | 779 | if (strstr(env_value, "dec")) |
780 | - trace_flag |= VA_TRACE_FLAG_SURFACE_DECODE; | |
780 | + va_trace_flag |= VA_TRACE_FLAG_SURFACE_DECODE; | |
781 | 781 | if (strstr(env_value, "enc")) |
782 | - trace_flag |= VA_TRACE_FLAG_SURFACE_ENCODE; | |
782 | + va_trace_flag |= VA_TRACE_FLAG_SURFACE_ENCODE; | |
783 | 783 | if (strstr(env_value, "jpeg") || strstr(env_value, "jpg")) |
784 | - trace_flag |= VA_TRACE_FLAG_SURFACE_JPEG; | |
784 | + va_trace_flag |= VA_TRACE_FLAG_SURFACE_JPEG; | |
785 | 785 | |
786 | 786 | if (va_parseConfig("LIBVA_TRACE_SURFACE_GEOMETRY", &env_value[0]) == 0) { |
787 | 787 | char *p = env_value, *q; |
@@ -811,7 +811,7 @@ void va_TraceInit(VADisplay dpy) | ||
811 | 811 | ((VADisplayContextP)dpy)->vatrace = (void *)pva_trace; |
812 | 812 | pva_trace->dpy = dpy; |
813 | 813 | |
814 | - if(!trace_flag) | |
814 | + if(!va_trace_flag) | |
815 | 815 | va_TraceEnd(dpy); |
816 | 816 | } |
817 | 817 |
@@ -889,7 +889,7 @@ static void va_TraceVPrint(struct trace_context *trace_ctx, const char *msg, va_ | ||
889 | 889 | { |
890 | 890 | FILE *fp = NULL; |
891 | 891 | |
892 | - if (!(trace_flag & VA_TRACE_FLAG_LOG) | |
892 | + if (!(va_trace_flag & VA_TRACE_FLAG_LOG) | |
893 | 893 | || !trace_ctx->plog_file) |
894 | 894 | return; |
895 | 895 |
@@ -1326,7 +1326,7 @@ void va_TraceCreateContext( | ||
1326 | 1326 | trace_ctx->trace_profile = pva_trace->config_info[i].trace_profile; |
1327 | 1327 | trace_ctx->trace_entrypoint = pva_trace->config_info[i].trace_entrypoint; |
1328 | 1328 | |
1329 | - if(trace_flag & VA_TRACE_FLAG_LOG) { | |
1329 | + if(va_trace_flag & VA_TRACE_FLAG_LOG) { | |
1330 | 1330 | trace_ctx->plog_file = start_tracing2log_file(pva_trace); |
1331 | 1331 | if(!trace_ctx->plog_file) { |
1332 | 1332 | va_errorMessage(dpy, "Can't get trace log file for ctx 0x%08x\n", |
@@ -1343,7 +1343,7 @@ void va_TraceCreateContext( | ||
1343 | 1343 | |
1344 | 1344 | trace_ctx->trace_context = *context; |
1345 | 1345 | TRACE_FUNCNAME(idx); |
1346 | - va_TraceMsg(trace_ctx, "\tcontext = 0x%08x trace_flag 0x%x\n", *context, trace_flag); | |
1346 | + va_TraceMsg(trace_ctx, "\tcontext = 0x%08x va_trace_flag 0x%x\n", *context, va_trace_flag); | |
1347 | 1347 | va_TraceMsg(trace_ctx, "\tprofile = %d entrypoint = %d\n", trace_ctx->trace_profile, |
1348 | 1348 | trace_ctx->trace_entrypoint); |
1349 | 1349 | va_TraceMsg(trace_ctx, "\tconfig = 0x%08x\n", config_id); |
@@ -1371,21 +1371,21 @@ void va_TraceCreateContext( | ||
1371 | 1371 | encode = (trace_ctx->trace_entrypoint == VAEntrypointEncSlice); |
1372 | 1372 | decode = (trace_ctx->trace_entrypoint == VAEntrypointVLD); |
1373 | 1373 | jpeg = (trace_ctx->trace_entrypoint == VAEntrypointEncPicture); |
1374 | - if ((encode && (trace_flag & VA_TRACE_FLAG_SURFACE_ENCODE)) || | |
1375 | - (decode && (trace_flag & VA_TRACE_FLAG_SURFACE_DECODE)) || | |
1376 | - (jpeg && (trace_flag & VA_TRACE_FLAG_SURFACE_JPEG))) { | |
1374 | + if ((encode && (va_trace_flag & VA_TRACE_FLAG_SURFACE_ENCODE)) || | |
1375 | + (decode && (va_trace_flag & VA_TRACE_FLAG_SURFACE_DECODE)) || | |
1376 | + (jpeg && (va_trace_flag & VA_TRACE_FLAG_SURFACE_JPEG))) { | |
1377 | 1377 | if(open_tracing_specil_file(pva_trace, trace_ctx, 1) < 0) { |
1378 | 1378 | va_errorMessage(dpy, "Open surface fail failed for ctx 0x%08x\n", *context); |
1379 | 1379 | |
1380 | - trace_flag &= ~(VA_TRACE_FLAG_SURFACE); | |
1380 | + va_trace_flag &= ~(VA_TRACE_FLAG_SURFACE); | |
1381 | 1381 | } |
1382 | 1382 | } |
1383 | 1383 | |
1384 | - if (encode && (trace_flag & VA_TRACE_FLAG_CODEDBUF)) { | |
1384 | + if (encode && (va_trace_flag & VA_TRACE_FLAG_CODEDBUF)) { | |
1385 | 1385 | if(open_tracing_specil_file(pva_trace, trace_ctx, 0) < 0) { |
1386 | 1386 | va_errorMessage(dpy, "Open codedbuf fail failed for ctx 0x%08x\n", *context); |
1387 | 1387 | |
1388 | - trace_flag &= ~(VA_TRACE_FLAG_CODEDBUF); | |
1388 | + va_trace_flag &= ~(VA_TRACE_FLAG_CODEDBUF); | |
1389 | 1389 | } |
1390 | 1390 | } |
1391 | 1391 |
@@ -1658,7 +1658,7 @@ static void va_TraceVABuffers( | ||
1658 | 1658 | if(trace_ctx->plog_file) |
1659 | 1659 | fp = trace_ctx->plog_file->fp_log; |
1660 | 1660 | |
1661 | - if ((trace_flag & VA_TRACE_FLAG_BUFDATA) && fp) { | |
1661 | + if ((va_trace_flag & VA_TRACE_FLAG_BUFDATA) && fp) { | |
1662 | 1662 | for (i=0; i<size; i++) { |
1663 | 1663 | unsigned char value = p[i]; |
1664 | 1664 |
@@ -4886,12 +4886,12 @@ void va_TraceEndPicture( | ||
4886 | 4886 | jpeg = (trace_ctx->trace_entrypoint == VAEntrypointEncPicture); |
4887 | 4887 | |
4888 | 4888 | /* trace encode source surface, can do it before HW completes rendering */ |
4889 | - if ((encode && (trace_flag & VA_TRACE_FLAG_SURFACE_ENCODE))|| | |
4890 | - (jpeg && (trace_flag & VA_TRACE_FLAG_SURFACE_JPEG))) | |
4889 | + if ((encode && (va_trace_flag & VA_TRACE_FLAG_SURFACE_ENCODE))|| | |
4890 | + (jpeg && (va_trace_flag & VA_TRACE_FLAG_SURFACE_JPEG))) | |
4891 | 4891 | va_TraceSurface(dpy, context); |
4892 | 4892 | |
4893 | 4893 | /* trace decoded surface, do it after HW completes rendering */ |
4894 | - if (decode && ((trace_flag & VA_TRACE_FLAG_SURFACE_DECODE))) { | |
4894 | + if (decode && ((va_trace_flag & VA_TRACE_FLAG_SURFACE_DECODE))) { | |
4895 | 4895 | vaSyncSurface(dpy, trace_ctx->trace_rendertarget); |
4896 | 4896 | va_TraceSurface(dpy, context); |
4897 | 4897 | } |
@@ -29,7 +29,7 @@ | ||
29 | 29 | extern "C" { |
30 | 30 | #endif |
31 | 31 | |
32 | -extern int trace_flag; | |
32 | +extern int va_trace_flag; | |
33 | 33 | |
34 | 34 | #define VA_TRACE_FLAG_LOG 0x1 |
35 | 35 | #define VA_TRACE_FLAG_BUFDATA 0x2 |
@@ -42,11 +42,11 @@ extern int trace_flag; | ||
42 | 42 | VA_TRACE_FLAG_SURFACE_JPEG) |
43 | 43 | |
44 | 44 | #define VA_TRACE_LOG(trace_func,...) \ |
45 | - if (trace_flag & VA_TRACE_FLAG_LOG) { \ | |
45 | + if (va_trace_flag & VA_TRACE_FLAG_LOG) { \ | |
46 | 46 | trace_func(__VA_ARGS__); \ |
47 | 47 | } |
48 | 48 | #define VA_TRACE_ALL(trace_func,...) \ |
49 | - if (trace_flag) { \ | |
49 | + if (va_trace_flag) { \ | |
50 | 50 | trace_func(__VA_ARGS__); \ |
51 | 51 | } |
52 | 52 |
@@ -232,7 +232,7 @@ VAStatus vaPutSurface ( | ||
232 | 232 | { |
233 | 233 | VADriverContextP ctx; |
234 | 234 | |
235 | - if (fool_postp) | |
235 | + if (va_fool_postp) | |
236 | 236 | return VA_STATUS_SUCCESS; |
237 | 237 | |
238 | 238 | CHECK_DISPLAY(dpy); |