diff -Nru freshplayerplugin-0.3.0+git20150622~webupd8~precise/debian/changelog freshplayerplugin-0.3.0+git20150629~webupd8~precise/debian/changelog --- freshplayerplugin-0.3.0+git20150622~webupd8~precise/debian/changelog 2015-06-22 08:23:02.000000000 +0000 +++ freshplayerplugin-0.3.0+git20150629~webupd8~precise/debian/changelog 2015-06-29 08:45:53.000000000 +0000 @@ -1,3 +1,9 @@ +freshplayerplugin (0.3.0+git20150629~webupd8~precise) precise; urgency=medium + + * new git pull + + -- Alin Andrei Mon, 29 Jun 2015 11:45:17 +0200 + freshplayerplugin (0.3.0+git20150622~webupd8~precise) precise; urgency=medium * new git pull diff -Nru freshplayerplugin-0.3.0+git20150622~webupd8~precise/src/ppb_video_decoder.c freshplayerplugin-0.3.0+git20150629~webupd8~precise/src/ppb_video_decoder.c --- freshplayerplugin-0.3.0+git20150622~webupd8~precise/src/ppb_video_decoder.c 2015-06-22 08:20:35.000000000 +0000 +++ freshplayerplugin-0.3.0+git20150629~webupd8~precise/src/ppb_video_decoder.c 2015-06-29 08:45:22.000000000 +0000 @@ -133,8 +133,8 @@ vd->va_context.config_id = 0; } - vaDestroySurfaces(display.va, vd->surfaces, MAX_VIDEO_SURFACES); - for (uintptr_t k = 0; k < MAX_VIDEO_SURFACES; k ++) { + vaDestroySurfaces(display.va, vd->surfaces, MAX_VA_SURFACES); + for (uintptr_t k = 0; k < MAX_VA_SURFACES; k ++) { vd->surfaces[k] = VA_INVALID_SURFACE; vd->surface_used[k] = 0; } @@ -151,7 +151,7 @@ vd->vdp_video_mixer = VDP_INVALID_HANDLE; } - for (uintptr_t k = 0; k < MAX_VIDEO_SURFACES; k ++) { + for (uintptr_t k = 0; k < MAX_VDP_SURFACES; k ++) { if (vd->vdp_video_surfaces[k] != VDP_INVALID_HANDLE) { display.vdp_video_surface_destroy(vd->vdp_video_surfaces[k]); vd->vdp_video_surfaces[k] = VDP_INVALID_HANDLE; @@ -238,10 +238,10 @@ #if VA_CHECK_VERSION(0, 34, 0) status = vaCreateSurfaces(display.va, VA_RT_FORMAT_YUV420, width, height, - vd->surfaces, MAX_VIDEO_SURFACES, NULL, 0); + vd->surfaces, MAX_VA_SURFACES, NULL, 0); #else status = vaCreateSurfaces(display.va, width, height, VA_RT_FORMAT_YUV420, - MAX_VIDEO_SURFACES, vd->surfaces); + MAX_VA_SURFACES, vd->surfaces); #endif if (status != VA_STATUS_SUCCESS) { trace_error("%s, can't create VA surfaces\n", __func__); @@ -249,7 +249,7 @@ } status = vaCreateContext(display.va, vd->va_context.config_id, width, height, - VA_PROGRESSIVE, vd->surfaces, MAX_VIDEO_SURFACES, + VA_PROGRESSIVE, vd->surfaces, MAX_VA_SURFACES, &vd->va_context.context_id); if (status != VA_STATUS_SUCCESS) { trace_error("%s, can't create VA context\n", __func__); @@ -277,17 +277,17 @@ vd->vdpau_context.decoder = VDP_INVALID_HANDLE; vd->vdp_video_mixer = VDP_INVALID_HANDLE; - for (uintptr_t k = 0; k < MAX_VIDEO_SURFACES; k ++) + for (uintptr_t k = 0; k < MAX_VDP_SURFACES; k ++) vd->vdp_video_surfaces[k] = VDP_INVALID_HANDLE; st = display.vdp_decoder_create(display.vdp_device, VDP_DECODER_PROFILE_H264_HIGH, width, - height, MAX_VIDEO_SURFACES, &vd->vdpau_context.decoder); + height, MAX_VDP_SURFACES, &vd->vdpau_context.decoder); if (st != VDP_STATUS_OK) { report_vdpau_error(st, "VdpDecoderCreate", __func__); goto err; } - for (uintptr_t k = 0; k < MAX_VIDEO_SURFACES; k ++) { + for (uintptr_t k = 0; k < MAX_VDP_SURFACES; k ++) { st = display.vdp_video_surface_create(display.vdp_device, VDP_CHROMA_TYPE_420, width, height, &vd->vdp_video_surfaces[k]); if (st != VDP_STATUS_OK) { @@ -369,9 +369,10 @@ case HWDEC_VAAPI: { VASurfaceID surface = GPOINTER_TO_SIZE(data); - for (int k = 0; k < MAX_VIDEO_SURFACES; k ++) { + for (int k = 0; k < MAX_VA_SURFACES; k ++) { if (surface == vd->surfaces[k]) { vd->surface_used[k] = 0; + break; } } } @@ -380,9 +381,10 @@ case HWDEC_VDPAU: { VdpVideoSurface surface = GPOINTER_TO_SIZE(data); - for (int k = 0; k < MAX_VIDEO_SURFACES; k ++) { + for (int k = 0; k < MAX_VDP_SURFACES; k ++) { if (surface == vd->vdp_video_surfaces[k]) { vd->surface_used[k] = 0; + break; } } } @@ -408,7 +410,7 @@ case HWDEC_VAAPI: { VASurfaceID surface = VA_INVALID_SURFACE; - for (int k = 0; k < MAX_VIDEO_SURFACES; k ++) { + for (int k = 0; k < MAX_VA_SURFACES; k ++) { if (!vd->surface_used[k]) { surface = vd->surfaces[k]; vd->surface_used[k] = 1; @@ -431,7 +433,7 @@ case HWDEC_VDPAU: { VdpVideoSurface surface = VDP_INVALID_HANDLE; - for (int k = 0; k < MAX_VIDEO_SURFACES; k ++) { + for (int k = 0; k < MAX_VDP_SURFACES; k ++) { if (!vd->surface_used[k]) { surface = vd->vdp_video_surfaces[k]; vd->surface_used[k] = 1; @@ -584,6 +586,11 @@ return 0; } + if (!display.glXReleaseTexImageEXT) { + trace_info_f(" no glXReleaseTexImageEXT available\n"); + return 0; + } + switch (profile) { case PP_VIDEODECODER_H264PROFILE_BASELINE: case PP_VIDEODECODER_H264PROFILE_MAIN: @@ -651,13 +658,20 @@ void request_buffers(struct pp_video_decoder_s *vd) { + int requested_buffer_count; const PP_Instance instance = vd->instance->id; const struct PP_Size dimensions = { .width = vd->avctx->width, .height = vd->avctx->height }; + switch (vd->hwdec_api) { + case HWDEC_VAAPI: requested_buffer_count = MAX_VA_SURFACES; break; + case HWDEC_VDPAU: requested_buffer_count = MAX_VDP_SURFACES; break; + default: requested_buffer_count = 5; break; // just a number, no particular reason + } + pp_resource_release(vd->self_id); - vd->ppp_video_decoder_dev->ProvidePictureBuffers(instance, vd->self_id, MAX_VIDEO_SURFACES, + vd->ppp_video_decoder_dev->ProvidePictureBuffers(instance, vd->self_id, requested_buffer_count, &dimensions, GL_TEXTURE_2D); pp_resource_acquire(vd->self_id, PP_RESOURCE_VIDEO_DECODER); } @@ -877,7 +891,8 @@ int tfp_pixmap_attrs[] = { GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT, GLX_MIPMAP_TEXTURE_EXT, GL_FALSE, - GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_FORMAT_RGB_EXT, + GLX_TEXTURE_FORMAT_EXT, g3d->depth == 32 ? GLX_TEXTURE_FORMAT_RGBA_EXT + : GLX_TEXTURE_FORMAT_RGB_EXT, GL_NONE }; vd->buffers[k].glx_pixmap = glXCreatePixmap(display.x, g3d->fb_config, @@ -890,29 +905,34 @@ } if (vd->hwdec_api == HWDEC_VDPAU) { - VdpStatus st; + VdpStatus st; + VdpPresentationQueueTarget pq_target; + VdpPresentationQueue pq; + VdpOutputSurface output_surface; - pthread_mutex_lock(&display.lock); vd->buffers[k].vdp_presentation_queue_target = VDP_INVALID_HANDLE; vd->buffers[k].vdp_presentation_queue = VDP_INVALID_HANDLE; vd->buffers[k].vdp_output_surface = VDP_INVALID_HANDLE; + pthread_mutex_lock(&display.lock); XSync(display.x, False); st = display.vdp_presentation_queue_target_create_x11( display.vdp_device, vd->buffers[k].pixmap, - &vd->buffers[k].vdp_presentation_queue_target); + &pq_target); report_vdpau_error(st, "VdpPresentationQueueTargetCreateX11", __func__); - st = display.vdp_presentation_queue_create(display.vdp_device, - vd->buffers[k].vdp_presentation_queue_target, - &vd->buffers[k].vdp_presentation_queue); + st = display.vdp_presentation_queue_create(display.vdp_device, pq_target, &pq); report_vdpau_error(st, "VdpPresentationQueueCreate", __func__); st = display.vdp_output_surface_create(display.vdp_device, VDP_RGBA_FORMAT_B8G8R8A8, vd->buffers[k].width, vd->buffers[k].height, - &vd->buffers[k].vdp_output_surface); + &output_surface); report_vdpau_error(st, "VdpOutputSurfaceCreate", __func__); pthread_mutex_unlock(&display.lock); + + vd->buffers[k].vdp_presentation_queue_target = pq_target; + vd->buffers[k].vdp_presentation_queue = pq; + vd->buffers[k].vdp_output_surface = output_surface; } } @@ -934,8 +954,23 @@ } for (uintptr_t k = 0; k < vd->buffer_count; k ++) { - if (vd->buffers[k].id == picture_buffer_id && vd->buffers[k].used) + if (vd->buffers[k].id == picture_buffer_id && vd->buffers[k].used) { vd->buffers[k].used = 0; + + struct pp_graphics3d_s *g3d = pp_resource_acquire(vd->graphics3d, + PP_RESOURCE_GRAPHICS3D); + if (g3d) { + pthread_mutex_lock(&display.lock); + glXMakeCurrent(display.x, g3d->glx_pixmap, g3d->glc); + glBindTexture(GL_TEXTURE_2D, vd->buffers[k].texture_id); + display.glXReleaseTexImageEXT(display.x, vd->buffers[k].glx_pixmap, GLX_FRONT_EXT); + glXMakeCurrent(display.x, None, NULL); + XFlush(display.x); + pthread_mutex_unlock(&display.lock); + + pp_resource_release(vd->graphics3d); + } + } } pp_resource_release(video_decoder); diff -Nru freshplayerplugin-0.3.0+git20150622~webupd8~precise/src/pp_resource.h freshplayerplugin-0.3.0+git20150629~webupd8~precise/src/pp_resource.h --- freshplayerplugin-0.3.0+git20150622~webupd8~precise/src/pp_resource.h 2015-06-22 08:20:35.000000000 +0000 +++ freshplayerplugin-0.3.0+git20150629~webupd8~precise/src/pp_resource.h 2015-06-29 08:45:22.000000000 +0000 @@ -76,7 +76,8 @@ #endif // HAVE_HWDEC -#define MAX_VIDEO_SURFACES 21 // H.264: 1 current and up to 20 references +#define MAX_VA_SURFACES 21 // H.264: 16 references and 5 additional +#define MAX_VDP_SURFACES 16 // H.264: 16 references #define free_and_nullify(item) \ @@ -508,9 +509,9 @@ } *buffers; struct vaapi_context va_context; struct AVVDPAUContext vdpau_context; - VASurfaceID surfaces[MAX_VIDEO_SURFACES]; - VdpVideoSurface vdp_video_surfaces[MAX_VIDEO_SURFACES]; - int surface_used[MAX_VIDEO_SURFACES]; + VASurfaceID surfaces[MAX_VA_SURFACES]; + VdpVideoSurface vdp_video_surfaces[MAX_VDP_SURFACES]; + int surface_used[MAX_VA_SURFACES]; // TODO: use overall maximum VdpVideoMixer vdp_video_mixer; diff -Nru freshplayerplugin-0.3.0+git20150622~webupd8~precise/src/x11_event_thread.c freshplayerplugin-0.3.0+git20150629~webupd8~precise/src/x11_event_thread.c --- freshplayerplugin-0.3.0+git20150622~webupd8~precise/src/x11_event_thread.c 2015-06-16 09:09:52.000000000 +0000 +++ freshplayerplugin-0.3.0+git20150629~webupd8~precise/src/x11_event_thread.c 2015-06-29 08:45:22.000000000 +0000 @@ -289,6 +289,12 @@ while (1) { int ret = poll(fds, sizeof(fds)/sizeof(fds[0]), -1); + if (ret == -1) { + trace_error("%s, poll() failed, errno=%d\n", __func__, errno); + sleep(1); // relax tight loop + continue; + } + if (fds[0].revents & POLLIN) { // task has come struct task_s task;