From: Andreas A. <ya...@in...> - 2012-01-18 19:59:10
|
# HG changeset patch # User Andreas Auras <ya...@in...> # Date 1326324517 -3600 # Node ID b49d8fe867fe549618d585c4ba89f417fd389af3 # Branch default # Parent 39e56dbc838021c146664e6c45b3f47389d11a6f Initially allocate vdpau output surface objects for display queue with actual display dimension To minimize output surface reallocation while resizing the video window these output surfaces are now allocated with the actual display dimension. diff --git a/src/video_out/video_out_vdpau.c b/src/video_out/video_out_vdpau.c --- a/src/video_out/video_out_vdpau.c +++ b/src/video_out/video_out_vdpau.c @@ -350,6 +350,8 @@ int screen; Drawable drawable; pthread_mutex_t drawable_lock; + uint32_t display_width; + uint32_t display_height; config_values_t *config; @@ -2333,6 +2335,18 @@ +static void vdpau_update_display_dimension (vdpau_driver_t *this) +{ + XLockDisplay (this->display); + + this->display_width = DisplayWidth(this->display, this->screen); + this->display_height = DisplayHeight(this->display, this->screen); + + XUnlockDisplay(this->display); +} + + + static int vdpau_reinit_error( VdpStatus st, const char *msg ) { if ( st != VDP_STATUS_OK ) { @@ -2395,10 +2409,13 @@ return; } + vdpau_update_display_dimension(this); this->current_output_surface = 0; this->init_queue = 0; int i; for ( i=0; i<this->queue_length; ++i ) { + this->output_surface_width[i] = this->display_width; + this->output_surface_height[i] = this->display_height; st = vdp_output_surface_create( vdp_device, VDP_RGBA_FORMAT_B8G8R8A8, this->output_surface_width[i], this->output_surface_height[i], &this->output_surface[i] ); if ( vdpau_reinit_error( st, "Can't create output surface !!" ) ) { int j; @@ -2832,6 +2849,8 @@ if ( vdpau_init_error( st, "Can't create video surface !!", &this->vo_driver, 1 ) ) return NULL; + vdpau_update_display_dimension(this); + this->queue_length = config->register_num (config, "video.output.vdpau_display_queue_length", 3, /* default */ _("default length of display queue"), _("The default number of video output surfaces to create for the display queue"), @@ -2840,16 +2859,13 @@ this->queue_length = 2; if (this->queue_length > NOUTPUTSURFACE) this->queue_length = NOUTPUTSURFACE; - fprintf(stderr, "vo_vdpau: using %d output surfaces for display queue\n", this->queue_length); - - for ( i=0; i<this->queue_length; ++i ) { - this->output_surface_width[i] = 320; - this->output_surface_height[i] = 240; - } + fprintf(stderr, "vo_vdpau: using %d output surfaces of size %dx%d for display queue\n", this->queue_length, this->display_width, this->display_height); + this->current_output_surface = 0; this->init_queue = 0; - for ( i=0; i<this->queue_length; ++i ) { + this->output_surface_width[i] = this->display_width; + this->output_surface_height[i] = this->display_height; st = vdp_output_surface_create( vdp_device, VDP_RGBA_FORMAT_B8G8R8A8, this->output_surface_width[i], this->output_surface_height[i], &this->output_surface[i] ); if ( vdpau_init_error( st, "Can't create output surface !!", &this->vo_driver, 1 ) ) { int j; |