@ -48,7 +48,6 @@
# include "launcher-util.h"
# include "launcher-util.h"
# include "pixman-renderer.h"
# include "pixman-renderer.h"
# include "libinput-seat.h"
# include "libinput-seat.h"
# include "gl-renderer.h"
# include "presentation-time-server-protocol.h"
# include "presentation-time-server-protocol.h"
struct fbdev_backend {
struct fbdev_backend {
@ -58,7 +57,6 @@ struct fbdev_backend {
struct udev * udev ;
struct udev * udev ;
struct udev_input input ;
struct udev_input input ;
int use_pixman ;
uint32_t output_transform ;
uint32_t output_transform ;
struct wl_listener session_listener ;
struct wl_listener session_listener ;
} ;
} ;
@ -95,8 +93,6 @@ struct fbdev_output {
uint8_t depth ;
uint8_t depth ;
} ;
} ;
struct gl_renderer_interface * gl_renderer ;
static const char default_seat [ ] = " seat0 " ;
static const char default_seat [ ] = " seat0 " ;
static inline struct fbdev_output *
static inline struct fbdev_output *
@ -120,8 +116,8 @@ fbdev_output_start_repaint_loop(struct weston_output *output)
weston_output_finish_frame ( output , & ts , WP_PRESENTATION_FEEDBACK_INVALID ) ;
weston_output_finish_frame ( output , & ts , WP_PRESENTATION_FEEDBACK_INVALID ) ;
}
}
static void
static int
fbdev_output_repaint_pixman ( struct weston_output * base , pixman_region32_t * damage )
fbdev_output_repaint ( struct weston_output * base , pixman_region32_t * damage )
{
{
struct fbdev_output * output = to_fbdev_output ( base ) ;
struct fbdev_output * output = to_fbdev_output ( base ) ;
struct weston_compositor * ec = output - > base . compositor ;
struct weston_compositor * ec = output - > base . compositor ;
@ -143,26 +139,6 @@ fbdev_output_repaint_pixman(struct weston_output *base, pixman_region32_t *damag
* refresh rate is given in mHz and the interval in ms . */
* refresh rate is given in mHz and the interval in ms . */
wl_event_source_timer_update ( output - > finish_frame_timer ,
wl_event_source_timer_update ( output - > finish_frame_timer ,
1000000 / output - > mode . refresh ) ;
1000000 / output - > mode . refresh ) ;
}
static int
fbdev_output_repaint ( struct weston_output * base , pixman_region32_t * damage )
{
struct fbdev_output * output = to_fbdev_output ( base ) ;
struct fbdev_backend * fbb = output - > backend ;
struct weston_compositor * ec = fbb - > compositor ;
if ( fbb - > use_pixman ) {
fbdev_output_repaint_pixman ( base , damage ) ;
} else {
ec - > renderer - > repaint_output ( base , damage ) ;
/* Update the damage region. */
pixman_region32_subtract ( & ec - > primary_plane . damage ,
& ec - > primary_plane . damage , damage ) ;
wl_event_source_timer_update ( output - > finish_frame_timer ,
1000000 / output - > mode . refresh ) ;
}
return 0 ;
return 0 ;
}
}
@ -471,13 +447,10 @@ fbdev_output_create(struct fbdev_backend *backend,
weston_log ( " Creating frame buffer failed. \n " ) ;
weston_log ( " Creating frame buffer failed. \n " ) ;
goto out_free ;
goto out_free ;
}
}
if ( backend - > use_pixman ) {
if ( fbdev_frame_buffer_map ( output , fb_fd ) < 0 ) {
if ( fbdev_frame_buffer_map ( output , fb_fd ) < 0 ) {
weston_log ( " Mapping frame buffer failed. \n " ) ;
weston_log ( " Mapping frame buffer failed. \n " ) ;
goto out_free ;
goto out_free ;
}
} else {
close ( fb_fd ) ;
}
}
output - > base . start_repaint_loop = fbdev_output_start_repaint_loop ;
output - > base . start_repaint_loop = fbdev_output_start_repaint_loop ;
@ -505,19 +478,8 @@ fbdev_output_create(struct fbdev_backend *backend,
backend - > output_transform ,
backend - > output_transform ,
1 ) ;
1 ) ;
if ( backend - > use_pixman ) {
if ( pixman_renderer_output_create ( & output - > base ) < 0 )
if ( pixman_renderer_output_create ( & output - > base ) < 0 )
goto out_hw_surface ;
goto out_hw_surface ;
} else {
setenv ( " HYBRIS_EGLPLATFORM " , " wayland " , 1 ) ;
if ( gl_renderer - > output_create ( & output - > base ,
( EGLNativeWindowType ) NULL , NULL ,
gl_renderer - > opaque_attribs ,
NULL , 0 ) < 0 ) {
weston_log ( " gl_renderer_output_create failed. \n " ) ;
goto out_hw_surface ;
}
}
loop = wl_display_get_event_loop ( backend - > compositor - > wl_display ) ;
loop = wl_display_get_event_loop ( backend - > compositor - > wl_display ) ;
output - > finish_frame_timer =
output - > finish_frame_timer =
@ -548,19 +510,14 @@ static void
fbdev_output_destroy ( struct weston_output * base )
fbdev_output_destroy ( struct weston_output * base )
{
{
struct fbdev_output * output = to_fbdev_output ( base ) ;
struct fbdev_output * output = to_fbdev_output ( base ) ;
struct fbdev_backend * backend = output - > backend ;
weston_log ( " Destroying fbdev output. \n " ) ;
weston_log ( " Destroying fbdev output. \n " ) ;
/* Close the frame buffer. */
/* Close the frame buffer. */
fbdev_output_disable ( base ) ;
fbdev_output_disable ( base ) ;
if ( backend - > use_pixman ) {
if ( base - > renderer_state ! = NULL )
if ( base - > renderer_state ! = NULL )
pixman_renderer_output_destroy ( base ) ;
pixman_renderer_output_destroy ( base ) ;
} else {
gl_renderer - > output_destroy ( base ) ;
}
/* Remove the output. */
/* Remove the output. */
weston_output_destroy ( & output - > base ) ;
weston_output_destroy ( & output - > base ) ;
@ -629,11 +586,9 @@ fbdev_output_reenable(struct fbdev_backend *backend,
}
}
/* Map the device if it has the same details as before. */
/* Map the device if it has the same details as before. */
if ( backend - > use_pixman ) {
if ( fbdev_frame_buffer_map ( output , fb_fd ) < 0 ) {
if ( fbdev_frame_buffer_map ( output , fb_fd ) < 0 ) {
weston_log ( " Mapping frame buffer failed. \n " ) ;
weston_log ( " Mapping frame buffer failed. \n " ) ;
goto err ;
goto err ;
}
}
}
return 0 ;
return 0 ;
@ -649,12 +604,9 @@ static void
fbdev_output_disable ( struct weston_output * base )
fbdev_output_disable ( struct weston_output * base )
{
{
struct fbdev_output * output = to_fbdev_output ( base ) ;
struct fbdev_output * output = to_fbdev_output ( base ) ;
struct fbdev_backend * backend = output - > backend ;
weston_log ( " Disabling fbdev output. \n " ) ;
weston_log ( " Disabling fbdev output. \n " ) ;
if ( ! backend - > use_pixman ) return ;
if ( output - > hw_surface ! = NULL ) {
if ( output - > hw_surface ! = NULL ) {
pixman_image_unref ( output - > hw_surface ) ;
pixman_image_unref ( output - > hw_surface ) ;
output - > hw_surface = NULL ;
output - > hw_surface = NULL ;
@ -768,30 +720,12 @@ fbdev_backend_create(struct weston_compositor *compositor,
backend - > base . restore = fbdev_restore ;
backend - > base . restore = fbdev_restore ;
backend - > prev_state = WESTON_COMPOSITOR_ACTIVE ;
backend - > prev_state = WESTON_COMPOSITOR_ACTIVE ;
backend - > use_pixman = ! param - > use_gl ;
backend - > output_transform = param - > output_transform ;
backend - > output_transform = param - > output_transform ;
weston_setup_vt_switch_bindings ( compositor ) ;
weston_setup_vt_switch_bindings ( compositor ) ;
if ( backend - > use_pixman ) {
if ( pixman_renderer_init ( compositor ) < 0 )
if ( pixman_renderer_init ( compositor ) < 0 )
goto out_launcher ;
goto out_launcher ;
} else {
gl_renderer = weston_load_module ( " gl-renderer.so " ,
" gl_renderer_interface " ) ;
if ( ! gl_renderer ) {
weston_log ( " could not load gl renderer \n " ) ;
goto out_launcher ;
}
if ( gl_renderer - > create ( compositor , NO_EGL_PLATFORM ,
EGL_DEFAULT_DISPLAY ,
gl_renderer - > opaque_attribs ,
NULL , 0 ) < 0 ) {
weston_log ( " gl_renderer_create failed. \n " ) ;
goto out_launcher ;
}
}
if ( fbdev_output_create ( backend , param - > device ) < 0 )
if ( fbdev_output_create ( backend , param - > device ) < 0 )
goto out_launcher ;
goto out_launcher ;
@ -822,7 +756,6 @@ config_init_to_defaults(struct weston_fbdev_backend_config *config)
* udev , rather than passing a device node in as a parameter . */
* udev , rather than passing a device node in as a parameter . */
config - > tty = 0 ; /* default to current tty */
config - > tty = 0 ; /* default to current tty */
config - > device = " /dev/fb0 " ; /* default frame buffer */
config - > device = " /dev/fb0 " ; /* default frame buffer */
config - > use_gl = 0 ;
config - > output_transform = WL_OUTPUT_TRANSFORM_NORMAL ;
config - > output_transform = WL_OUTPUT_TRANSFORM_NORMAL ;
}
}