Changeset e3b4a2c7fad771e31d33650ca887ee907fb9e780

Show
Ignore:
Timestamp:
09/05/07 20:48:21 (2 years ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1178736501 +0000
git-parent:

[b4c9724a3f5a74a734afb717aab8040407603b2e]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1178736501 +0000
Message:

HW Pixel Doubling and Backlight-on for Maemo devices
Patch courtesy of Tapio Hiltunen, Technical Research Center of Finland

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • THANKS

    r39df335 re3b4a2c  
    172172Steven Sheehy - wxWidgets interface fix 
    173173Tadashi Jokagi <elf2000 at users.sourceforge dot net> - Japanese translation 
     174Tapio Hiltunen <Tapio dot Hiltunen at vtt dot fi> - Maemo X11 enhancements 
    174175Tim 'O Callaghan <tim.ocallaghan at limestudios dot com> - pvr input cleaning patch 
    175176Tim Schuerewegen <ma054331 at skynet dot be> - contrib fixes 
  • configure.ac

    r263c385 re3b4a2c  
    55795579AM_CONDITIONAL(BUILD_MOZILLA,${mozilla}) 
    55805580 
     5581dnl Tests for Osso and Xsp 
     5582AC_CHECK_LIB(osso, osso_display_blanking_pause,[ 
     5583   PKG_CHECK_MODULES(GLIB2, glib-2.0, [                        
     5584       VLC_ADD_CPPFLAGS([x11],[-DHAVE_OSSO ${DBUS_CFLAGS} ${GLIB2_CFLAGS}]) 
     5585       VLC_ADD_LDFLAGS([x11],[-losso]) 
     5586   ]) 
     5587]) 
     5588AC_CHECK_LIB(Xsp, XSPSetPixelDoubling,[ 
     5589   VLC_ADD_CPPFLAGS([x11],[-DHAVE_XSP]) 
     5590   VLC_ADD_LDFLAGS([x11],[-lXsp]) 
     5591]) 
     5592 
    55815593dnl 
    55825594dnl  Mediacontrol Python bindings 
  • modules/video_output/x11/xcommon.c

    r2d3e647 re3b4a2c  
    4949#endif 
    5050 
     51#ifdef HAVE_XSP 
     52#include <X11/extensions/Xsp.h> 
     53#endif 
     54 
    5155#ifdef HAVE_SYS_SHM_H 
    5256#   include <sys/shm.h>                                /* shmget(), shmctl() */ 
     
    149153 
    150154static int X11ErrorHandler( Display *, XErrorEvent * ); 
     155 
     156#ifdef HAVE_XSP 
     157static void EnablePixelDoubling( vout_thread_t *p_vout ); 
     158static void DisablePixelDoubling( vout_thread_t *p_vout ); 
     159#endif 
     160 
     161#ifdef HAVE_OSSO 
     162static const int i_backlight_on_interval = 300; 
     163#endif 
     164 
     165 
    151166 
    152167/***************************************************************************** 
     
    372387#endif 
    373388 
     389#ifdef HAVE_XSP 
     390    p_vout->p_sys->i_hw_scale = 1; 
     391#endif 
     392     
     393#ifdef HAVE_OSSO 
     394    p_vout->p_sys->i_backlight_on_counter = i_backlight_on_interval;  
     395    p_vout->p_sys->p_octx = osso_initialize( "vlc", VERSION, 0, NULL ); 
     396    if ( p_vout->p_sys->p_octx == NULL ) { 
     397        msg_Err( p_vout, "Could not get osso context" ); 
     398    } else { 
     399        msg_Dbg( p_vout, "Initialized osso context" ); 
     400    } 
     401#endif 
     402             
    374403    /* Variable to indicate if the window should be on top of others */ 
    375404    /* Trigger a callback right now */ 
     
    429458#endif 
    430459 
     460#ifdef HAVE_XSP 
     461    DisablePixelDoubling(p_vout); 
     462#endif 
     463         
    431464    DestroyCursor( p_vout ); 
    432465    EnableXScreenSaver( p_vout ); 
     
    440473#endif 
    441474 
     475#ifdef HAVE_OSSO 
     476    if ( p_vout->p_sys->p_octx != NULL ) { 
     477        msg_Dbg( p_vout, "Deinitializing osso context" ); 
     478        osso_deinitialize( p_vout->p_sys->p_octx ); 
     479    } 
     480#endif 
     481     
    442482    free( p_vout->p_sys ); 
    443483} 
     
    674714#endif 
    675715 
     716#ifdef HAVE_XSP 
     717/***************************************************************************** 
     718 * EnablePixelDoubling: Enables pixel doubling 
     719 ***************************************************************************** 
     720 * Checks if the double size image fits in current window, and enables pixel 
     721 * doubling accordingly. The i_hw_scale is the integer scaling factor. 
     722 *****************************************************************************/ 
     723static void EnablePixelDoubling( vout_thread_t *p_vout ) 
     724{ 
     725    int i_hor_scale = ( p_vout->p_sys->p_win->i_width ) / p_vout->render.i_width; 
     726    int i_vert_scale =  ( p_vout->p_sys->p_win->i_height ) / p_vout->render.i_height; 
     727    if ( ( i_hor_scale > 1 ) && ( i_vert_scale > 1 ) ) { 
     728        p_vout->p_sys->i_hw_scale = 2; 
     729        msg_Dbg( p_vout, "Enabling pixel doubling, scaling factor %d", p_vout->p_sys->i_hw_scale ); 
     730        XSPSetPixelDoubling( p_vout->p_sys->p_display, 0, 1 ); 
     731    } 
     732} 
     733 
     734/***************************************************************************** 
     735 * DisablePixelDoubling: Disables pixel doubling 
     736 ***************************************************************************** 
     737 * The scaling factor i_hw_scale is reset to the no-scaling value 1. 
     738 *****************************************************************************/ 
     739static void DisablePixelDoubling( vout_thread_t *p_vout ) 
     740{ 
     741    if ( p_vout->p_sys->i_hw_scale > 1 ) { 
     742        msg_Dbg( p_vout, "Disabling pixel doubling" ); 
     743        XSPSetPixelDoubling( p_vout->p_sys->p_display, 0, 0 ); 
     744        p_vout->p_sys->i_hw_scale = 1; 
     745    } 
     746} 
     747#endif 
     748 
     749 
     750 
    676751/***************************************************************************** 
    677752 * InitVideo: initialize X11 video thread output method 
     
    744819    } 
    745820 
     821#ifdef HAVE_XSP 
     822    vout_PlacePicture( p_vout, p_vout->p_sys->p_win->i_width  / p_vout->p_sys->i_hw_scale, 
     823                       p_vout->p_sys->p_win->i_height  / p_vout->p_sys->i_hw_scale, 
     824                       &i_index, &i_index, 
     825                       &p_vout->fmt_out.i_visible_width, 
     826                       &p_vout->fmt_out.i_visible_height ); 
     827#else 
    746828    vout_PlacePicture( p_vout, p_vout->p_sys->p_win->i_width, 
    747829                       p_vout->p_sys->p_win->i_height, 
     
    749831                       &p_vout->fmt_out.i_visible_width, 
    750832                       &p_vout->fmt_out.i_visible_height ); 
     833#endif 
    751834 
    752835    p_vout->fmt_out.i_chroma = p_vout->output.i_chroma; 
     
    14221505    xvmc_context_reader_unlock( &p_vout->p_sys->xvmc_lock ); 
    14231506#endif 
    1424  
     1507     
     1508#ifdef HAVE_OSSO 
     1509    if ( p_vout->p_sys->p_octx != NULL ) { 
     1510        if ( p_vout->p_sys->i_backlight_on_counter == i_backlight_on_interval ) { 
     1511            if ( osso_display_blanking_pause( p_vout->p_sys->p_octx ) != OSSO_OK ) { 
     1512                msg_Err( p_vout, "Could not disable backlight blanking" ); 
     1513        } else { 
     1514                msg_Dbg( p_vout, "Backlight blanking disabled" ); 
     1515            } 
     1516            p_vout->p_sys->i_backlight_on_counter = 0; 
     1517        } else { 
     1518            p_vout->p_sys->i_backlight_on_counter ++; 
     1519        } 
     1520    } 
     1521#endif 
     1522         
    14251523    vlc_mutex_unlock( &p_vout->p_sys->lock ); 
    14261524    return 0; 
     
    21182216                           p_vout->p_sys->p_win->i_width, 
    21192217                           p_vout->p_sys->p_win->i_height ); 
     2218 
     2219#ifdef HAVE_XSP 
     2220        EnablePixelDoubling( p_vout ); 
     2221#endif 
     2222         
    21202223    } 
    21212224    else 
    21222225    { 
    21232226        msg_Dbg( p_vout, "leaving fullscreen mode" ); 
     2227 
     2228#ifdef HAVE_XSP 
     2229        DisablePixelDoubling( p_vout ); 
     2230#endif 
    21242231 
    21252232        XReparentWindow( p_vout->p_sys->p_display, 
  • modules/video_output/x11/xcommon.h

    r4b4bd31 re3b4a2c  
    5252                    (i >> 24) & 0xff ) 
    5353 
     54#ifdef HAVE_OSSO 
     55#include <libosso.h> 
     56#endif 
    5457 
    5558/***************************************************************************** 
     
    207210    //alphablend_t       alphablend_extra_data; 
    208211#endif 
     212 
     213#ifdef HAVE_XSP 
     214    int                 i_hw_scale; 
     215#endif  
     216 
     217#ifdef HAVE_OSSO 
     218    osso_context_t      *p_octx; 
     219    int                 i_backlight_on_counter; 
     220#endif 
     221 
     222     
    209223}; 
    210224