Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* Re: [FFmpeg-devel] [FFmpeg-cvslog] libavutil/hwcontext_vaapi: Add a new nv12 format map to support vulkan frame
       [not found] <20211210160501.929C341050D@natalya.videolan.org>
@ 2021-12-27 18:56 ` Mark Thompson
  2021-12-28  3:57   ` Chen, Wenbin
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Thompson @ 2021-12-27 18:56 UTC (permalink / raw)
  To: ffmpeg-devel

On 10/12/2021 16:05, Wenbin Chen wrote:
> ffmpeg | branch: master | Wenbin Chen <wenbin.chen@intel.com> | Tue Dec  7 17:05:50 2021 +0800| [f3c9847c2754b7a43eb721c95e356a53085c2491] | committer: Lynne
> 
> libavutil/hwcontext_vaapi: Add a new nv12 format map to support vulkan frame
> 
> Vulkan will map nv12 to R8 and GR88, so add this map to vaapi to support
> vulkan frame.
> 
> Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> 
>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f3c9847c2754b7a43eb721c95e356a53085c2491
> ---
> 
>   libavutil/hwcontext_vaapi.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
> index 75acc851d6..994b744e4d 100644
> --- a/libavutil/hwcontext_vaapi.c
> +++ b/libavutil/hwcontext_vaapi.c
> @@ -992,6 +992,7 @@ static const struct {
>   } vaapi_drm_format_map[] = {
>   #ifdef DRM_FORMAT_R8
>       DRM_MAP(NV12, 2, DRM_FORMAT_R8,  DRM_FORMAT_RG88),
> +    DRM_MAP(NV12, 2, DRM_FORMAT_R8,  DRM_FORMAT_GR88),
>   #endif
>       DRM_MAP(NV12, 1, DRM_FORMAT_NV12),
>   #if defined(VA_FOURCC_P010) && defined(DRM_FORMAT_R16)

This looks very shady.  Shouldn't one or the other of these be NV21, with the second plane VU rather than UV?

- Mark
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [FFmpeg-cvslog] libavutil/hwcontext_vaapi: Add a new nv12 format map to support vulkan frame
  2021-12-27 18:56 ` [FFmpeg-devel] [FFmpeg-cvslog] libavutil/hwcontext_vaapi: Add a new nv12 format map to support vulkan frame Mark Thompson
@ 2021-12-28  3:57   ` Chen, Wenbin
  2021-12-28  4:38     ` Xiang, Haihao
  0 siblings, 1 reply; 3+ messages in thread
From: Chen, Wenbin @ 2021-12-28  3:57 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

> On 10/12/2021 16:05, Wenbin Chen wrote:
> > ffmpeg | branch: master | Wenbin Chen <wenbin.chen@intel.com> | Tue
> Dec  7 17:05:50 2021 +0800| [f3c9847c2754b7a43eb721c95e356a53085c2491]
> | committer: Lynne
> >
> > libavutil/hwcontext_vaapi: Add a new nv12 format map to support vulkan
> frame
> >
> > Vulkan will map nv12 to R8 and GR88, so add this map to vaapi to support
> > vulkan frame.
> >
> > Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> >
> >>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f3c9847c2754b7a
> 43eb721c95e356a53085c2491
> > ---
> >
> >   libavutil/hwcontext_vaapi.c | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
> > index 75acc851d6..994b744e4d 100644
> > --- a/libavutil/hwcontext_vaapi.c
> > +++ b/libavutil/hwcontext_vaapi.c
> > @@ -992,6 +992,7 @@ static const struct {
> >   } vaapi_drm_format_map[] = {
> >   #ifdef DRM_FORMAT_R8
> >       DRM_MAP(NV12, 2, DRM_FORMAT_R8,  DRM_FORMAT_RG88),
> > +    DRM_MAP(NV12, 2, DRM_FORMAT_R8,  DRM_FORMAT_GR88),
> >   #endif
> >       DRM_MAP(NV12, 1, DRM_FORMAT_NV12),
> >   #if defined(VA_FOURCC_P010) && defined(DRM_FORMAT_R16)
> 
> This looks very shady.  Shouldn't one or the other of these be NV21, with the
> second plane VU rather than UV?
> 
> - Mark

I add this because I see vulkan map RG88 and GR88 to the same format.
```
{ DRM_FORMAT_GR88,     VK_FORMAT_R8G8_UNORM     },
{ DRM_FORMAT_RG88,     VK_FORMAT_R8G8_UNORM     },
```
I thinks you are right. One of them should be NV21. I should switch the position
Of GR88 and RG88 in this map table so that VK_FORMAT_R8G8_UNORM can be
mapped to DRM_FORMAT_RG88 rather than DRM_FORMAT_GR88.

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [FFmpeg-cvslog] libavutil/hwcontext_vaapi: Add a new nv12 format map to support vulkan frame
  2021-12-28  3:57   ` Chen, Wenbin
@ 2021-12-28  4:38     ` Xiang, Haihao
  0 siblings, 0 replies; 3+ messages in thread
From: Xiang, Haihao @ 2021-12-28  4:38 UTC (permalink / raw)
  To: ffmpeg-devel

On Tue, 2021-12-28 at 03:57 +0000, Chen, Wenbin wrote:
> > On 10/12/2021 16:05, Wenbin Chen wrote:
> > > ffmpeg | branch: master | Wenbin Chen <wenbin.chen@intel.com> | Tue
> > 
> > Dec  7 17:05:50 2021 +0800| [f3c9847c2754b7a43eb721c95e356a53085c2491]
> > > committer: Lynne
> > > 
> > > libavutil/hwcontext_vaapi: Add a new nv12 format map to support vulkan
> > 
> > frame
> > > 
> > > Vulkan will map nv12 to R8 and GR88, so add this map to vaapi to support
> > > vulkan frame.
> > > 
> > > Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
> > > 
> > > > 
> > 
> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f3c9847c2754b7a
> > 43eb721c95e356a53085c2491
> > > ---
> > > 
> > >   libavutil/hwcontext_vaapi.c | 1 +
> > >   1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
> > > index 75acc851d6..994b744e4d 100644
> > > --- a/libavutil/hwcontext_vaapi.c
> > > +++ b/libavutil/hwcontext_vaapi.c
> > > @@ -992,6 +992,7 @@ static const struct {
> > >   } vaapi_drm_format_map[] = {
> > >   #ifdef DRM_FORMAT_R8
> > >       DRM_MAP(NV12, 2, DRM_FORMAT_R8,  DRM_FORMAT_RG88),
> > > +    DRM_MAP(NV12, 2, DRM_FORMAT_R8,  DRM_FORMAT_GR88),
> > >   #endif
> > >       DRM_MAP(NV12, 1, DRM_FORMAT_NV12),
> > >   #if defined(VA_FOURCC_P010) && defined(DRM_FORMAT_R16)
> > 
> > This looks very shady.  Shouldn't one or the other of these be NV21, with
> > the
> > second plane VU rather than UV?
> > 
> > - Mark
> 
> I add this because I see vulkan map RG88 and GR88 to the same format.
> ```
> { DRM_FORMAT_GR88,     VK_FORMAT_R8G8_UNORM     },
> { DRM_FORMAT_RG88,     VK_FORMAT_R8G8_UNORM     },
> ```
> I thinks you are right. One of them should be NV21. I should switch the
> position
> Of GR88 and RG88 in this map table so that VK_FORMAT_R8G8_UNORM can be
> mapped to DRM_FORMAT_RG88 rather than DRM_FORMAT_GR88.

Changing the mapping will have other issues, e.g. another hw context supports
nv21. I think the root cause is nv12 and nv21 have the same VkFormat in 
vk_pixfmt_map[].

    { AV_PIX_FMT_NV12, { VK_FORMAT_R8_UNORM, VK_FORMAT_R8G8_UNORM }}, 
    { AV_PIX_FMT_NV21, { VK_FORMAT_R8_UNORM, VK_FORMAT_R8G8_UNORM }},

So the pixel format should be taken into account when mapping drm format and
vulkan format

Thanks
Haihao



_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-28  4:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20211210160501.929C341050D@natalya.videolan.org>
2021-12-27 18:56 ` [FFmpeg-devel] [FFmpeg-cvslog] libavutil/hwcontext_vaapi: Add a new nv12 format map to support vulkan frame Mark Thompson
2021-12-28  3:57   ` Chen, Wenbin
2021-12-28  4:38     ` Xiang, Haihao

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git