0006-Support-direct-display-using-of-wave511-omx-decoder.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. From 23c80a346def541e7a750efa22be1da64777067e Mon Sep 17 00:00:00 2001
  2. From: Som Qin <som.qin@starfivetech.com>
  3. Date: Wed, 18 Oct 2023 09:55:16 +0800
  4. Subject: [PATCH] Support direct display using of wave511 omx decoder
  5. Gets environment variables "SF_OMX_SLICE" to support special cases
  6. Signed-off-by: Som Qin <som.qin@starfivetech.com>
  7. ---
  8. sys/kms/gstkmsallocator.c | 27 ++++++++++++++++++++++++++-
  9. 1 file changed, 26 insertions(+), 1 deletion(-)
  10. diff --git a/sys/kms/gstkmsallocator.c b/sys/kms/gstkmsallocator.c
  11. index cb2f6bd..493cd92 100644
  12. --- a/sys/kms/gstkmsallocator.c
  13. +++ b/sys/kms/gstkmsallocator.c
  14. @@ -189,7 +189,18 @@ gst_kms_allocator_memory_create (GstKMSAllocator * allocator,
  15. fmt = gst_drm_format_from_video (GST_VIDEO_INFO_FORMAT (vinfo));
  16. arg.bpp = gst_drm_bpp_from_drm (fmt);
  17. arg.width = GST_VIDEO_INFO_WIDTH (vinfo);
  18. - h = GST_VIDEO_INFO_HEIGHT (vinfo);
  19. + char* env = NULL;
  20. + env = getenv("SF_OMX_SLICE");
  21. + if (env) {
  22. + gint slice, i;
  23. + slice = atoi(env);
  24. + if (slice > 0 && slice > vinfo->height) {
  25. + h = slice;
  26. + } else {
  27. + h = GST_VIDEO_INFO_HEIGHT (vinfo);
  28. + }
  29. + } else
  30. + h = GST_VIDEO_INFO_HEIGHT (vinfo);
  31. arg.height = gst_drm_height_from_drm (fmt, h);
  32. ret = drmIoctl (allocator->priv->fd, DRM_IOCTL_MODE_CREATE_DUMB, &arg);
  33. @@ -498,6 +509,20 @@ gst_kms_allocator_bo_alloc (GstAllocator * allocator, GstVideoInfo * vinfo)
  34. mem = GST_MEMORY_CAST (kmsmem);
  35. + char* env = NULL;
  36. + env = getenv("SF_OMX_SLICE");
  37. + if (env) {
  38. + gint slice, i;
  39. + slice = atoi(env);
  40. + if (slice > 0 && slice > vinfo->height) {
  41. + GST_DEBUG_OBJECT (alloc, "slice %d is large than height %d, recalculate size/offset",
  42. + slice, vinfo->height );
  43. + vinfo->size = vinfo->size / vinfo->height * slice;
  44. + for (i = 0; i < GST_VIDEO_MAX_PLANES; i++)
  45. + vinfo->offset[i] = vinfo->offset[i] / vinfo->height * slice;
  46. + }
  47. + }
  48. +
  49. if (!gst_kms_allocator_memory_create (alloc, kmsmem, vinfo)) {
  50. g_slice_free (GstKMSMemory, kmsmem);
  51. return NULL;
  52. --
  53. 2.25.1