diff --git a/kernel/realsense/d4xx.c b/kernel/realsense/d4xx.c index ae804ea1..3abe8acb 100644 --- a/kernel/realsense/d4xx.c +++ b/kernel/realsense/d4xx.c @@ -659,12 +659,9 @@ static const u16 ds5_framerates[] = {5, 30}; #define DS5_FRAMERATE_DEFAULT_IDX 1 static const u16 ds5_framerate_30 = 30; - -static const u16 ds5_framerate_15_30[] = {15, 30}; - static const u16 ds5_framerate_25 = 25; +static const u16 ds5_framerate_15_30[] = {15, 30}; static const u16 ds5_framerate_15_25[] = {15, 25}; - static const u16 ds5_depth_framerate_to_30[] = {5, 15, 30}; static const u16 ds5_framerate_to_30[] = {5, 10, 15, 30}; static const u16 ds5_framerate_to_60[] = {5, 15, 30, 60}; @@ -1005,6 +1002,15 @@ static const struct ds5_resolution d43x_calibration_sizes[] = { }, }; +static const struct ds5_resolution d45x_calibration_sizes[] = { + { + .width = 1280, + .height = 800, + .framerates = ds5_framerate_15_25, + .n_framerates = ARRAY_SIZE(ds5_framerate_15_25), + }, +}; + static const struct ds5_resolution d46x_calibration_sizes[] = { { .width = 1600, @@ -1129,13 +1135,33 @@ static const struct ds5_format ds5_y_formats_41x[] = { .n_resolutions = ARRAY_SIZE(y8_41x_sizes), .resolutions = y8_41x_sizes, }, { - .data_type = GMSL_CSI_DT_RGB_888, /* 24-bit Calibration */ - .mbus_code = MEDIA_BUS_FMT_RGB888_1X24, /* FIXME */ + .data_type = GMSL_CSI_DT_RGB_888, /* Y12I, 24-bit Calibration */ + .mbus_code = MEDIA_BUS_FMT_RGB888_1X24, .n_resolutions = ARRAY_SIZE(d41x_calibration_sizes), .resolutions = d41x_calibration_sizes, }, }; +static const struct ds5_format ds5_y_formats_45x[] = { + { + /* First format: default */ + .data_type = GMSL_CSI_DT_RAW_8, /* Y8 */ + .mbus_code = MEDIA_BUS_FMT_Y8_1X8, + .n_resolutions = ARRAY_SIZE(y8_sizes), + .resolutions = y8_sizes, + }, { + .data_type = GMSL_CSI_DT_YUV422_8, /* Y8I */ + .mbus_code = MEDIA_BUS_FMT_VYUY8_1X16, + .n_resolutions = ARRAY_SIZE(y8_sizes), + .resolutions = y8_sizes, + }, { + .data_type = GMSL_CSI_DT_RGB_888, /* Y12I, 24-bit Calibration */ + .mbus_code = MEDIA_BUS_FMT_RGB888_1X24, + .n_resolutions = ARRAY_SIZE(d45x_calibration_sizes), + .resolutions = d45x_calibration_sizes, + }, +}; + static const struct ds5_format ds5_41x_rgb_format = { .data_type = GMSL_CSI_DT_YUV422_8, /* UYVY */ .mbus_code = MEDIA_BUS_FMT_YUYV8_1X16, @@ -1713,9 +1739,7 @@ static int ds5_configure(struct ds5 *state) #ifdef CONFIG_VIDEO_D4XX_SERDES data_type1 = sensor->config.format->data_type; data_type2 = state->is_imu ? 0x00 : md_fmt; - /* do not have metadata for y12i */ - if (state->is_y8 && data_type1 == GMSL_CSI_DT_RGB_888) - data_type2 = 0; + vc_id = state->g_ctx.dst_vc; ret = ds5_setup_pipeline(state, data_type1, data_type2, sensor->pipe_id, @@ -4817,6 +4841,10 @@ static int ds5_fixed_configuration(struct i2c_client *client, struct ds5 *state) sensor->formats = ds5_y_formats_41x; sensor->n_formats = ARRAY_SIZE(ds5_y_formats_41x); break; + case DS5_DEVICE_TYPE_D45X: + sensor->formats = ds5_y_formats_45x; + sensor->n_formats = ARRAY_SIZE(ds5_y_formats_45x); + break; default: sensor->formats = state->variant->formats; sensor->n_formats = state->variant->n_formats; @@ -5897,4 +5925,4 @@ MODULE_AUTHOR("Guennadi Liakhovetski ,\n\ Shikun Ding ,\n\ Dmitry Perchanov "); MODULE_LICENSE("GPL v2"); -MODULE_VERSION("1.0.1.31"); +MODULE_VERSION("1.0.1.32"); diff --git a/nvidia-oot/6.0/0003-Fix-y12i-calibration-stream.patch b/nvidia-oot/6.0/0003-Fix-y12i-calibration-stream.patch new file mode 100644 index 00000000..971da566 --- /dev/null +++ b/nvidia-oot/6.0/0003-Fix-y12i-calibration-stream.patch @@ -0,0 +1,15 @@ +diff --git a/drivers/media/platform/tegra/camera/vi/vi5_fops.c b/drivers/media/platform/tegra/camera/vi/vi5_fops.c +index 7d07ccd7..c64dcc38 100644 +--- a/drivers/media/platform/tegra/camera/vi/vi5_fops.c ++++ b/drivers/media/platform/tegra/camera/vi/vi5_fops.c +@@ -612,7 +612,8 @@ static void vi5_capture_dequeue(struct tegra_channel *chan, + trace_tegra_channel_capture_frame("sof", &ts); + vb->vb2_buf.timestamp = descr->status.sof_timestamp; + +- if (frame_err) ++ /* TODO: Remove the branch or process the error for Y12I only */ ++ if (false && frame_err) + buf->vb2_state = VB2_BUF_STATE_ERROR; + else + buf->vb2_state = VB2_BUF_STATE_DONE; + diff --git a/nvidia-oot/6.1/0003-Fix-y12i-calibration-stream.patch b/nvidia-oot/6.1/0003-Fix-y12i-calibration-stream.patch new file mode 120000 index 00000000..16be63f3 --- /dev/null +++ b/nvidia-oot/6.1/0003-Fix-y12i-calibration-stream.patch @@ -0,0 +1 @@ +../6.0/0003-Fix-y12i-calibration-stream.patch \ No newline at end of file diff --git a/nvidia-oot/6.2/0003-Fix-y12i-calibration-stream.patch b/nvidia-oot/6.2/0003-Fix-y12i-calibration-stream.patch new file mode 120000 index 00000000..16be63f3 --- /dev/null +++ b/nvidia-oot/6.2/0003-Fix-y12i-calibration-stream.patch @@ -0,0 +1 @@ +../6.0/0003-Fix-y12i-calibration-stream.patch \ No newline at end of file diff --git a/test/test_metadata/build.sh b/test/test_metadata/build.sh index 683269df..7c324f6f 100755 --- a/test/test_metadata/build.sh +++ b/test/test_metadata/build.sh @@ -4,6 +4,4 @@ set -x rm -rf test_metadata test_metadata.o -gcc test_metadata.c framesextract.c -o test_metadata - -./test_metadata "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" +gcc -g -O0 test_metadata.c framesextract.c -o test_metadata diff --git a/test/test_metadata/test_metadata b/test/test_metadata/test_metadata deleted file mode 100755 index 82bb061e..00000000 Binary files a/test/test_metadata/test_metadata and /dev/null differ diff --git a/test/test_metadata/test_metadata.c b/test/test_metadata/test_metadata.c index aa86ff54..fa440e3e 100644 --- a/test/test_metadata/test_metadata.c +++ b/test/test_metadata/test_metadata.c @@ -218,7 +218,7 @@ void requestBuffers(int fd, uint32_t type, uint32_t memory, uint32_t count) } } -void* queryMapQueueBuf(int fd, uint32_t type, uint32_t memory, uint8_t index, uint32_t size) +void* queryMapQueueBuf(int fd, uint32_t type, uint32_t memory, uint8_t index) { struct v4l2_buffer v4l2Buffer; memset(&v4l2Buffer, 0, sizeof(v4l2Buffer)); @@ -229,7 +229,7 @@ void* queryMapQueueBuf(int fd, uint32_t type, uint32_t memory, uint8_t index, ui if (ret) return NULL; void* buffer = mmap(NULL, - size, + v4l2Buffer.length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, @@ -295,13 +295,11 @@ int main(int argc, char** argv) { depthBuffers[i] = queryMapQueueBuf(video_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_MEMORY_MMAP, - i, - 2 * width * height); + i); metaDataBuffers[i] = queryMapQueueBuf(md_fd, V4L2_BUF_TYPE_META_CAPTURE, V4L2_MEMORY_MMAP, - i, - 4096); + i); } int ret = ioctl(md_fd, VIDIOC_STREAMON, &mdType); @@ -356,13 +354,11 @@ int main(int argc, char** argv) { depthBuffers[i] = queryMapQueueBuf(video_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_MEMORY_MMAP, - i, - 2 * width * height); + i); metaDataBuffers[i] = queryMapQueueBuf(md_fd, V4L2_BUF_TYPE_META_CAPTURE, V4L2_MEMORY_MMAP, - i, - 4096); + i); } int ret = ioctl(md_fd, VIDIOC_STREAMON, &mdType); @@ -406,7 +402,9 @@ int main(int argc, char** argv) { fprintf(stderr, "Error opening Ir video devices\n"); return 1; } - setFmt(video_fd, V4L2_PIX_FMT_GREY, width, height); + uint32_t format = V4L2_PIX_FMT_GREY; + if (stream_repeat % 2) format = V4L2_PIX_FMT_Y12I; + setFmt(video_fd, format, width, height); setFPS(video_fd, fps); requestBuffers(video_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_MEMORY_MMAP, SIZE_METADATA_BUFFERS); requestBuffers(md_fd, V4L2_BUF_TYPE_META_CAPTURE, V4L2_MEMORY_MMAP, SIZE_METADATA_BUFFERS); @@ -416,13 +414,11 @@ int main(int argc, char** argv) { depthBuffers[i] = queryMapQueueBuf(video_fd, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_MEMORY_MMAP, - i, - width * height); + i); metaDataBuffers[i] = queryMapQueueBuf(md_fd, V4L2_BUF_TYPE_META_CAPTURE, V4L2_MEMORY_MMAP, - i, - 4096); + i); } int ret = ioctl(md_fd, VIDIOC_STREAMON, &mdType);