[vlc-devel] Re: [PATCH] HW Pixel Doubling and Backlight-on for Maemo devices

Hiltunen Tapio Tapio.Hiltunen at vtt.fi
Tue May 8 08:30:26 CEST 2007


Hello,

The news that my attachment is in 'winmail.dat' -format surprises me.
The attachment is as plain a text that I can get.
On my Linux machine, the attachment saved from my previous message is
identical with the original file created with 'svn diff'. My Windows
machine says it is 'plain text'.
Anyway, here is the same patch inline if it helps:


Index: configure.ac
===================================================================
--- configure.ac        (revision 20021)
+++ configure.ac        (working copy)
@@ -5578,6 +5578,16 @@
 AC_LANG_POP(C++)
 AM_CONDITIONAL(BUILD_MOZILLA,${mozilla})
 
+dnl Tests for Osso and Xsp
+AC_CHECK_LIB(osso, osso_display_blanking_pause,[
+   VLC_ADD_CPPFLAGS([x11],[-DHAVE_OSSO ${DBUS_CFLAGS} -I/usr/include/glib-2.0 -I/usr/include/glib-2.0/glib  -I/usr/lib/glib-2.0/include])
+   VLC_ADD_LDFLAGS([x11],[-losso])
+])
+AC_CHECK_LIB(Xsp, XSPSetPixelDoubling,[
+   VLC_ADD_CPPFLAGS([x11],[-DHAVE_XSP])
+   VLC_ADD_LDFLAGS([x11],[-lXsp])
+])
+
 dnl
 dnl  Mediacontrol Python bindings
 dnl
Index: modules/video_output/x11/xcommon.c
===================================================================
--- modules/video_output/x11/xcommon.c  (revision 20021)
+++ modules/video_output/x11/xcommon.c  (working copy)
@@ -48,6 +48,10 @@
 #   include <netinet/in.h>                            /* BSD: struct in_addr */
 #endif
 
+#ifdef HAVE_XSP
+#include <X11/extensions/Xsp.h>
+#endif
+
 #ifdef HAVE_SYS_SHM_H
 #   include <sys/shm.h>                                /* shmget(), shmctl() */
 #endif
@@ -149,6 +153,17 @@
 
 static int X11ErrorHandler( Display *, XErrorEvent * );
 
+#ifdef HAVE_XSP
+static void EnablePixelDoubling( vout_thread_t *p_vout );
+static void DisablePixelDoubling( vout_thread_t *p_vout );
+#endif
+
+#ifdef HAVE_OSSO
+static const int i_backlight_on_interval = 300;
+#endif
+
+
+
 /*****************************************************************************
  * Activate: allocate X11 video thread output method
  *****************************************************************************
@@ -371,6 +386,20 @@
     p_vout->p_sys->last_date = 0;
 #endif
 
+#ifdef HAVE_XSP
+    p_vout->p_sys->i_hw_scale = 1;
+#endif
+    
+#ifdef HAVE_OSSO
+    p_vout->p_sys->i_backlight_on_counter = i_backlight_on_interval; 
+    p_vout->p_sys->p_octx = osso_initialize( "vlc", VERSION, 0, NULL );
+    if ( p_vout->p_sys->p_octx == NULL ) {
+        msg_Err( p_vout, "Could not get osso context" );
+    } else {
+        msg_Dbg( p_vout, "Initialized osso context" );
+    }
+#endif
+                   
     /* Variable to indicate if the window should be on top of others */
     /* Trigger a callback right now */
     var_Get( p_vout, "video-on-top", &val );
@@ -428,6 +457,10 @@
     }
 #endif
 
+#ifdef HAVE_XSP
+    DisablePixelDoubling(p_vout);
+#endif
+           
     DestroyCursor( p_vout );
     EnableXScreenSaver( p_vout );
     DestroyWindow( p_vout, &p_vout->p_sys->original_window );
@@ -439,6 +472,13 @@
     free_context_lock( &p_vout->p_sys->xvmc_lock );
 #endif
 
+#ifdef HAVE_OSSO
+    if ( p_vout->p_sys->p_octx != NULL ) {
+        msg_Dbg( p_vout, "Deinitializing osso context" );
+        osso_deinitialize( p_vout->p_sys->p_octx );
+    }
+#endif
+
     free( p_vout->p_sys );
 }
 
@@ -673,7 +713,42 @@
 }
 #endif
 
