Repair software decoder with vaapi vdpau backend.

This commit is contained in:
Johns 2012-01-29 19:28:46 +01:00
parent 422c378a5e
commit 1886b745e5
3 changed files with 29 additions and 21 deletions

View File

@ -1,6 +1,7 @@
User johns User johns
Date: Date:
Repair software decoder with vaapi vdpau backend.
Add workaround for Intel VA-API MPEG GPU hung. Add workaround for Intel VA-API MPEG GPU hung.
User johns User johns

1
Todo
View File

@ -41,6 +41,7 @@ video:
skip lines not configurable from setup menu. skip lines not configurable from setup menu.
software decoder path didn't support auto-crop software decoder path didn't support auto-crop
software decoder path didn't support correct 4:3 16:9 software decoder path didn't support correct 4:3 16:9
OSD can only be shown after some stream could be shown
vdpau: vdpau:

36
video.c
View File

@ -1071,7 +1071,7 @@ struct _vaapi_decoder_
VAImage DeintImages[5]; ///< deinterlace image buffers VAImage DeintImages[5]; ///< deinterlace image buffers
// FIXME: int PutSurface; ///< flag put surface ok int PutImage; ///< flag put image can be used
VAImage Image[1]; ///< image buffer to update surface VAImage Image[1]; ///< image buffer to update surface
struct vaapi_context VaapiContext[1]; ///< ffmpeg VA-API context struct vaapi_context VaapiContext[1]; ///< ffmpeg VA-API context
@ -1482,6 +1482,8 @@ static VaapiDecoder *VaapiNewDecoder(void)
decoder->OutputWidth = VideoWindowWidth; decoder->OutputWidth = VideoWindowWidth;
decoder->OutputHeight = VideoWindowHeight; decoder->OutputHeight = VideoWindowHeight;
decoder->PutImage = !VaapiBuggyIntel;
VaapiDecoders[VaapiDecoderN++] = decoder; VaapiDecoders[VaapiDecoderN++] = decoder;
return decoder; return decoder;
@ -3341,7 +3343,6 @@ static void VaapiRenderFrame(VaapiDecoder * decoder,
AVPicture picture[1]; AVPicture picture[1];
int width; int width;
int height; int height;
int put_image;
Debug(4, "video/vaapi: hw render sw surface\n"); Debug(4, "video/vaapi: hw render sw surface\n");
@ -3387,13 +3388,11 @@ static void VaapiRenderFrame(VaapiDecoder * decoder,
surface = VaapiGetSurface(decoder); surface = VaapiGetSurface(decoder);
Debug(4, "video/vaapi: video surface %#010x displayed\n", surface); Debug(4, "video/vaapi: video surface %#010x displayed\n", surface);
put_image = !VaapiBuggyIntel; if (!decoder->PutImage
if (!put_image && vaDeriveImage(decoder->VaDisplay, surface,
&& (i = decoder->Image) != VA_STATUS_SUCCESS) {
vaDeriveImage(decoder->VaDisplay, surface, Error(_("video/vaapi: vaDeriveImage failed\n"));
decoder->Image)) != VA_STATUS_SUCCESS) { decoder->PutImage = 1;
Error(_("video/vaapi: vaDeriveImage failed %d\n"), i);
put_image = 1;
} }
// //
// Copy data from frame to image // Copy data from frame to image
@ -3426,17 +3425,25 @@ static void VaapiRenderFrame(VaapiDecoder * decoder,
= frame->data[2][i * frame->linesize[2] + x]; = frame->data[2][i * frame->linesize[2] + x];
} }
} }
} else { // vdpau uses this
} else if (decoder->Image->format.fourcc
== VA_FOURCC('I', '4', '2', '0') ) {
picture->data[0] = va_image_data + decoder->Image->offsets[0];
picture->linesize[0] = decoder->Image->pitches[0];
picture->data[1] = va_image_data + decoder->Image->offsets[1];
picture->linesize[1] = decoder->Image->pitches[2];
picture->data[2] = va_image_data + decoder->Image->offsets[2];
picture->linesize[2] = decoder->Image->pitches[1];
// FIXME: I420 vs YV12 av_picture_copy(picture, (AVPicture *) frame, video_ctx->pix_fmt,
if ( decoder->Image->num_planes == 3 ) { width, height);
} else if ( decoder->Image->num_planes == 3 ) {
picture->data[0] = va_image_data + decoder->Image->offsets[0]; picture->data[0] = va_image_data + decoder->Image->offsets[0];
picture->linesize[0] = decoder->Image->pitches[0]; picture->linesize[0] = decoder->Image->pitches[0];
picture->data[1] = va_image_data + decoder->Image->offsets[2]; picture->data[1] = va_image_data + decoder->Image->offsets[2];
picture->linesize[1] = decoder->Image->pitches[2]; picture->linesize[1] = decoder->Image->pitches[2];
picture->data[2] = va_image_data + decoder->Image->offsets[1]; picture->data[2] = va_image_data + decoder->Image->offsets[1];
picture->linesize[2] = decoder->Image->pitches[1]; picture->linesize[2] = decoder->Image->pitches[1];
}
av_picture_copy(picture, (AVPicture *) frame, video_ctx->pix_fmt, av_picture_copy(picture, (AVPicture *) frame, video_ctx->pix_fmt,
width, height); width, height);
@ -3449,8 +3456,7 @@ static void VaapiRenderFrame(VaapiDecoder * decoder,
Debug(4, "video/vaapi: buffer %dx%d <- %dx%d\n", decoder->Image->width, Debug(4, "video/vaapi: buffer %dx%d <- %dx%d\n", decoder->Image->width,
decoder->Image->height, width, height); decoder->Image->height, width, height);
// FIXME: intel didn't support put image. if (decoder->PutImage
if (put_image
&& (i = && (i =
vaPutImage(VaDisplay, surface, decoder->Image->image_id, 0, 0, vaPutImage(VaDisplay, surface, decoder->Image->image_id, 0, 0,
width, height, 0, 0, width, width, height, 0, 0, width,