00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef FFMPEG_DSPUTIL_PPC_H
00022 #define FFMPEG_DSPUTIL_PPC_H
00023
00024 #ifdef CONFIG_POWERPC_PERF
00025 void powerpc_display_perf_report(void);
00026
00027
00028
00029
00030 #define POWERPC_NUM_PMC_ENABLED 6
00031
00032
00033 enum powerpc_perf_index {
00034 altivec_fft_num = 0,
00035 altivec_gmc1_num,
00036 altivec_dct_unquantize_h263_num,
00037 altivec_fdct,
00038 altivec_idct_add_num,
00039 altivec_idct_put_num,
00040 altivec_put_pixels16_num,
00041 altivec_avg_pixels16_num,
00042 altivec_avg_pixels8_num,
00043 altivec_put_pixels8_xy2_num,
00044 altivec_put_no_rnd_pixels8_xy2_num,
00045 altivec_put_pixels16_xy2_num,
00046 altivec_put_no_rnd_pixels16_xy2_num,
00047 altivec_hadamard8_diff8x8_num,
00048 altivec_hadamard8_diff16_num,
00049 altivec_avg_pixels8_xy2_num,
00050 powerpc_clear_blocks_dcbz32,
00051 powerpc_clear_blocks_dcbz128,
00052 altivec_put_h264_chroma_mc8_num,
00053 altivec_avg_h264_chroma_mc8_num,
00054 altivec_put_h264_qpel16_h_lowpass_num,
00055 altivec_avg_h264_qpel16_h_lowpass_num,
00056 altivec_put_h264_qpel16_v_lowpass_num,
00057 altivec_avg_h264_qpel16_v_lowpass_num,
00058 altivec_put_h264_qpel16_hv_lowpass_num,
00059 altivec_avg_h264_qpel16_hv_lowpass_num,
00060 powerpc_perf_total
00061 };
00062 enum powerpc_data_index {
00063 powerpc_data_min = 0,
00064 powerpc_data_max,
00065 powerpc_data_sum,
00066 powerpc_data_num,
00067 powerpc_data_total
00068 };
00069 extern unsigned long long perfdata[POWERPC_NUM_PMC_ENABLED][powerpc_perf_total][powerpc_data_total];
00070
00071 #ifndef HAVE_PPC64
00072 #define POWERP_PMC_DATATYPE unsigned long
00073 #define POWERPC_GET_PMC1(a) asm volatile("mfspr %0, 937" : "=r" (a))
00074 #define POWERPC_GET_PMC2(a) asm volatile("mfspr %0, 938" : "=r" (a))
00075 #if (POWERPC_NUM_PMC_ENABLED > 2)
00076 #define POWERPC_GET_PMC3(a) asm volatile("mfspr %0, 941" : "=r" (a))
00077 #define POWERPC_GET_PMC4(a) asm volatile("mfspr %0, 942" : "=r" (a))
00078 #else
00079 #define POWERPC_GET_PMC3(a) do {} while (0)
00080 #define POWERPC_GET_PMC4(a) do {} while (0)
00081 #endif
00082 #if (POWERPC_NUM_PMC_ENABLED > 4)
00083 #define POWERPC_GET_PMC5(a) asm volatile("mfspr %0, 929" : "=r" (a))
00084 #define POWERPC_GET_PMC6(a) asm volatile("mfspr %0, 930" : "=r" (a))
00085 #else
00086 #define POWERPC_GET_PMC5(a) do {} while (0)
00087 #define POWERPC_GET_PMC6(a) do {} while (0)
00088 #endif
00089 #else
00090 #define POWERP_PMC_DATATYPE unsigned long long
00091 #define POWERPC_GET_PMC1(a) asm volatile("mfspr %0, 771" : "=r" (a))
00092 #define POWERPC_GET_PMC2(a) asm volatile("mfspr %0, 772" : "=r" (a))
00093 #if (POWERPC_NUM_PMC_ENABLED > 2)
00094 #define POWERPC_GET_PMC3(a) asm volatile("mfspr %0, 773" : "=r" (a))
00095 #define POWERPC_GET_PMC4(a) asm volatile("mfspr %0, 774" : "=r" (a))
00096 #else
00097 #define POWERPC_GET_PMC3(a) do {} while (0)
00098 #define POWERPC_GET_PMC4(a) do {} while (0)
00099 #endif
00100 #if (POWERPC_NUM_PMC_ENABLED > 4)
00101 #define POWERPC_GET_PMC5(a) asm volatile("mfspr %0, 775" : "=r" (a))
00102 #define POWERPC_GET_PMC6(a) asm volatile("mfspr %0, 776" : "=r" (a))
00103 #else
00104 #define POWERPC_GET_PMC5(a) do {} while (0)
00105 #define POWERPC_GET_PMC6(a) do {} while (0)
00106 #endif
00107 #endif
00108 #define POWERPC_PERF_DECLARE(a, cond) \
00109 POWERP_PMC_DATATYPE \
00110 pmc_start[POWERPC_NUM_PMC_ENABLED], \
00111 pmc_stop[POWERPC_NUM_PMC_ENABLED], \
00112 pmc_loop_index;
00113 #define POWERPC_PERF_START_COUNT(a, cond) do { \
00114 POWERPC_GET_PMC6(pmc_start[5]); \
00115 POWERPC_GET_PMC5(pmc_start[4]); \
00116 POWERPC_GET_PMC4(pmc_start[3]); \
00117 POWERPC_GET_PMC3(pmc_start[2]); \
00118 POWERPC_GET_PMC2(pmc_start[1]); \
00119 POWERPC_GET_PMC1(pmc_start[0]); \
00120 } while (0)
00121 #define POWERPC_PERF_STOP_COUNT(a, cond) do { \
00122 POWERPC_GET_PMC1(pmc_stop[0]); \
00123 POWERPC_GET_PMC2(pmc_stop[1]); \
00124 POWERPC_GET_PMC3(pmc_stop[2]); \
00125 POWERPC_GET_PMC4(pmc_stop[3]); \
00126 POWERPC_GET_PMC5(pmc_stop[4]); \
00127 POWERPC_GET_PMC6(pmc_stop[5]); \
00128 if (cond) \
00129 { \
00130 for(pmc_loop_index = 0; \
00131 pmc_loop_index < POWERPC_NUM_PMC_ENABLED; \
00132 pmc_loop_index++) \
00133 { \
00134 if (pmc_stop[pmc_loop_index] >= pmc_start[pmc_loop_index]) \
00135 { \
00136 POWERP_PMC_DATATYPE diff = \
00137 pmc_stop[pmc_loop_index] - pmc_start[pmc_loop_index]; \
00138 if (diff < perfdata[pmc_loop_index][a][powerpc_data_min]) \
00139 perfdata[pmc_loop_index][a][powerpc_data_min] = diff; \
00140 if (diff > perfdata[pmc_loop_index][a][powerpc_data_max]) \
00141 perfdata[pmc_loop_index][a][powerpc_data_max] = diff; \
00142 perfdata[pmc_loop_index][a][powerpc_data_sum] += diff; \
00143 perfdata[pmc_loop_index][a][powerpc_data_num] ++; \
00144 } \
00145 } \
00146 } \
00147 } while (0)
00148 #else
00149
00150 #define POWERPC_PERF_DECLARE(a, cond) int altivec_placeholder __attribute__ ((unused))
00151 #define POWERPC_PERF_START_COUNT(a, cond) do {} while (0)
00152 #define POWERPC_PERF_STOP_COUNT(a, cond) do {} while (0)
00153 #endif
00154
00155 #endif