+#ifdef HAVE_XSP
 /*****************************************************************************
+ * EnablePixelDoubling: Enables pixel doubling
+ *****************************************************************************
+ * Checks if the double size image fits in current window, and enables pixel
+ * doubling accordingly. The i_hw_scale is the integer scaling factor.
+ *****************************************************************************/
+static void EnablePixelDoubling( vout_thread_t *p_vout )
+{
+    int i_hor_scale = ( p_vout->p_sys->p_win->i_width ) / p_vout->render.i_width;
+    int i_vert_scale =  ( p_vout->p_sys->p_win->i_height ) / p_vout->render.i_height;
+    if ( ( i_hor_scale > 1 ) && ( i_vert_scale > 1 ) ) {
+        p_vout->p_sys->i_hw_scale = 2;
+        msg_Dbg( p_vout, "Enabling pixel doubling, scaling factor %d", p_vout->p_sys->i_hw_scale );
+        XSPSetPixelDoubling( p_vout->p_sys->p_display, 0, 1 );
+    }
+}
+
+/*****************************************************************************
+ * DisablePixelDoubling: Disables pixel doubling
+ *****************************************************************************
+ * The scaling factor i_hw_scale is reset to the no-scaling value 1.
+ *****************************************************************************/
+static void DisablePixelDoubling( vout_thread_t *p_vout )
+{
+    if ( p_vout->p_sys->i_hw_scale > 1 ) {
+        msg_Dbg( p_vout, "Disabling pixel doubling" );
+        XSPSetPixelDoubling( p_vout->p_sys->p_display, 0, 0 );
+        p_vout->p_sys->i_hw_scale = 1;
+    }
+}
+#endif
+
+
+
+/*****************************************************************************
  * InitVideo: initialize X11 video thread output method
  *****************************************************************************
  * This function create the XImages needed by the output thread. It is called
@@ -743,11 +818,19 @@
             return VLC_SUCCESS;
     }
 
+#ifdef HAVE_XSP
+    vout_PlacePicture( p_vout, p_vout->p_sys->p_win->i_width  / p_vout->p_sys->i_hw_scale,
+                       p_vout->p_sys->p_win->i_height  / p_vout->p_sys->i_hw_scale,
+                       &i_index, &i_index,
+                       &p_vout->fmt_out.i_visible_width,
+                       &p_vout->fmt_out.i_visible_height );
+#else
     vout_PlacePicture( p_vout, p_vout->p_sys->p_win->i_width,
                        p_vout->p_sys->p_win->i_height,
                        &i_index, &i_index,
                        &p_vout->fmt_out.i_visible_width,
                        &p_vout->fmt_out.i_visible_height );
+#endif
 
     p_vout->fmt_out.i_chroma = p_vout->output.i_chroma;
 
@@ -1421,7 +1504,22 @@
 #ifdef MODULE_NAME_IS_xvmc
     xvmc_context_reader_unlock( &p_vout->p_sys->xvmc_lock );
 #endif
-
+    
+#ifdef HAVE_OSSO
+    if ( p_vout->p_sys->p_octx != NULL ) {
+        if ( p_vout->p_sys->i_backlight_on_counter == i_backlight_on_interval ) {
+            if ( osso_display_blanking_pause( p_vout->p_sys->p_octx ) != OSSO_OK ) {
+                msg_Err( p_vout, "Could not disable backlight blanking" );
+           } else {
+                msg_Dbg( p_vout, "Backlight blanking disabled" );
+            }
+            p_vout->p_sys->i_backlight_on_counter = 0;
+        } else {
+            p_vout->p_sys->i_backlight_on_counter ++;
+        }
+    }
+#endif
+           
     vlc_mutex_unlock( &p_vout->p_sys->lock );
     return 0;
 }
@@ -2117,11 +2215,20 @@
                            p_vout->p_sys->p_win->i_y,
                            p_vout->p_sys->p_win->i_width,
                            p_vout->p_sys->p_win->i_height );
+
+#ifdef HAVE_XSP
+        EnablePixelDoubling( p_vout );
+#endif
+
     }
     else
     {
         msg_Dbg( p_vout, "leaving fullscreen mode" );
 
+#ifdef HAVE_XSP
+        DisablePixelDoubling( p_vout );
+#endif
+
         XReparentWindow( p_vout->p_sys->p_display,
                          p_vout->p_sys->original_window.video_window,
                          p_vout->p_sys->original_window.base_window, 0, 0 );
Index: modules/video_output/x11/xcommon.h
===================================================================
--- modules/video_output/x11/xcommon.h  (revision 20021)
+++ modules/video_output/x11/xcommon.h  (working copy)
@@ -51,6 +51,9 @@
         VLC_FOURCC( i & 0xff, (i >> 8) & 0xff, (i >> 16) & 0xff, \
                     (i >> 24) & 0xff )
 
+#ifdef HAVE_OSSO
+#include <libosso.h>
+#endif
 
 /*****************************************************************************
  * x11_window_t: X11 window descriptor
@@ -206,6 +209,17 @@
 
     //alphablend_t       alphablend_extra_data;
 #endif
+
+#ifdef HAVE_XSP
+    int                 i_hw_scale;
+#endif 
+
+#ifdef HAVE_OSSO
+    osso_context_t      *p_octx;
+    int                 i_backlight_on_counter;
+#endif
+
+    
 };
 
 /*****************************************************************************



Regards,
Tapio Hiltunen,
Research Scientist
VTT Mobile Interaction
tapio.hiltunen at vtt.fi

-----Original Message-----
From: vlc-devel-bounce at videolan.org on behalf of Jean-Baptiste Kempf
Sent: Mon 5/7/2007 6:09 PM
To: vlc-devel at videolan.org
Subject: [vlc-devel] Re: [PATCH] HW Pixel Doubling and Backlight-on for Maemo devices
 
On Mon, 7 May 2007 15:18:44 +0300, "Hiltunen Tapio" <Tapio.Hiltunen at vtt.fi> wrote:
> Remi. Accompanying is a new patch that hopefully better implements
> the two functionalities.

Can you send a patch in a text form and not a winmail.dat attachment ?

Thanks.

--  
jb, VideoLAN Team
http://www.jbkempf.com

-- 
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html


-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 6305 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20070508/d6a2da25/attachment.bin>


More information about the vlc-devel mailing list