From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 2F3304C683 for ; Tue, 9 Sep 2025 19:53:46 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'zpefU0BPc5FE4aauf2kTWs2QEmvesfQGiq5g7i92EbQ=', expected b'W/Kqt0cH4+GSOkawfn4beBOpFO7UQ2FNLD2jBYAHWLE=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1757447621; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=zpefU0BPc5FE4aauf2kTWs2QEmvesfQGiq5g7i92EbQ=; b=nL0vtK8rVNAz8GfgViHIQUlooRzxgrJcIXpdSkyZ6OEepk8xnEYWZSiU6i1SwiOM5surC lJ+rp35AtEhTuFS7H34rnm0+uGD1uwOi9ffYt/JFOZ8PkZ3hIFkGFRcJOOClCCidJ7VoTgE FzpMDTzlmoD2ImGx/kRncMSf+f7DasZo8tW4haHHLQq6eyin/C3zuXeaZQo85WICLdcBqcj aNCXdFAkM8hFDNpTLct/0R1Ojcf6Bx3SAFmPOSTLjKtUvbDH8d1lN4SW/Qx3NoDoC8VcCC3 2R2NgXvlvZ9K8NG8BVRoMqW8K67t1fpgkCUfoe276G9bhAY8JkmvpXxMi24Q== Received: from [172.19.0.4] (unknown [172.19.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 8C05B68E7A0; Tue, 9 Sep 2025 22:53:41 +0300 (EEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1757447620; b=J9Xvw5szfAS1Ql+H5R6Je0wi8j4uexoSnImWX0FMCIOgA4q1UDoJTh31GFzZCFJ7fp9DS M+5xA+AoRA4FnFJJ5bEmMZh8oJlhR0VBy3cT9XhXsQLNEMT3IM6ZcaoW8zAYLhUthDAUPvI I52TDgGqlpNR4sXL0ZGBgTruEIzlnJEkHCgdfKSppxUkGnvm44mVTZxWyzzkJ5de2OCzsoL uGKu4ughZGiItIgND6KjDsqkaIYWPz3B1z/2e8LSKWlnKniHYCgzA6ROeLcVgku9tbOuX4l 34gzePozOlYxyhtJEu9TfnPCKyk2rePMAcTvGC4MYUInIOblJFHAvStQ3Dmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1757447620; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=MfMVJrwvw/EVyUUO4YocQUv3cMIFY3l8a6oc4byORX4=; b=kbD8ie5eTU0YSE1IbhpfyDQvSwsd55dMcfH7Z5R/spcTKTPLjF/LxrhEDVtzXaRWTmJpe EeDE6c4hgH9Ik3miPXf2UrEPEhoF8XR5oEz/KUwK2GAAjXIoKoa5y52YRzFtPOa1gQcgH4Y bOcRtLE6pUqaSWmRR3Aho6kcQzJ1PVu7CRmvC70/4ipOhLGzO4ak7PFoPDzf0qdBPAIekIh 2JUJeC8YFkRuKnp+RANDgfXzBypbLZ19JnepQeu5Zmh9IiPTOeNx3Pg6T4gZM2DJ94tamCM rPZBZuh5In4kjssHZxGDXUqaMMH0NQEX6aq7UXO9m3FrPxD8o1mi8tmShiVg== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=none Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1757447610; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=W/Kqt0cH4+GSOkawfn4beBOpFO7UQ2FNLD2jBYAHWLE=; b=neKub0PuI1EV/TE72i3BIZBmAXhtyhpdl+SJrLmhre1Qi0NVv4KOAlrlbF/ApEZX5xHJk UjurlSlQDnnzbvMa3Es24VBqOvqFs7uT+9KUuzDH8dPj9Y75y9PTB1iCCevZeAuDdkL/bm4 /Q6MBUBuvRXrQGlgAIJZ4SSIC7ZkTmiTVtNWw1y9JHz+OLDc2jyiqDMhHwc/0K6nyRRvqTk 8j3t/s1FKmz86868ljFeiHK2AE/q91fAN8ZfhKfu0QJO3Z0TBDxshFT0MJX87Y0H5TSB+7V zSY5saUlV+nbTMrLRIVhUopqeS/yykwa8qt9L99IM+tLDcwwmn5wqQbSyMQQ== Received: from 3f9d35a0eedc (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id D235368C683 for ; Tue, 9 Sep 2025 22:53:30 +0300 (EEST) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Tue, 09 Sep 2025 19:53:30 -0000 Message-ID: <175744761102.25.15729934998483635433@463a07221176> Message-ID-Hash: AHEFPGPIV7DQFPXCBBZKXDXWV2WOQOU3 X-Message-ID-Hash: AHEFPGPIV7DQFPXCBBZKXDXWV2WOQOU3 X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] avutil/hwcontext_d3d11va: remove D3D11_BIND_RENDER_TARGET restriction for array textures (PR #20480) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Timo Rothenpieler via ffmpeg-devel Cc: Timo Rothenpieler Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #20480 opened by Timo Rothenpieler (BtbN) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20480 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20480.patch This was added in 4f78711f9c, with the commit message claiming that it's a Microsoft restriction that array textures with ArraySize > 2 cannot be created with D3D11_BIND_RENDER_TARGET. I was unable to find any documentation or other references on that, and a quick test also found it to not be the case. So this patch removes that restriction. This enables frame sources, like the d3d11 capture filters, to output frames in an array texture, which is neccesary to pass those frames as input to some hardware encoders. >>From a3db834b9b029adb04eb0d2625b7bfd1995692f5 Mon Sep 17 00:00:00 2001 From: Timo Rothenpieler Date: Tue, 9 Sep 2025 20:08:22 +0200 Subject: [PATCH 1/2] avfilter/vsrc_ddagrab: support rendering mouse cursor onto array textures --- libavfilter/vsrc_ddagrab.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c index 6533e2b66e..e035ac9bc4 100644 --- a/libavfilter/vsrc_ddagrab.c +++ b/libavfilter/vsrc_ddagrab.c @@ -818,6 +818,8 @@ static av_cold int init_hwframes_ctx(AVFilterContext *avctx) dda->frames_ctx->format = AV_PIX_FMT_D3D11; dda->frames_ctx->width = dda->width; dda->frames_ctx->height = dda->height; + if (avctx->extra_hw_frames > 0) + dda->frames_ctx->initial_pool_size = 8 + avctx->extra_hw_frames; switch (dda->raw_format) { case DXGI_FORMAT_B8G8R8A8_UNORM: @@ -936,7 +938,7 @@ static int draw_mouse_pointer(AVFilterContext *avctx, AVFrame *frame) D3D11_RENDER_TARGET_VIEW_DESC target_desc = { 0 }; ID3D11RenderTargetView* target_view = NULL; ID3D11Buffer *mouse_vertex_buffer = NULL; - D3D11_TEXTURE2D_DESC tex_desc; + D3D11_TEXTURE2D_DESC tex_desc, frame_desc; int num_vertices = 0; int x, y; HRESULT hr; @@ -946,6 +948,7 @@ static int draw_mouse_pointer(AVFilterContext *avctx, AVFrame *frame) return 0; ID3D11Texture2D_GetDesc(dda->mouse_texture, &tex_desc); + ID3D11Texture2D_GetDesc(frame_tex, &frame_desc); x = dda->mouse_x - dda->offset_x; y = dda->mouse_y - dda->offset_y; @@ -954,9 +957,17 @@ static int draw_mouse_pointer(AVFilterContext *avctx, AVFrame *frame) -x >= (int)tex_desc.Width || -y >= (int)tex_desc.Height) return 0; - target_desc.Format = dda->raw_format; - target_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; - target_desc.Texture2D.MipSlice = 0; + target_desc.Format = frame_desc.Format; + + if (frame_desc.ArraySize > 1) { + target_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY; + target_desc.Texture2DArray.ArraySize = 1; + target_desc.Texture2DArray.FirstArraySlice = (uintptr_t)frame->data[1]; + target_desc.Texture2DArray.MipSlice = 0; + } else { + target_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; + target_desc.Texture2D.MipSlice = 0; + } hr = ID3D11Device_CreateRenderTargetView(dda->device_hwctx->device, (ID3D11Resource*)frame_tex, -- 2.49.1 >>From 684127be1e06676290b8d15358ef202cc3947d75 Mon Sep 17 00:00:00 2001 From: Timo Rothenpieler Date: Tue, 9 Sep 2025 21:46:25 +0200 Subject: [PATCH 2/2] avutil/hwcontext_d3d11va: remove D3D11_BIND_RENDER_TARGET restriction for array textures This was added in 4f78711f9c28b11dae4e4b96be46b6b4925eb8c6, with the commit message claiming that it's a Microsoft restriction that array textures with ArraySize > 2 cannot be created with D3D11_BIND_RENDER_TARGET. I was unable to find any documentation or other references on that, and a quick test also found it to not be the case. So this patch removes that restriction. This enables frame sources, like the d3d11 capture filters, to output frames in an array texture, which is neccesary to pass those frames as input to some hardware encoders. --- libavutil/hwcontext_d3d11va.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c index 9831f530c1..83414ad0d4 100644 --- a/libavutil/hwcontext_d3d11va.c +++ b/libavutil/hwcontext_d3d11va.c @@ -318,7 +318,7 @@ static int d3d11va_frames_init(AVHWFramesContext *ctx) ctx->initial_pool_size = texDesc2.ArraySize; hwctx->BindFlags = texDesc2.BindFlags; hwctx->MiscFlags = texDesc2.MiscFlags; - } else if (!(texDesc.BindFlags & D3D11_BIND_RENDER_TARGET) && texDesc.ArraySize > 0) { + } else if (texDesc.ArraySize > 0) { hr = ID3D11Device_CreateTexture2D(device_hwctx->device, &texDesc, NULL, &hwctx->texture); if (FAILED(hr)) { av_log(ctx, AV_LOG_ERROR, "Could not create the texture (%lx)\n", (long)hr); -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org