changeset 34819:eba74596e6ee

vo_gl: collect some frame statistics for DR.
author reimar
date Wed, 16 May 2012 14:27:54 +0000
parents ec6877bfc79f
children 21e672205f9f
files libvo/vo_gl.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_gl.c	Tue May 15 21:53:41 2012 +0000
+++ b/libvo/vo_gl.c	Wed May 16 14:27:54 2012 +0000
@@ -166,6 +166,9 @@
 
 static unsigned int slice_height = 1;
 
+// performance statistics
+static int imgcnt, dr_imgcnt, dr_rejectcnt;
+
 static void redraw(void);
 
 static void resize(int x,int y){
@@ -444,6 +447,8 @@
  */
 static void uninitGl(void) {
   int i = 0;
+  mp_msg(MSGT_VO, MSGL_V, "Drawn %i frames, %i using DR, DR refused %i\n",
+         imgcnt, dr_imgcnt, dr_rejectcnt);
   if (mpglDeletePrograms && fragprog)
     mpglDeletePrograms(1, &fragprog);
   fragprog = 0;
@@ -908,6 +913,7 @@
 
 static uint32_t get_image(mp_image_t *mpi) {
   int needed_size;
+  dr_rejectcnt++;
   if (!mpglGenBuffers || !mpglBindBuffer || !mpglBufferData || !mpglMapBuffer) {
     if (!err_shown)
       mp_msg(MSGT_VO, MSGL_ERR, "[gl] extensions missing for dr\n"
@@ -994,6 +1000,7 @@
     }
   }
   mpi->flags |= MP_IMGFLAG_DIRECT;
+  dr_rejectcnt--;
   return VO_TRUE;
 }
 
@@ -1015,8 +1022,10 @@
   unsigned char *planes[3];
   mp_image_t mpi2 = *mpi;
   int w = mpi->w, h = mpi->h;
+  imgcnt++;
   if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
     goto skip_upload;
+  dr_imgcnt += !!(mpi->flags & MP_IMGFLAG_DIRECT);
   mpi2.flags = 0; mpi2.type = MP_IMGTYPE_TEMP;
   mpi2.width = mpi2.w; mpi2.height = mpi2.h;
   if (force_pbo && !(mpi->flags & MP_IMGFLAG_DIRECT) && !gl_bufferptr && get_image(&mpi2) == VO_TRUE) {
@@ -1325,6 +1334,7 @@
                "Use -vo gl:nomanyfmts if playback fails.\n");
     mp_msg(MSGT_VO, MSGL_V, "[gl] Using %d as slice height "
              "(0 means image height).\n", slice_height);
+    imgcnt = dr_imgcnt = dr_rejectcnt = 0;
 
     return 0;