Processor is i.MX 8M Plus, additionaly table on page 6 is saying that SRC(G2D_YUYV) / DST(G2D_NV12) conversion is possible Y(*).
sorry, I missed you mentioned imx8mp already, I checked gpu2d can support this, you can refer to nxp source code, for imx8mp, normally we use imxcompositor_g2d to test this, so I search this source code and attach here, imxcompositor_g2d will call g2d_bilt to do this CSC job, you can refer to the source code
How does this relate to the fact that gst-inspect shows that imxcompositor_g2d src pad accept RGB format variants and not YUYV like you suggested?
SRC template: 'src'
Availability: Always
Capabilities:
video/x-raw
format: { (string)RGB16, (string)RGBx, (string)RGBA, (string)BGRA, (string)BGRx, (string)BGR16, (string)ARGB, (string)ABGR, (string)xRGB, (string)xBGR }
video/x-raw(memory:SystemMemory, meta:GstVideoOverlayComposition)
format: { (string)RGB16, (string)RGBx, (string)RGBA, (string)BGRA, (string)BGRx, (string)BGR16, (string)ARGB, (string)ABGR, (string)xRGB, (string)xBGR }
Type: GstAggregatorPad
Pad Properties:
emit-signals : Send signals to signal data consumption
flags: readable, writable
Boolean. Default: false
I found the code I sent to you removed NV12 as output because of some reason, if you just want to test, you can add it in the code, I tested before, it works, the patch is as below, you also can use imxvideoconvert_g2d
static G2dFmtMap g2d_fmts_map[] = {
{GST_VIDEO_FORMAT_RGB16, G2D_RGB565, 16},
{GST_VIDEO_FORMAT_RGBx, G2D_RGBX8888, 32},
{GST_VIDEO_FORMAT_RGBA, G2D_RGBA8888, 32},
{GST_VIDEO_FORMAT_BGRA, G2D_BGRA8888, 32},
{GST_VIDEO_FORMAT_BGRx, G2D_BGRX8888, 32},
{GST_VIDEO_FORMAT_BGR16, G2D_BGR565, 16},
{GST_VIDEO_FORMAT_ARGB, G2D_ARGB8888, 32},
{GST_VIDEO_FORMAT_ABGR, G2D_ABGR8888, 32},
{GST_VIDEO_FORMAT_xRGB, G2D_XRGB8888, 32},
{GST_VIDEO_FORMAT_xBGR, G2D_XBGR8888, 32},
+{GST_VIDEO_FORMAT_NV12, G2D_NV12, 12},
//this only for separate YUV format and RGB format
{GST_VIDEO_FORMAT_UNKNOWN, -1, 1},
{GST_VIDEO_FORMAT_I420, G2D_I420, 12},
{GST_VIDEO_FORMAT_NV12, G2D_NV12, 12},
Refering to g2d-samples there is g2d_basic.c code with several use cases. This code almost shows what I would like to achieve. There is g2d resize test performance section where I modified only src.format and dst.format like below
src.left = 0;src.top = 0;src.right = (test_width > 1280) ? 1280 : test_width >> 1;src.bottom = (test_height > 720) ? 720 : test_height >> 1;src.stride = (test_width > 1280) ? 1280 : test_width >> 1;src.width = (test_width > 1280) ? 1280 : test_width >> 1;src.height = (test_height > 720) ? 720 : test_height >> 1;src.rot = G2D_ROTATION_0;src.format= G2D_YUYV;dst.left = 0;dst.top = 0;dst.right = test_width;dst.bottom = test_height;dst.stride = test_width;dst.width = test_width;dst.height = test_height;dst.rot = G2D_ROTATION_0;dst.format= G2D_NV12;
YUYV 90 rotation time 4502us, 222fps, 464Mpixel/s ........YUYV 270 rotation time 4559us, 219fps, 458Mpixel/s ........---------------- g2d resize test performance ----------------resize test from 1280x720 to 1920x1088:g2d_blit_2d: fail with status -1g2d_blit_2d: fail with status -1g2d_blit_2d: fail with status -1g2d_blit_2d: fail with status -1g2d_blit_2d: fail with status -1g2d_blit_2d: fail with status -1g2d_blit_2d: fail with status -1g2d_blit_2d: fail with status -1g2d_blit_2d: fail with status -1g2d_blit_2d: fail with status -1g2d_blit_2d: fail with status -1g2d_blit_2d: fail with status -1g2d_blit_2d: fail with status -1g2d_blit_2d: fail with status -1g2d_blit_2d: fail with status -1g2d_blit_2d: fail with status -1
I didn't test this sample code yet, if could pls use imxvideoconvert_g2d , I have built and checked the format support, as I mentioned before, because this is general GPU 2D API for different soc, so internal team removed some formats support, could you confirm your input source is correct format, right? how about testing./g2d_yuv_test
I don't think I said gstreamer in my last reply, do you mind testing g2d_yuv_test which is simple C code as my last reply mentions?
https://github.com/nxp-imx/g2d-samples/tree/imx_2.1/yuv_test
~/g2d_samples# ./g2d_yuv_test --format yuyv-nv12 --source 1920x1080 --wh 1920x1080 --dest 1280x720 videotest_1920_1080_YUY2.raw
Segmentation fault
where videotest_1920_1080_YUY2.raw file was generated by using gst-launch
gst-launch-1.0 --verbose videotestsrc num-buffers=1 ! video/x-raw,format=YUY2,width=1920,height=1080,framerate=1/1 ! videoconvert ! video/x-raw,format=YUY2,width=1920,height=1080,framerate=1/1 ! filesink location=videotest_1920_1080_YUY2.raw
it seems the command you used isn't correct, I tested successfully, try to refer to my command
I use the same command and input file as you indicated in your replay and it works!
I created new raw file with 1920x1080 resolution using ffmpeg tool and I called once again g2d_ yuv_test, and it also works!
The last scenario when I want to change the output format and size simultaneously shows error messages.
try to set -w 1920x1280
Your suggestion is giving same result as in my previous efforts, I mean return status -1.
refer to the reference manual, yuv dst resizing doesn't supported by the imx8mp g2d
ok let me reproduce this and tell you later