Commit 2c4f2e23 authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

D3D: 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: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 6e0f74e7
...@@ -452,7 +452,7 @@ int CommonUpdatePicture(picture_t *picture, picture_t **fallback, ...@@ -452,7 +452,7 @@ int CommonUpdatePicture(picture_t *picture, picture_t **fallback,
/* fill in buffer info in first plane */ /* fill in buffer info in first plane */
picture->p->p_pixels = data; picture->p->p_pixels = data;
picture->p->i_pitch = pitch; 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 biplanar YUV */ /* Fill chroma planes for biplanar YUV */
if (picture->format.i_chroma == VLC_CODEC_NV12 || if (picture->format.i_chroma == VLC_CODEC_NV12 ||
...@@ -464,7 +464,7 @@ int CommonUpdatePicture(picture_t *picture, picture_t **fallback, ...@@ -464,7 +464,7 @@ int CommonUpdatePicture(picture_t *picture, picture_t **fallback,
p->p_pixels = o->p_pixels + o->i_lines * o->i_pitch; p->p_pixels = o->p_pixels + o->i_lines * o->i_pitch;
p->i_pitch = pitch; p->i_pitch = pitch;
p->i_lines = picture->format.i_visible_height; p->i_lines = picture->format.i_height;
} }
/* The dx/d3d buffer is always allocated as NV12 */ /* The dx/d3d buffer is always allocated as NV12 */
if (vlc_fourcc_AreUVPlanesSwapped(picture->format.i_chroma, VLC_CODEC_NV12)) { if (vlc_fourcc_AreUVPlanesSwapped(picture->format.i_chroma, VLC_CODEC_NV12)) {
...@@ -484,7 +484,7 @@ int CommonUpdatePicture(picture_t *picture, picture_t **fallback, ...@@ -484,7 +484,7 @@ int CommonUpdatePicture(picture_t *picture, picture_t **fallback,
p->p_pixels = o->p_pixels + o->i_lines * o->i_pitch; p->p_pixels = o->p_pixels + o->i_lines * o->i_pitch;
p->i_pitch = pitch / 2; 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 */ /* The dx/d3d buffer is always allocated as YV12 */
if (vlc_fourcc_AreUVPlanesSwapped(picture->format.i_chroma, VLC_CODEC_YV12)) { if (vlc_fourcc_AreUVPlanesSwapped(picture->format.i_chroma, VLC_CODEC_YV12)) {
......
...@@ -1488,8 +1488,8 @@ static int AllocQuad(vout_display_t *vd, const video_format_t *fmt, d3d_quad_t * ...@@ -1488,8 +1488,8 @@ static int AllocQuad(vout_display_t *vd, const video_format_t *fmt, d3d_quad_t *
D3D11_TEXTURE2D_DESC texDesc; D3D11_TEXTURE2D_DESC texDesc;
memset(&texDesc, 0, sizeof(texDesc)); memset(&texDesc, 0, sizeof(texDesc));
texDesc.Width = fmt->i_visible_width; texDesc.Width = fmt->i_width;
texDesc.Height = fmt->i_visible_height; texDesc.Height = fmt->i_height;
texDesc.MipLevels = texDesc.ArraySize = 1; texDesc.MipLevels = texDesc.ArraySize = 1;
texDesc.Format = cfg->textureFormat; texDesc.Format = cfg->textureFormat;
texDesc.SampleDesc.Count = 1; texDesc.SampleDesc.Count = 1;
......
...@@ -1032,8 +1032,8 @@ static int Direct3D9CreatePool(vout_display_t *vd, video_format_t *fmt) ...@@ -1032,8 +1032,8 @@ static int Direct3D9CreatePool(vout_display_t *vd, video_format_t *fmt)
/* Create a surface */ /* Create a surface */
LPDIRECT3DSURFACE9 surface; LPDIRECT3DSURFACE9 surface;
HRESULT hr = IDirect3DDevice9_CreateOffscreenPlainSurface(d3ddev, HRESULT hr = IDirect3DDevice9_CreateOffscreenPlainSurface(d3ddev,
fmt->i_visible_width, fmt->i_width,
fmt->i_visible_height, fmt->i_height,
d3dfmt->format, d3dfmt->format,
D3DPOOL_DEFAULT, D3DPOOL_DEFAULT,
&surface, &surface,
...@@ -1045,7 +1045,7 @@ static int Direct3D9CreatePool(vout_display_t *vd, video_format_t *fmt) ...@@ -1045,7 +1045,7 @@ static int Direct3D9CreatePool(vout_display_t *vd, video_format_t *fmt)
#ifndef NDEBUG #ifndef NDEBUG
msg_Dbg(vd, "Direct3D created offscreen surface: %ix%i", msg_Dbg(vd, "Direct3D created offscreen surface: %ix%i",
fmt->i_visible_width, fmt->i_visible_height); fmt->i_width, fmt->i_height);
#endif #endif
/* fill surface with black color */ /* fill surface with black color */
...@@ -1062,7 +1062,7 @@ static int Direct3D9CreatePool(vout_display_t *vd, video_format_t *fmt) ...@@ -1062,7 +1062,7 @@ static int Direct3D9CreatePool(vout_display_t *vd, video_format_t *fmt)
picture_resource_t resource = { .p_sys = picsys }; picture_resource_t resource = { .p_sys = picsys };
for (int i = 0; i < PICTURE_PLANE_MAX; i++) 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); picture_t *picture = picture_NewFromResource(fmt, &resource);
if (!picture) { if (!picture) {
...@@ -1124,8 +1124,8 @@ static int Direct3D9CreateScene(vout_display_t *vd, const video_format_t *fmt) ...@@ -1124,8 +1124,8 @@ static int Direct3D9CreateScene(vout_display_t *vd, const video_format_t *fmt)
*/ */
LPDIRECT3DTEXTURE9 d3dtex; LPDIRECT3DTEXTURE9 d3dtex;
hr = IDirect3DDevice9_CreateTexture(d3ddev, hr = IDirect3DDevice9_CreateTexture(d3ddev,
fmt->i_visible_width, fmt->i_width,
fmt->i_visible_height, fmt->i_height,
1, 1,
D3DUSAGE_RENDERTARGET, D3DUSAGE_RENDERTARGET,
sys->d3dpp.BackBufferFormat, sys->d3dpp.BackBufferFormat,
...@@ -1139,7 +1139,7 @@ static int Direct3D9CreateScene(vout_display_t *vd, const video_format_t *fmt) ...@@ -1139,7 +1139,7 @@ static int Direct3D9CreateScene(vout_display_t *vd, const video_format_t *fmt)
#ifndef NDEBUG #ifndef NDEBUG
msg_Dbg(vd, "Direct3D created texture: %ix%i", msg_Dbg(vd, "Direct3D created texture: %ix%i",
fmt->i_visible_width, fmt->i_visible_height); fmt->i_width, fmt->i_height);
#endif #endif
/* /*
......
...@@ -851,8 +851,8 @@ static int DirectXCreateSurface(vout_display_t *vd, ...@@ -851,8 +851,8 @@ static int DirectXCreateSurface(vout_display_t *vd,
ddsd.dwSize = sizeof(ddsd); ddsd.dwSize = sizeof(ddsd);
ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat); ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat);
ddsd.dwFlags = DDSD_HEIGHT | DDSD_WIDTH; ddsd.dwFlags = DDSD_HEIGHT | DDSD_WIDTH;
ddsd.dwWidth = fmt->i_visible_width; ddsd.dwWidth = fmt->i_width;
ddsd.dwHeight = fmt->i_visible_height; ddsd.dwHeight = fmt->i_height;
if (fourcc) { if (fourcc) {
ddsd.dwFlags |= DDSD_PIXELFORMAT; ddsd.dwFlags |= DDSD_PIXELFORMAT;
ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC; ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment