[vlc-commits] [Git][videolan/vlc][3.0.x] 2 commits: d3d11_fmt: create texture for decoders or not

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Jun 8 10:56:51 UTC 2024



Jean-Baptiste Kempf pushed to branch 3.0.x at VideoLAN / VLC


Commits:
317dc63b by Steve Lhomme at 2024-06-08T10:33:36+02:00
d3d11_fmt: create texture for decoders or not

In HDR to SDR the texture staging texture cannot be allocated as a decoder texture.
RDG10A2 is not supported for decoding.

- - - - -
d587ae96 by Steve Lhomme at 2024-06-08T10:34:32+02:00
d3d11_fmt: remove unused variable

Since 380dee8053ef69220707aed10b57113b64e0a925

- - - - -


4 changed files:

- modules/hw/d3d11/d3d11_deinterlace.c
- modules/video_chroma/d3d11_fmt.c
- modules/video_chroma/d3d11_fmt.h
- modules/video_output/win32/direct3d11.c


Changes:

=====================================
modules/hw/d3d11/d3d11_deinterlace.c
=====================================
@@ -307,7 +307,7 @@ static picture_t *NewOutputPicture( filter_t *p_filter )
             fmt.i_width  = dstDesc.Width;
             fmt.i_height = dstDesc.Height;
             if (AllocateTextures(p_filter, &p_filter->p_sys->d3d_dev, cfg,
-                                 &fmt, 1, pic->p_sys->texture) != VLC_SUCCESS)
+                                 &fmt, false, 1, pic->p_sys->texture) != VLC_SUCCESS)
             {
                 free(pic->p_sys);
                 return NULL;


=====================================
modules/video_chroma/d3d11_fmt.c
=====================================
@@ -147,7 +147,6 @@ int D3D11_AllocateShaderView(vlc_object_t *obj, ID3D11Device *d3ddevice,
 static HKEY GetAdapterRegistry(vlc_object_t *obj, DXGI_ADAPTER_DESC *adapterDesc)
 {
     HKEY hDisplayKey, hKey;
-    CHAR key[128];
     CHAR szData[256], lookup[256];
     DWORD len = 256;
     LSTATUS ret;
@@ -570,7 +569,7 @@ const d3d_format_t *FindD3D11Format(vlc_object_t *o,
 
 #undef AllocateTextures
 int AllocateTextures( vlc_object_t *obj, d3d11_device_t *d3d_dev,
-                      const d3d_format_t *cfg, const video_format_t *fmt,
+                      const d3d_format_t *cfg, const video_format_t *fmt, bool for_decoder,
                       unsigned pool_size, ID3D11Texture2D *textures[] )
 {
     plane_t planes[PICTURE_PLANE_MAX];
@@ -584,7 +583,8 @@ int AllocateTextures( vlc_object_t *obj, d3d11_device_t *d3d_dev,
     texDesc.MiscFlags = 0; //D3D11_RESOURCE_MISC_SHARED;
     texDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
     if (is_d3d11_opaque(fmt->i_chroma)) {
-        texDesc.BindFlags |= D3D11_BIND_DECODER;
+        if (for_decoder)
+            texDesc.BindFlags |= D3D11_BIND_DECODER;
         texDesc.Usage = D3D11_USAGE_DEFAULT;
         texDesc.CPUAccessFlags = 0;
     } else {


=====================================
modules/video_chroma/d3d11_fmt.h
=====================================
@@ -159,8 +159,8 @@ static inline const d3d_format_t *D3D11_RenderFormat(DXGI_FORMAT opaque, bool gp
 }
 
 int AllocateTextures(vlc_object_t *, d3d11_device_t *, const d3d_format_t *,
-                     const video_format_t *, unsigned pool_size, ID3D11Texture2D *textures[]);
-#define AllocateTextures(a,b,c,d,e,f)  AllocateTextures(VLC_OBJECT(a),b,c,d,e,f)
+                     const video_format_t *, bool, unsigned pool_size, ID3D11Texture2D *textures[]);
+#define AllocateTextures(a,b,c,d,e,f,g)  AllocateTextures(VLC_OBJECT(a),b,c,d,e,f,g)
 
 #ifndef NDEBUG
 void D3D11_LogProcessorSupport(vlc_object_t*, ID3D11VideoProcessorEnumerator*);


=====================================
modules/video_output/win32/direct3d11.c
=====================================
@@ -435,7 +435,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
             /* only provide enough for the filters, we can still do direct rendering */
             slices = __MIN(slices, 6);
 
-        if (AllocateTextures(vd, &sys->d3d_dev, sys->pool_d3dfmt, &sys->pool_fmt, slices, textures))
+        if (AllocateTextures(vd, &sys->d3d_dev, sys->pool_d3dfmt, &sys->pool_fmt, true, slices, textures))
             goto error;
 
         pictures = calloc(pool_size, sizeof(*pictures));
@@ -1897,7 +1897,7 @@ static int Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
         surface_fmt.i_width  = sys->picQuad.i_width;
         surface_fmt.i_height = sys->picQuad.i_height;
 
-        if (AllocateTextures(vd, &sys->d3d_dev, sys->picQuad.formatInfo, &surface_fmt, 1, textures))
+        if (AllocateTextures(vd, &sys->d3d_dev, sys->picQuad.formatInfo, &surface_fmt, false, 1, textures))
         {
             msg_Err(vd, "Failed to allocate the staging texture");
             return VLC_EGENERIC;
@@ -2240,7 +2240,7 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
             if (unlikely(d3dquad==NULL)) {
                 continue;
             }
-            if (AllocateTextures(vd, &sys->d3d_dev, sys->d3dregion_format, &r->p_picture->format, 1, d3dquad->picSys.texture)) {
+            if (AllocateTextures(vd, &sys->d3d_dev, sys->d3dregion_format, &r->p_picture->format, false, 1, d3dquad->picSys.texture)) {
                 msg_Err(vd, "Failed to allocate %dx%d texture for OSD",
                         r->fmt.i_visible_width, r->fmt.i_visible_height);
                 for (int j=0; j<D3D11_MAX_SHADER_VIEW; j++)



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/86a582c93eb1a442bd1d8641853bebf752225dbd...d587ae967ad6fc5a93c127b7263c179224e75cdc

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/86a582c93eb1a442bd1d8641853bebf752225dbd...d587ae967ad6fc5a93c127b7263c179224e75cdc
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list