[vlc-commits] direct3d/directx: the surface allocated for the pool needs to have the decoder size
Steve Lhomme
git at videolan.org
Wed Sep 9 13:54:43 CEST 2015
vlc/vlc-2.2 | branch: master | Steve Lhomme <robux4 at gmail.com> | Tue Sep 8 16:39:43 2015 +0200| [0d2f10a01441fba8f835686581aa5284f0bac253] | committer: Jean-Baptiste Kempf
direct3d/directx: the surface allocated for the pool needs to have the decoder size
in the case of direct rendering picture_CopyPixels is used to transfer from
the decoder to the display and requires the same surface properties
the planes now have the same lines/pixels as the decoder, not just the visible ones
fixes #14531
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=0d2f10a01441fba8f835686581aa5284f0bac253
---
modules/video_output/msw/common.c | 4 ++--
modules/video_output/msw/direct3d.c | 17 +++++++++++------
modules/video_output/msw/directx.c | 4 ++--
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/modules/video_output/msw/common.c b/modules/video_output/msw/common.c
index fbf790c..0441957 100644
--- a/modules/video_output/msw/common.c
+++ b/modules/video_output/msw/common.c
@@ -213,7 +213,7 @@ int CommonUpdatePicture(picture_t *picture, picture_t **fallback,
/* fill in buffer info in first plane */
picture->p->p_pixels = data;
picture->p->i_pitch = pitch;
- picture->p->i_lines = picture->format.i_visible_height;
+ picture->p->i_lines = picture->format.i_height;
/* Fill chroma planes for planar YUV */
if (picture->format.i_chroma == VLC_CODEC_I420 ||
@@ -226,7 +226,7 @@ int CommonUpdatePicture(picture_t *picture, picture_t **fallback,
p->p_pixels = o->p_pixels + o->i_lines * o->i_pitch;
p->i_pitch = pitch / 2;
- p->i_lines = picture->format.i_visible_height / 2;
+ p->i_lines = picture->format.i_height / 2;
}
/* The dx/d3d buffer is always allocated as YV12 */
if (vlc_fourcc_AreUVPlanesSwapped(picture->format.i_chroma, VLC_CODEC_YV12)) {
diff --git a/modules/video_output/msw/direct3d.c b/modules/video_output/msw/direct3d.c
index 7fa4585..804560f 100644
--- a/modules/video_output/msw/direct3d.c
+++ b/modules/video_output/msw/direct3d.c
@@ -971,8 +971,8 @@ static int Direct3DCreatePool(vout_display_t *vd, video_format_t *fmt)
/* Create a surface */
LPDIRECT3DSURFACE9 surface;
HRESULT hr = IDirect3DDevice9_CreateOffscreenPlainSurface(d3ddev,
- fmt->i_visible_width,
- fmt->i_visible_height,
+ fmt->i_width,
+ fmt->i_height,
d3dfmt->format,
D3DPOOL_DEFAULT,
&surface,
@@ -995,7 +995,7 @@ static int Direct3DCreatePool(vout_display_t *vd, video_format_t *fmt)
picture_resource_t resource = { .p_sys = picsys };
for (int i = 0; i < PICTURE_PLANE_MAX; i++)
- resource.p[i].i_lines = fmt->i_visible_height / (i > 0 ? 2 : 1);
+ resource.p[i].i_lines = fmt->i_height / (i > 0 ? 2 : 1);
picture_t *picture = picture_NewFromResource(fmt, &resource);
if (!picture) {
@@ -1054,8 +1054,8 @@ static int Direct3DCreateScene(vout_display_t *vd, const video_format_t *fmt)
*/
LPDIRECT3DTEXTURE9 d3dtex;
hr = IDirect3DDevice9_CreateTexture(d3ddev,
- fmt->i_visible_width,
- fmt->i_visible_height,
+ fmt->i_width,
+ fmt->i_height,
1,
D3DUSAGE_RENDERTARGET,
sys->d3dpp.BackBufferFormat,
@@ -1461,7 +1461,12 @@ static int Direct3DImportPicture(vout_display_t *vd,
/* Copy picture surface into texture surface
* color space conversion happen here */
- hr = IDirect3DDevice9_StretchRect(sys->d3ddev, source, NULL, destination, NULL, D3DTEXF_LINEAR);
+ RECT cropSource;
+ cropSource.left = 0;
+ cropSource.top = 0;
+ cropSource.right = vd->fmt.i_visible_width;
+ cropSource.bottom = vd->fmt.i_visible_height;
+ hr = IDirect3DDevice9_StretchRect(sys->d3ddev, source, &cropSource, destination, NULL, D3DTEXF_LINEAR);
IDirect3DSurface9_Release(destination);
if (FAILED(hr)) {
msg_Dbg(vd, "%s:%d (hr=0x%0lX)", __FUNCTION__, __LINE__, hr);
diff --git a/modules/video_output/msw/directx.c b/modules/video_output/msw/directx.c
index afaa8f8..6ce1eab 100644
--- a/modules/video_output/msw/directx.c
+++ b/modules/video_output/msw/directx.c
@@ -851,8 +851,8 @@ static int DirectXCreateSurface(vout_display_t *vd,
ddsd.dwSize = sizeof(ddsd);
ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat);
ddsd.dwFlags = DDSD_HEIGHT | DDSD_WIDTH;
- ddsd.dwWidth = fmt->i_visible_width;
- ddsd.dwHeight = fmt->i_visible_height;
+ ddsd.dwWidth = fmt->i_width;
+ ddsd.dwHeight = fmt->i_height;
if (fourcc) {
ddsd.dwFlags |= DDSD_PIXELFORMAT;
ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC;
More information about the vlc-commits
mailing list