Mercurial > mplayer.hg
comparison libvo/vo_gl.c @ 34819:eba74596e6ee
vo_gl: collect some frame statistics for DR.
author | reimar |
---|---|
date | Wed, 16 May 2012 14:27:54 +0000 |
parents | ec6877bfc79f |
children | 5e29e950d918 |
comparison
equal
deleted
inserted
replaced
34818:ec6877bfc79f | 34819:eba74596e6ee |
---|---|
164 static int vo_flipped; | 164 static int vo_flipped; |
165 static int ass_border_x, ass_border_y; | 165 static int ass_border_x, ass_border_y; |
166 | 166 |
167 static unsigned int slice_height = 1; | 167 static unsigned int slice_height = 1; |
168 | 168 |
169 // performance statistics | |
170 static int imgcnt, dr_imgcnt, dr_rejectcnt; | |
171 | |
169 static void redraw(void); | 172 static void redraw(void); |
170 | 173 |
171 static void resize(int x,int y){ | 174 static void resize(int x,int y){ |
172 // simple orthogonal projection for 0-image_width;0-image_height | 175 // simple orthogonal projection for 0-image_width;0-image_height |
173 float matrix[16] = { | 176 float matrix[16] = { |
442 /** | 445 /** |
443 * \brief uninitialize OpenGL context, freeing textures, buffers etc. | 446 * \brief uninitialize OpenGL context, freeing textures, buffers etc. |
444 */ | 447 */ |
445 static void uninitGl(void) { | 448 static void uninitGl(void) { |
446 int i = 0; | 449 int i = 0; |
450 mp_msg(MSGT_VO, MSGL_V, "Drawn %i frames, %i using DR, DR refused %i\n", | |
451 imgcnt, dr_imgcnt, dr_rejectcnt); | |
447 if (mpglDeletePrograms && fragprog) | 452 if (mpglDeletePrograms && fragprog) |
448 mpglDeletePrograms(1, &fragprog); | 453 mpglDeletePrograms(1, &fragprog); |
449 fragprog = 0; | 454 fragprog = 0; |
450 while (default_texs[i] != 0) | 455 while (default_texs[i] != 0) |
451 i++; | 456 i++; |
906 return 0; | 911 return 0; |
907 } | 912 } |
908 | 913 |
909 static uint32_t get_image(mp_image_t *mpi) { | 914 static uint32_t get_image(mp_image_t *mpi) { |
910 int needed_size; | 915 int needed_size; |
916 dr_rejectcnt++; | |
911 if (!mpglGenBuffers || !mpglBindBuffer || !mpglBufferData || !mpglMapBuffer) { | 917 if (!mpglGenBuffers || !mpglBindBuffer || !mpglBufferData || !mpglMapBuffer) { |
912 if (!err_shown) | 918 if (!err_shown) |
913 mp_msg(MSGT_VO, MSGL_ERR, "[gl] extensions missing for dr\n" | 919 mp_msg(MSGT_VO, MSGL_ERR, "[gl] extensions missing for dr\n" |
914 "Expect a _major_ speed penalty\n"); | 920 "Expect a _major_ speed penalty\n"); |
915 err_shown = 1; | 921 err_shown = 1; |
992 mpi->planes[1] = gl_bufferptr_uv[0]; | 998 mpi->planes[1] = gl_bufferptr_uv[0]; |
993 mpi->planes[2] = gl_bufferptr_uv[1]; | 999 mpi->planes[2] = gl_bufferptr_uv[1]; |
994 } | 1000 } |
995 } | 1001 } |
996 mpi->flags |= MP_IMGFLAG_DIRECT; | 1002 mpi->flags |= MP_IMGFLAG_DIRECT; |
1003 dr_rejectcnt--; | |
997 return VO_TRUE; | 1004 return VO_TRUE; |
998 } | 1005 } |
999 | 1006 |
1000 static void clear_border(uint8_t *dst, int start, int stride, int height, int full_height, int value) { | 1007 static void clear_border(uint8_t *dst, int start, int stride, int height, int full_height, int value) { |
1001 int right_border = stride - start; | 1008 int right_border = stride - start; |
1013 int slice = slice_height; | 1020 int slice = slice_height; |
1014 int stride[3]; | 1021 int stride[3]; |
1015 unsigned char *planes[3]; | 1022 unsigned char *planes[3]; |
1016 mp_image_t mpi2 = *mpi; | 1023 mp_image_t mpi2 = *mpi; |
1017 int w = mpi->w, h = mpi->h; | 1024 int w = mpi->w, h = mpi->h; |
1025 imgcnt++; | |
1018 if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK) | 1026 if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK) |
1019 goto skip_upload; | 1027 goto skip_upload; |
1028 dr_imgcnt += !!(mpi->flags & MP_IMGFLAG_DIRECT); | |
1020 mpi2.flags = 0; mpi2.type = MP_IMGTYPE_TEMP; | 1029 mpi2.flags = 0; mpi2.type = MP_IMGTYPE_TEMP; |
1021 mpi2.width = mpi2.w; mpi2.height = mpi2.h; | 1030 mpi2.width = mpi2.w; mpi2.height = mpi2.h; |
1022 if (force_pbo && !(mpi->flags & MP_IMGFLAG_DIRECT) && !gl_bufferptr && get_image(&mpi2) == VO_TRUE) { | 1031 if (force_pbo && !(mpi->flags & MP_IMGFLAG_DIRECT) && !gl_bufferptr && get_image(&mpi2) == VO_TRUE) { |
1023 int bpp; | 1032 int bpp; |
1024 int line_bytes, line_bytes_c; | 1033 int line_bytes, line_bytes_c; |
1323 if (many_fmts) | 1332 if (many_fmts) |
1324 mp_msg(MSGT_VO, MSGL_INFO, "[gl] using extended formats. " | 1333 mp_msg(MSGT_VO, MSGL_INFO, "[gl] using extended formats. " |
1325 "Use -vo gl:nomanyfmts if playback fails.\n"); | 1334 "Use -vo gl:nomanyfmts if playback fails.\n"); |
1326 mp_msg(MSGT_VO, MSGL_V, "[gl] Using %d as slice height " | 1335 mp_msg(MSGT_VO, MSGL_V, "[gl] Using %d as slice height " |
1327 "(0 means image height).\n", slice_height); | 1336 "(0 means image height).\n", slice_height); |
1337 imgcnt = dr_imgcnt = dr_rejectcnt = 0; | |
1328 | 1338 |
1329 return 0; | 1339 return 0; |
1330 | 1340 |
1331 err_out: | 1341 err_out: |
1332 uninit(); | 1342 uninit(); |