comparison ppc/dsputil_ppc.c @ 11969:3cd4cd0509cd libavcodec

Remove PPC perf counter support This functionality is better accessed through tools like oprofile.
author mru
date Sat, 26 Jun 2010 22:23:35 +0000
parents 50415a8f1451
children 3fc4c625b6f3
comparison
equal deleted inserted replaced
11968:58c2da0a371b 11969:3cd4cd0509cd
19 * License along with FFmpeg; if not, write to the Free Software 19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */ 21 */
22 22
23 #include "libavcodec/dsputil.h" 23 #include "libavcodec/dsputil.h"
24
25 #include "dsputil_ppc.h"
26
27 #include "dsputil_altivec.h" 24 #include "dsputil_altivec.h"
28 25
29 int mm_flags = 0; 26 int mm_flags = 0;
30 27
31 int mm_support(void) 28 int mm_support(void)
36 result |= FF_MM_ALTIVEC; 33 result |= FF_MM_ALTIVEC;
37 } 34 }
38 #endif /* result */ 35 #endif /* result */
39 return result; 36 return result;
40 } 37 }
41
42 #if CONFIG_POWERPC_PERF
43 unsigned long long perfdata[POWERPC_NUM_PMC_ENABLED][powerpc_perf_total][powerpc_data_total];
44 /* list below must match enum in dsputil_ppc.h */
45 static unsigned char* perfname[] = {
46 "ff_fft_calc_altivec",
47 "gmc1_altivec",
48 "dct_unquantize_h263_altivec",
49 "fdct_altivec",
50 "idct_add_altivec",
51 "idct_put_altivec",
52 "put_pixels16_altivec",
53 "avg_pixels16_altivec",
54 "avg_pixels8_altivec",
55 "put_pixels8_xy2_altivec",
56 "put_no_rnd_pixels8_xy2_altivec",
57 "put_pixels16_xy2_altivec",
58 "put_no_rnd_pixels16_xy2_altivec",
59 "hadamard8_diff8x8_altivec",
60 "hadamard8_diff16_altivec",
61 "avg_pixels8_xy2_altivec",
62 "clear_blocks_dcbz32_ppc",
63 "clear_blocks_dcbz128_ppc",
64 "put_h264_chroma_mc8_altivec",
65 "avg_h264_chroma_mc8_altivec",
66 "put_h264_qpel16_h_lowpass_altivec",
67 "avg_h264_qpel16_h_lowpass_altivec",
68 "put_h264_qpel16_v_lowpass_altivec",
69 "avg_h264_qpel16_v_lowpass_altivec",
70 "put_h264_qpel16_hv_lowpass_altivec",
71 "avg_h264_qpel16_hv_lowpass_altivec",
72 ""
73 };
74 #include <stdio.h>
75 #endif
76
77 #if CONFIG_POWERPC_PERF
78 void powerpc_display_perf_report(void)
79 {
80 int i, j;
81 av_log(NULL, AV_LOG_INFO, "PowerPC performance report\n Values are from the PMC registers, and represent whatever the registers are set to record.\n");
82 for(i = 0 ; i < powerpc_perf_total ; i++) {
83 for (j = 0; j < POWERPC_NUM_PMC_ENABLED ; j++) {
84 if (perfdata[j][i][powerpc_data_num] != (unsigned long long)0)
85 av_log(NULL, AV_LOG_INFO,
86 " Function \"%s\" (pmc%d):\n\tmin: %"PRIu64"\n\tmax: %"PRIu64"\n\tavg: %1.2lf (%"PRIu64")\n",
87 perfname[i],
88 j+1,
89 perfdata[j][i][powerpc_data_min],
90 perfdata[j][i][powerpc_data_max],
91 (double)perfdata[j][i][powerpc_data_sum] /
92 (double)perfdata[j][i][powerpc_data_num],
93 perfdata[j][i][powerpc_data_num]);
94 }
95 }
96 }
97 #endif /* CONFIG_POWERPC_PERF */
98 38
99 /* ***** WARNING ***** WARNING ***** WARNING ***** */ 39 /* ***** WARNING ***** WARNING ***** WARNING ***** */
100 /* 40 /*
101 clear_blocks_dcbz32_ppc will not work properly on PowerPC processors with a 41 clear_blocks_dcbz32_ppc will not work properly on PowerPC processors with a
102 cache line size not equal to 32 bytes. 42 cache line size not equal to 32 bytes.
116 see <http://developer.apple.com/technotes/tn/tn2087.html> 56 see <http://developer.apple.com/technotes/tn/tn2087.html>
117 and <http://developer.apple.com/technotes/tn/tn2086.html> 57 and <http://developer.apple.com/technotes/tn/tn2086.html>
118 */ 58 */
119 static void clear_blocks_dcbz32_ppc(DCTELEM *blocks) 59 static void clear_blocks_dcbz32_ppc(DCTELEM *blocks)
120 { 60 {
121 POWERPC_PERF_DECLARE(powerpc_clear_blocks_dcbz32, 1);
122 register int misal = ((unsigned long)blocks & 0x00000010); 61 register int misal = ((unsigned long)blocks & 0x00000010);
123 register int i = 0; 62 register int i = 0;
124 POWERPC_PERF_START_COUNT(powerpc_clear_blocks_dcbz32, 1);
125 #if 1 63 #if 1
126 if (misal) { 64 if (misal) {
127 ((unsigned long*)blocks)[0] = 0L; 65 ((unsigned long*)blocks)[0] = 0L;
128 ((unsigned long*)blocks)[1] = 0L; 66 ((unsigned long*)blocks)[1] = 0L;
129 ((unsigned long*)blocks)[2] = 0L; 67 ((unsigned long*)blocks)[2] = 0L;
141 i += 16; 79 i += 16;
142 } 80 }
143 #else 81 #else
144 memset(blocks, 0, sizeof(DCTELEM)*6*64); 82 memset(blocks, 0, sizeof(DCTELEM)*6*64);
145 #endif 83 #endif
146 POWERPC_PERF_STOP_COUNT(powerpc_clear_blocks_dcbz32, 1);
147 } 84 }
148 85
149 /* same as above, when dcbzl clear a whole 128B cache line 86 /* same as above, when dcbzl clear a whole 128B cache line
150 i.e. the PPC970 aka G5 */ 87 i.e. the PPC970 aka G5 */
151 #if HAVE_DCBZL 88 #if HAVE_DCBZL
152 static void clear_blocks_dcbz128_ppc(DCTELEM *blocks) 89 static void clear_blocks_dcbz128_ppc(DCTELEM *blocks)
153 { 90 {
154 POWERPC_PERF_DECLARE(powerpc_clear_blocks_dcbz128, 1);
155 register int misal = ((unsigned long)blocks & 0x0000007f); 91 register int misal = ((unsigned long)blocks & 0x0000007f);
156 register int i = 0; 92 register int i = 0;
157 POWERPC_PERF_START_COUNT(powerpc_clear_blocks_dcbz128, 1);
158 #if 1 93 #if 1
159 if (misal) { 94 if (misal) {
160 // we could probably also optimize this case, 95 // we could probably also optimize this case,
161 // but there's not much point as the machines 96 // but there's not much point as the machines
162 // aren't available yet (2003-06-26) 97 // aren't available yet (2003-06-26)
167 __asm__ volatile("dcbzl %0,%1" : : "b" (blocks), "r" (i) : "memory"); 102 __asm__ volatile("dcbzl %0,%1" : : "b" (blocks), "r" (i) : "memory");
168 } 103 }
169 #else 104 #else
170 memset(blocks, 0, sizeof(DCTELEM)*6*64); 105 memset(blocks, 0, sizeof(DCTELEM)*6*64);
171 #endif 106 #endif
172 POWERPC_PERF_STOP_COUNT(powerpc_clear_blocks_dcbz128, 1);
173 } 107 }
174 #else 108 #else
175 static void clear_blocks_dcbz128_ppc(DCTELEM *blocks) 109 static void clear_blocks_dcbz128_ppc(DCTELEM *blocks)
176 { 110 {
177 memset(blocks, 0, sizeof(DCTELEM)*6*64); 111 memset(blocks, 0, sizeof(DCTELEM)*6*64);
277 c->idct = ff_vp3_idct_altivec; 211 c->idct = ff_vp3_idct_altivec;
278 c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM; 212 c->idct_permutation_type = FF_TRANSPOSE_IDCT_PERM;
279 } 213 }
280 } 214 }
281 215
282 #if CONFIG_POWERPC_PERF
283 {
284 int i, j;
285 for (i = 0 ; i < powerpc_perf_total ; i++) {
286 for (j = 0; j < POWERPC_NUM_PMC_ENABLED ; j++) {
287 perfdata[j][i][powerpc_data_min] = 0xFFFFFFFFFFFFFFFFULL;
288 perfdata[j][i][powerpc_data_max] = 0x0000000000000000ULL;
289 perfdata[j][i][powerpc_data_sum] = 0x0000000000000000ULL;
290 perfdata[j][i][powerpc_data_num] = 0x0000000000000000ULL;
291 }
292 }
293 }
294 #endif /* CONFIG_POWERPC_PERF */
295 } 216 }
296 #endif /* HAVE_ALTIVEC */ 217 #endif /* HAVE_ALTIVEC */
297 } 218 }