Linux kernel 5.10 on XU3/4

Test and fix the Kernel 5.4 features
MastaG
Posts: 407
Joined: Mon Aug 26, 2013 6:05 pm
languages_spoken: english
Has thanked: 45 times
Been thanked: 68 times
Contact:

Linux kernel 5.10 on XU3/4

Post by MastaG »

Hi there,

I'm trying to build Linux 5.10 for the XU4 and it works great, however as panfrost still has some quirks (artifacts) I'd like to keep using the old wayland/gbm blob from ARM.
So I'm trying to port the mali driver to the kernel.

With some small changes (mostly around timestamps and some tmp= functions) I can get it to build.
Except for the below code in: drivers/gpu/arm/midgard/mali_kbase_softjobs.c

Code: Select all

#ifdef CONFIG_DMA_SHARED_BUFFER
        case KBASE_MEM_TYPE_IMPORTED_UMM: {
                struct dma_buf *dma_buf = gpu_alloc->imported.umm.dma_buf;

                KBASE_DEBUG_ASSERT(dma_buf != NULL);
                if (dma_buf->size > buf_data->nr_extres_pages * PAGE_SIZE)
                        dev_warn(kctx->kbdev->dev, "External resources buffer size mismatch");

                dma_to_copy = min(dma_buf->size,
                        (size_t)(buf_data->nr_extres_pages * PAGE_SIZE));
                ret = dma_buf_begin_cpu_access(dma_buf,
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) && !defined(CONFIG_CHROMEOS)
                                0, dma_to_copy,
#endif
                                DMA_FROM_DEVICE);
                if (ret)
                        goto out_unlock;

                for (i = 0; i < dma_to_copy/PAGE_SIZE; i++) {

                        void *extres_page = dma_buf_kmap(dma_buf, i);

                        if (extres_page)
                                kbase_mem_copy_from_extres_page(kctx,
                                                extres_page, pages,
                                                buf_data->nr_pages,
                                                &target_page_nr,
                                                offset, &to_copy);

                        dma_buf_kunmap(dma_buf, i, extres_page);
                        if (target_page_nr >= buf_data->nr_pages)
                                break;
                }
                dma_buf_end_cpu_access(dma_buf,
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0) && !defined(CONFIG_CHROMEOS)
                                0, dma_to_copy,
#endif
                                DMA_FROM_DEVICE);
                break;
        }
#endif
        default:
                ret = -EINVAL;
        }
You see, dma_buf_kmap and dma_buf_kunmap have been dropped in recent kernels.
However we do have dma_buf_vmap and dma_buf_vunmap which does the same, only it doesn't support pages, so it's like one big buffer.

Is there someone who can rewrite the above code to use dma_buf_v(un)map instead?
Or perhaps someone who already did this?
Last edited by MastaG on Thu Dec 24, 2020 10:21 pm, edited 1 time in total.

User avatar
tobetter
Posts: 10043
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 640 times
Been thanked: 1714 times
Contact:

Re: More recent kernels lacking dma_buf_k(un)map for Mali

Post by tobetter »

@MastaG, let me add the change what I am using for ARM Mali Wayland driver and this change works with 5.10 kernel. So please try the patch and let me know if it works for you.
mali_r24p0.diff.txt
(1.91 KiB) Downloaded 151 times
What I am curious is if you are building the 5.10 kernel branch for XU4 your own? Or you are able to join my Linux branch which I already merged many kernel patches for XU4 from 5.4 but not being tested much. Such patches are being merged into new branch whenever new kernel version is uploaded but not tested much since I am currently focusing to support ODROID-N2/C4/HC4...so it would be great if you can suport my branch and do pull request if you add a patch. Then my build server can build the branch regularly and can be published through my package server.
https://github.com/tobetter/linux/commi ... oid-5.10.y

Please let me know your idea. :)
These users thanked the author tobetter for the post (total 2):
MastaG (Tue Dec 22, 2020 11:06 pm) • AdrianB (Tue Jan 12, 2021 5:54 am)

MastaG
Posts: 407
Joined: Mon Aug 26, 2013 6:05 pm
languages_spoken: english
Has thanked: 45 times
Been thanked: 68 times
Contact:

Re: More recent kernels lacking dma_buf_k(un)map for Mali

Post by MastaG »

Wow tobetter!
Thanks for the quick response!

I'll fork your branch, apply the patches and make some PR's once I get it working.
5.4 was working great btw, but it has become a bit old for recent distro's such as Fedora 33.
Also I like to test some of the upstream changes to the exynos drm driver for Kodi, samsung is still supporting it :)

I'll keep you posted.

User avatar
tobetter
Posts: 10043
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 640 times
Been thanked: 1714 times
Contact:

Re: More recent kernels lacking dma_buf_k(un)map for Mali

Post by tobetter »

MastaG wrote:
Tue Dec 22, 2020 11:05 pm
Wow tobetter!
Thanks for the quick response!

I'll fork your branch, apply the patches and make some PR's once I get it working.
5.4 was working great btw, but it has become a bit old for recent distro's such as Fedora 33.
Also I like to test some of the upstream changes to the exynos drm driver for Kodi, samsung is still supporting it :)

I'll keep you posted.
Thanks a lot...if you can support my breanch, I would be able to release the packages for XU4 to run Debian/Ubuntu like what I am publishing for ODROID-N2/C4/HC4.
By the way, what's the version of your Mali driver?

Looking forward your PR. :D

MastaG
Posts: 407
Joined: Mon Aug 26, 2013 6:05 pm
languages_spoken: english
Has thanked: 45 times
Been thanked: 68 times
Contact:

Re: More recent kernels lacking dma_buf_k(un)map for Mali

Post by MastaG »

tobetter wrote:
Tue Dec 22, 2020 11:15 pm
Thanks a lot...if you can support my breanch, I would be able to release the packages for XU4 to run Debian/Ubuntu like what I am publishing for ODROID-N2/C4/HC4.
By the way, what's the version of your Mali driver?

Looking forward your PR. :D
I've opened a PR which gets the kernel running on my XU3 board (should work for XU4 as well).
See: https://github.com/tobetter/linux/pull/20

I'm using the r12p wayland/gbm mali driver from ARM.
Image

It works but there's a problem with the MFC decoding H264 in Kodi using the ffmpeg v4l2m2m decoder.
It seems to display the video in slowmotion?
The kernel will spit out:

Code: Select all

[  265.676299] vidioc_try_fmt:379: Unsupported format for destination.
This doesn't occur on HK's odroid-5.4.y branch.

I'll look into it further tomorrow.
And also collect some more commits which I'll send in another PR soon.

User avatar
tobetter
Posts: 10043
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 640 times
Been thanked: 1714 times
Contact:

Re: More recent kernels lacking dma_buf_k(un)map for Mali

Post by tobetter »

@MastaG, thank you for your PR and I will look through them carefully.

One suggesion I have is that, I would like to not include Mali driver into the kernel source tree but want to have DKMS package. I made one repository for Mali DKMS earlier, not updated for long...so I will see if your patches in PR can be applied and can be built. I do remember it was r12p0 which is the same version what you are testing.

Once I finish to fix the build issue for XU4, I will share the OS image which includes your patches which saves my time a lot...
So...now it's time to resume the upstream kernel for XU4 again.

MastaG
Posts: 407
Joined: Mon Aug 26, 2013 6:05 pm
languages_spoken: english
Has thanked: 45 times
Been thanked: 68 times
Contact:

Re: More recent kernels lacking dma_buf_k(un)map for Mali

Post by MastaG »

Thank you tobetter,

The mali driver seems to work fine.
I've tested GLES on both gbm and wayland :)

But I can't figure out why the MFC is not decoding like it should.
When I boot with HK's odroid-5.4.y kernel I can launch Kodi and play my videos.
On 5.10.y it seems to decode very slowly.
And it will put:

Code: Select all

[  265.676299] vidioc_try_fmt:379: Unsupported format for destination.
It could be this commit: https://github.com/tobetter/linux/pull/ ... 2176e87b00

But it's exactly the same as upstream where they've also removed these two flags.
If I leave them, the build will error out with: DMA_ATTR_NON_CONSISTENT being undeclared..

EDIT: I see now that it was added by memeka in the first place: https://github.com/torvalds/linux/commi ... dfec0b9a76
It was cherry-picked for 5.10.y as well, but of course untested.

Any ideas?
Perhaps memeka could have a look as he did most of the MFC related commits for 5.4.

MastaG
Posts: 407
Joined: Mon Aug 26, 2013 6:05 pm
languages_spoken: english
Has thanked: 45 times
Been thanked: 68 times
Contact:

Re: Linux kernel 5.10 on XU3/4

Post by MastaG »

I've force-pushed to the PR because there were a few typos and a missing commit.
See: https://github.com/tobetter/linux/pull/20
Everything is working really good and stable.

Still I'm having a hard time finding out why my movies aren't playing at full speed like when using the HK odroid-5.4.y branch.


This is the full diff from 5.10's mfc driver to 5.4:

Code: Select all

--- odroid-5.10.y/drivers/media/platform/s5p-mfc/s5p_mfc_iommu.h	2020-12-22 18:17:45.721572998 +0100
+++ odroid-5.4.y/drivers/media/platform/s5p-mfc/s5p_mfc_iommu.h	2020-08-25 21:20:41.067009343 +0200
@@ -9,11 +9,9 @@
 
 #if defined(CONFIG_EXYNOS_IOMMU)
 
-#include <linux/iommu.h>
-
 static inline bool exynos_is_iommu_available(struct device *dev)
 {
-	return dev_iommu_priv_get(dev) != NULL;
+	return dev->archdata.iommu != NULL;
 }
 
 #else
--- odroid-5.10.y/drivers/media/platform/s5p-mfc/s5p_mfc.c	2021-01-04 14:28:36.908654895 +0100
+++ odroid-5.4.y/drivers/media/platform/s5p-mfc/s5p_mfc.c	2020-12-14 14:59:17.093317084 +0100
@@ -858,7 +858,7 @@
 	 * We'll do mostly sequential access, so sacrifice TLB efficiency for
 	 * faster allocation.
 	 */
-	q->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES | DMA_ATTR_NO_KERNEL_MAPPING;
+	q->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES | DMA_ATTR_NON_CONSISTENT | DMA_ATTR_NO_KERNEL_MAPPING;
 	q->mem_ops = &vb2_dma_contig_memops;
 	q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
 	ret = vb2_queue_init(q);
@@ -893,7 +893,7 @@
 	 * We'll do mostly sequential access, so sacrifice TLB efficiency for
 	 * faster allocation.
 	 */
-	q->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES | DMA_ATTR_NO_KERNEL_MAPPING;
+	q->dma_attrs = DMA_ATTR_ALLOC_SINGLE_PAGES | DMA_ATTR_NON_CONSISTENT | DMA_ATTR_NO_KERNEL_MAPPING;
 	q->mem_ops = &vb2_dma_contig_memops;
 	q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_COPY;
 	ret = vb2_queue_init(q);
@@ -1094,10 +1094,6 @@
 	child->coherent_dma_mask = dev->coherent_dma_mask;
 	child->dma_mask = dev->dma_mask;
 	child->release = s5p_mfc_memdev_release;
-	child->dma_parms = devm_kzalloc(dev, sizeof(*child->dma_parms),
-					GFP_KERNEL);
-	if (!child->dma_parms)
-		goto err;
 
 	/*
 	 * The memdevs are not proper OF platform devices, so in order for them
@@ -1113,7 +1109,7 @@
 			return child;
 		device_del(child);
 	}
-err:
+
 	put_device(child);
 	return NULL;
 }
@@ -1385,7 +1381,7 @@
 	s5p_mfc_init_regs(dev);
 
 	/* Register decoder and encoder */
-	ret = video_register_device(dev->vfd_dec, VFL_TYPE_VIDEO, 0);
+	ret = video_register_device(dev->vfd_dec, VFL_TYPE_GRABBER, 10);
 	if (ret) {
 		v4l2_err(&dev->v4l2_dev, "Failed to register video device\n");
 		goto err_dec_reg;
@@ -1393,7 +1389,7 @@
 	v4l2_info(&dev->v4l2_dev,
 		  "decoder registered as /dev/video%d\n", dev->vfd_dec->num);
 
-	ret = video_register_device(dev->vfd_enc, VFL_TYPE_VIDEO, 0);
+	ret = video_register_device(dev->vfd_enc, VFL_TYPE_GRABBER, 10);
 	if (ret) {
 		v4l2_err(&dev->v4l2_dev, "Failed to register video device\n");
 		goto err_enc_reg;
--- odroid-5.10.y/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c	2021-01-04 14:03:26.264961839 +0100
+++ odroid-5.4.y/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c	2020-08-25 21:20:41.067009343 +0200
@@ -262,12 +262,6 @@
 		.default_value = V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_DISABLED,
 	},
 	{
-		.id = V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE,
-		.type = V4L2_CTRL_TYPE_MENU,
-		.maximum = V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT,
-		.default_value = V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED,
-	},
-	{
 		.id = V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT,
 		.type = V4L2_CTRL_TYPE_BOOLEAN,
 		.name = "Fixed Target Bit Enable",
@@ -1864,7 +1858,6 @@
 		p->seq_hdr_mode = ctrl->val;
 		break;
 	case V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE:
-	case V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE:
 		p->frame_skip_mode = ctrl->val;
 		break;
 	case V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT:
The above diff is basically me removing DMA_ATTR_NON_CONSISTENT (as it's removed from the kernel as of 5.9)
The rest of the changes are the following commits, which makes sense to me:
media: s5p-mfc: Use standard frame skip mode control: https://github.com/MastaG/linux/commit/ ... 9e3ee90510
iommu/exynos: Use dev_iommu_priv_get/set(): https://github.com/MastaG/linux/commit/ ... 9e3ee90510
media: s5p-mfc: Properly handle dma_parms for the allocated devices: https://github.com/MastaG/linux/commit/ ... 9e3ee90510
media: media/platform: rename VFL_TYPE_GRABBER to _VIDEO: https://github.com/MastaG/linux/commit/ ... 9e3ee90510

The error: [ 265.676299] vidioc_try_fmt:379: Unsupported format for destination.

Seems to happen here in: s5p_mfc_dec.c

Code: Select all

/* Try format */
static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f)
{
        struct s5p_mfc_dev *dev = video_drvdata(file);
        struct s5p_mfc_fmt *fmt;

        mfc_debug(2, "Type is %d\n", f->type);
        if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
                fmt = find_format(f, MFC_FMT_DEC);
                if (!fmt) {
                        mfc_err("Unsupported format for source.\n");
                        return -EINVAL;
                }
                if (fmt->codec_mode == S5P_FIMV_CODEC_NONE) {
                        mfc_err("Unknown codec\n");
                        return -EINVAL;
                }
                if ((dev->variant->version_bit & fmt->versions) == 0) {
                        mfc_err("Unsupported format by this MFC version.\n");
                        return -EINVAL;
                }
        } else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
                fmt = find_format(f, MFC_FMT_RAW);
                if (!fmt) {
                        mfc_err("Unsupported format for destination.\n");
                        return -EINVAL;
                }
                if ((dev->variant->version_bit & fmt->versions) == 0) {
                        mfc_err("Unsupported format by this MFC version.\n");
                        return -EINVAL;
                }
        }

        return 0;
}
This is how the videos play using Kodi: https://streamable.com/o0foun

Now for the record, if I just reboot into HK's odroid-5.4.y kernel it will play fine. (same kodi)

@memeka or @areascout ? :D

User avatar
tobetter
Posts: 10043
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 640 times
Been thanked: 1714 times
Contact:

Re: Linux kernel 5.10 on XU3/4

Post by tobetter »

@MastaG, thank you for updating. I do not see serious issue with your branch, tested with XU4/HC* although I have not tested video play on my end. I would not merge your PR at the moment, so please keep updating your branch as you wish and I will let you know when I can merge. I am still figuring out the build server why not building for XU4 and wish to finish by end of this week.

Thanks.

EDIT: Ok, finally I think I figured out why Linux package for XU4 is broken...probably I would be able to build prebuilt OS image sometime this week and I can merge your branch. Let me update you again.

MastaG
Posts: 407
Joined: Mon Aug 26, 2013 6:05 pm
languages_spoken: english
Has thanked: 45 times
Been thanked: 68 times
Contact:

Re: Linux kernel 5.10 on XU3/4

Post by MastaG »

@tobetter that's OK.

I've did some testing and I can confirm everything works so far.
- loading edid firmware blobs for setting video output without a connected monitor
- hdmi audio
- analog audio on the XU3 (headphone jack)
- Gnome on wayland using GLES
- RetroArch with flycast

So the mali driver definitely works.

Still for the MFC decoding I could need some help ;)

AreaScout
Posts: 1824
Joined: Sun Jul 07, 2013 3:05 am
languages_spoken: german, english
ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
N1, Go, VU5A, Show2, CloudShell2,
H2, N2, VU7A, VuShell, Go2, C4
Has thanked: 128 times
Been thanked: 381 times
Contact:

Re: Linux kernel 5.10 on XU3/4

Post by AreaScout »

    @MastaG

    What about Kodi Matrix on kernel 5.10, are those EGL errors (GEM buffer empty) still there ? I was trying to track down the problem on 5.4 kernel and Kodi Matrix but I have to say that this is not easy to find, I tried several things on GBM/DRM code but none of then worked, however one try was giving me more time to browse the menu it crashed Kodi much later, now I am busy with Go Super but it's GEM buffer obtained and not free, if it's working with 5.10 maybe it's 5.4 kernel side

    RG

    chewitt
    Posts: 179
    Joined: Mon Aug 12, 2019 12:27 pm
    languages_spoken: english
    Has thanked: 3 times
    Been thanked: 132 times
    Contact:

    Re: Linux kernel 5.10 on XU3/4

    Post by chewitt »

    Just an FYI, the panfrost driver still fails with Kodi on XU4. I can run kmcube and some other things fine, but Kodi causes a lock-up shortly after the GUI starts and I've not been able to get a backtrace or anything usable to feed to the panfrost devs; partly because I'm a coding n00b and have no real clue about that kind of thing. If anyone more competent can get a Kodi debug build running to acquire that info it would be good (no blobs would be great).

    I'm also interested in the 5.10+ patchset .. I've got 5.11-rc2 running on a board for poking but I'm not so familar with the Exynos platform.
    These users thanked the author chewitt for the post:
    AreaScout (Wed Jan 06, 2021 6:39 pm)

    MastaG
    Posts: 407
    Joined: Mon Aug 26, 2013 6:05 pm
    languages_spoken: english
    Has thanked: 45 times
    Been thanked: 68 times
    Contact:

    Re: Linux kernel 5.10 on XU3/4

    Post by MastaG »

    @AreaScout
    The kodi gbm freeze with the latest git happens on both 5.4 and 5.10 kernel.
    I think they simply adapted too much to recent kms/drm or mesa changes, causing something weird in the mali kernel or userspace drivers.
    When I have some more time, I'll try to bisect the problem (only Kodi is painfully slow to build on the XU4).
    Also keep in mind that I'm using the exact same (outdated) mali kernel and userspace drivers in 5.10 as it is in 5.4.

    The only difference is that in 5.10 the mfc also stopped to decode properly when running kodi in a wayland session (which still works as opposed to the gbm build).

    @chewitt
    I've already checked out your kernel tree (great job!) for 5.10 and also merged the mali kernel driver (like I did for tobetter's PR).
    But the mfc decoding problem remains :(

    Also I've tried Panfrost like 6 months ago by compiling a mesa snapshot.
    While I didn't try kodi, I got it to run Gnome desktop on wayland.
    But there were many flickering black artifacts on the screen.
    I've asked the Panfrost devs (Alyssa Rosenzweig), but they have no plans to support the the XU4 mali GPU because it's very old and contains many silicon bugs.
    Also I don't like the lack of documentation for Panfrost.
    For example, the Panfrost kernel driver doesn't initialize my HDMI output like the exynos drm.
    And the mesa Panfrost userspace drivers are not compatible with the exynos kernel driver either.. I was getting all sorts of errors related to the userspace driver trying to do stuff that the exynos driver does not handle.

    It would be nice if someone would just post patches for the kernel and for mesa to try out Panfrost without requiring the exynos drm driver.
    That's why I'm still relying on the old mali blobs which get harder to maintain when all applications start relying on more recent kernel and mesa changes... Let alone adapting the mali kernel driver everytime.

    And for the record, I'm also not a coder.. just some very basic C skills here..

    I think if we can fix the kodi gbm freeze and get the mfc to play nice on linux 5.10, we can do a final round of modern distro's with kodi 19 before we can lay our XU4's to rest ;)
    These users thanked the author MastaG for the post:
    AreaScout (Wed Jan 06, 2021 6:40 pm)

    chewitt
    Posts: 179
    Joined: Mon Aug 12, 2019 12:27 pm
    languages_spoken: english
    Has thanked: 3 times
    Been thanked: 132 times
    Contact:

    Re: Linux kernel 5.10 on XU3/4

    Post by chewitt »

    I'm still working on the panfrost devs. T628 is the same silicon generation as T720 which is supported, but there are still some bits of the panfrost driver missing and "errata" (bugs in arm-speak) to code around. Since the latest batch of code dropped bringing GLES 3.0 support kmscube went from "works, but crashy" to "works perfectly" so I'm hopefull some other missing bits might close the gap once included. I'm also owed a few favours after persuading the devs to work on bifrost and making the intro to ARM that ultimately led to support :) .. IMHO the biggest issue for T628 is not documentation (which they have now) or lack of commercial interest (there is none) but more they are easily distracted with other things that are just more fun than coding workarounds for errata.

    To support the MFC in K19+ "properly" this will be required https://patchwork.kernel.org/project/li ... msung.com/ but there are some conflicting changes (bitrot) so it needs reworking to be mergeable/usable, and then I've been told it needs adaptation to support 5422.
    These users thanked the author chewitt for the post (total 2):
    AreaScout (Wed Jan 06, 2021 6:39 pm) • MastaG (Wed Jan 06, 2021 11:20 pm)

    MastaG
    Posts: 407
    Joined: Mon Aug 26, 2013 6:05 pm
    languages_spoken: english
    Has thanked: 45 times
    Been thanked: 68 times
    Contact:

    Re: Linux kernel 5.10 on XU3/4

    Post by MastaG »

    chewitt wrote:
    Wed Jan 06, 2021 2:25 pm
    I'm still working on the panfrost devs. T628 is the same silicon generation as T720 which is supported, but there are still some bits of the panfrost driver missing and "errata" (bugs in arm-speak) to code around. Since the latest batch of code dropped bringing GLES 3.0 support kmscube went from "works, but crashy" to "works perfectly" so I'm hopefull some other missing bits might close the gap once included. I'm also owed a few favours after persuading the devs to work on bifrost and making the intro to ARM that ultimately led to support :) .. IMHO the biggest issue for T628 is not documentation (which they have now) or lack of commercial interest (there is none) but more they are easily distracted with other things that are just more fun than coding workarounds for errata.

    To support the MFC in K19+ "properly" this will be required https://patchwork.kernel.org/project/li ... msung.com/ but there are some conflicting changes (bitrot) so it needs reworking to be mergeable/usable, and then I've been told it needs adaptation to support 5422.
    That's very good news regarding Panfrost support.
    If you have some time in the future, perhaps you could do a small post here with the details on which kernel and mesa patches are required to get Panfrost running on the XU4 :)

    Regarding Kodi, I've built todays git from master branch and ffmpeg as well.
    I've attached the patches I've applied to Kodi and ffmpeg. (only minimal changes)
    Still I only run it on Wayland because the gbm build is still freezing up on both linux 5.4 and 5.10:

    Code: Select all

    2021-01-06 14:41:09.388 T:28682   ERROR <general>: eglSwapBuffers failed (EGL_BAD_ALLOC)
    [10473.947124] exynos-mixer 14450000.mixer: [drm:exynos_drm_gem_create] *ERROR* failed to allocate buffer.
    [10473.955161] exynos-drm exynos-drm: FB allocation failed.
    [10473.967811] exynos-mixer 14450000.mixer: [drm:exynos_drm_gem_create] *ERROR* failed to allocate buffer.
    [10473.975844] exynos-drm exynos-drm: FB allocation failed.
    I remember it was working even after they rewrote the gbm code, it must be a recent change causing this.
    Will continue to look for the offending commit.

    Regarding the MFC decoding issue, it seems I was wrong about the message: "vidioc_try_fmt:379: Unsupported format for destination"
    This message happens on both 5.4 and 5.10 when playing h264 video's in Kodi on wayland.
    Still on 5.4 the videos play at full speed: https://streamable.com/w69bv4
    But on 5.10 they play in slow motion: https://streamable.com/u8weqv

    I'll look into the exynos patchset you posted, if the existing code didn't change too much, perhaps I can get it to apply and build :)
    Attachments
    kodi19.patch.zip
    (2.37 KiB) Downloaded 81 times
    ffmpeg.patch.zip
    (958 Bytes) Downloaded 68 times
    These users thanked the author MastaG for the post (total 3):
    tobetter (Wed Jan 06, 2021 11:50 pm) • odroid (Thu Jan 07, 2021 9:58 am) • AreaScout (Thu Jan 07, 2021 11:52 pm)

    AreaScout
    Posts: 1824
    Joined: Sun Jul 07, 2013 3:05 am
    languages_spoken: german, english
    ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
    N1, Go, VU5A, Show2, CloudShell2,
    H2, N2, VU7A, VuShell, Go2, C4
    Has thanked: 128 times
    Been thanked: 381 times
    Contact:

    Re: Linux kernel 5.10 on XU3/4

    Post by AreaScout »

    MastaG wrote:
    Wed Jan 06, 2021 11:48 pm
    I'll look into the exynos patchset you posted, if the existing code didn't change too much, perhaps I can get it to apply and build :)
    That would be cool because if I understand it right that patch would bring NV12 plane support which at the end would give us DRM Prime support, no patches for DVDVideoCodecFFmpeg.cpp would be need anymore, am I right ?

    RG

    MastaG
    Posts: 407
    Joined: Mon Aug 26, 2013 6:05 pm
    languages_spoken: english
    Has thanked: 45 times
    Been thanked: 68 times
    Contact:

    Re: Linux kernel 5.10 on XU3/4

    Post by MastaG »

    AreaScout wrote:
    Thu Jan 07, 2021 11:52 pm
    MastaG wrote:
    Wed Jan 06, 2021 11:48 pm
    I'll look into the exynos patchset you posted, if the existing code didn't change too much, perhaps I can get it to apply and build :)
    That would be cool because if I understand it right that patch would bring NV12 plane support which at the end would give us DRM Prime support, no patches for DVDVideoCodecFFmpeg.cpp would be need anymore, am I right ?

    RG
    I'm not familiar with the drm prime path.. would that automatically trigger decoding of the PES using the MFC as well? or is it only for rendering the decoded frames?
    Also keep in mind I'm not so much of a C programmer, but I'll try my best :D

    AreaScout
    Posts: 1824
    Joined: Sun Jul 07, 2013 3:05 am
    languages_spoken: german, english
    ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
    N1, Go, VU5A, Show2, CloudShell2,
    H2, N2, VU7A, VuShell, Go2, C4
    Has thanked: 128 times
    Been thanked: 381 times
    Contact:

    Re: Linux kernel 5.10 on XU3/4

    Post by AreaScout »

      What is PES ?
      MastaG wrote:
      Fri Jan 08, 2021 12:19 am
      or is it only for rendering the decoded frames?
      Yes it is rendering the decoded frame, from MFC we get a NV12 frame and because we can't pass it directly to a drm plane (no NV12 color support, only ARGB and XRGB) we color convert it with shaders to ARGB and then pass it to VOP (EGL Swap), but ! if we have a DRM plane with NV12 support due to a HW color conversation with GSCALER we would be able to take the NV12 frame from the decoder and move it directly to the VOP (video output processor) using kodi's DRMPrime backend

      RG

      chewitt
      Posts: 179
      Joined: Mon Aug 12, 2019 12:27 pm
      languages_spoken: english
      Has thanked: 3 times
      Been thanked: 132 times
      Contact:

      Re: Linux kernel 5.10 on XU3/4

      Post by chewitt »

      This is my 5.11.y branch https://github.com/chewitt/linux/commits/samsung-5.11.y it contains the same not-quite-upstream panfrost patches as my Amlogic branch. I can get kmscube to work, but Kodi faults on startup.

      For K19 to work you might need these enabling in defconfig:

      CONFIG_DMABUF_HEAPS=y
      CONFIG_DMABUF_HEAPS_SYSTEM=y
      CONFIG_DMABUF_HEAPS_CMA=y

      @AreaScout, you understand that patch series correctly, but I was told there is more needed to get it working with 5422 (which is largely undocumented). It's the correct direction to push things though.
      These users thanked the author chewitt for the post:
      AreaScout (Sat Jan 09, 2021 1:02 am)

      User avatar
      tobetter
      Posts: 10043
      Joined: Mon Feb 25, 2013 10:55 am
      languages_spoken: Korean, English
      ODROIDs: Many
      Location: Paju, South Korea
      Has thanked: 640 times
      Been thanked: 1714 times
      Contact:

      Re: Linux kernel 5.10 on XU3/4

      Post by tobetter »

      I finally made a server image of Ubuntu 20.04 with Linux kernel 5.10 that can boot from ODROID-XU4/HC1/HC2. Download think a quick installation guide is also uploaded.
      https://docs.linuxfactory.or.kr/install ... image.html

      Code: Select all

      Ubuntu 20.04.1 LTS focal-server ttySAC2
      
      focal-server login: odroid
      Password: 
      Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.10.0-odroid-armmp armv7l)
      
       * Documentation:  https://help.ubuntu.com
       * Management:     https://landscape.canonical.com
       * Support:        https://ubuntu.com/advantage
       _   _               _ _                        _ 
      | | | | __ _ _ __ __| | | _____ _ __ _ __   ___| |
      | |_| |/ _` | '__/ _` | |/ / _ \ '__| '_ \ / _ \ |
      |  _  | (_| | | | (_| |   <  __/ |  | | | |  __/ |
      |_| |_|\__,_|_|  \__,_|_|\_\___|_|  |_| |_|\___|_|
                                                        
        ___      _           _     _  __  ___   _ _  _   
       / _ \  __| |_ __ ___ (_) __| | \ \/ / | | | || |  
      | | | |/ _` | '__/ _ \| |/ _` |  \  /| | | | || |_ 
      | |_| | (_| | | | (_) | | (_| |  /  \| |_| |__   _|
       \___/ \__,_|_|  \___/|_|\__,_| /_/\_\\___/   |_|  
                                                         
      
      Welcome to Ubuntu 20.04.1 LTS
      Monday, 11 January 2021, 12:48:45 PM
      Up time:     0 days, 00:23:07
      Free memory: 1737584 / 2039528 kB
      IP:          192.168.0.131
      
      [!] Please visit 'https://launchpad.net/odroid-image' to report a bug
      Last login: Wed Apr  1 17:23:57 UTC 2020 on ttySAC2
      
      odroid@focal-server:~$ uname -a
      Linux focal-server 5.10.0-odroid-armmp #1 SMP PREEMPT Ubuntu 5.10.5-202101081935~focal (2021-01-08) armv7l armv7l armv7l GNU/Linux
      
      Since the new image need to use newer U-boot (still old but newer than stock Hardkernel U-boot), you need to replace the boot loader in eMMC memory card before flashing the new OS image. SD card does not have any issue to flash the image and boot from it.

      @MastaG, I've merged your two commits to kernel branch but not merged the Mali driver patches since I am going to manage a dkms package for Mali driver and your change will be merged and provided as a package later probably in this week. :)

      AdrianB
      Posts: 18
      Joined: Thu Aug 31, 2017 5:03 am
      languages_spoken: english
      ODROIDs: C2
      XU4
      Has thanked: 4 times
      Been thanked: 2 times
      Contact:

      Re: Linux kernel 5.10 on XU3/4

      Post by AdrianB »

      Hello all!

      Thanks to @odroid for pointing me to this thread.
      These days I was able to port the Mali Midgard OpenSource r28p0 to Linux 5.6 and later. I've was able to compile it on 5.4, 5.9 and 5.10 on my Odroid XU4. I've created also a list of what issues I've found. Also I've notice that somebody faced the same issue with dma_buf_kmap and dma_buf_kunmap functions that were removed starting with Kernel 5.6. I've adapt my code to try to use dma_buf_vmap, but I'm not a expert programmer and I don't know if is working properly. Otherwise I will try to use the idea from @tobetter - mali_r24p0.diff.txt

      Know my issue is this: the module is compiling well under all kernels but when I'm loading it is not detecting any Mali GPU :(. Before loading mali_kbase module I removed the panfrost module, which surprisingly is detecting my GPU correctly.

      Here is my experimental mali-midgard r28p0 driver:
      https://github.com/EasyNetDev/mali-midgard

      Now I'm trying "tobetter" kernel 5.10.6 using PR #20 but it gave me plenty of missing symbols:

      Code: Select all

      ERROR: modpost: "kbase_reg_write" [drivers/gpu/arm/midgard/tests/mali_kutf_irq_test/mali_kutf_irq_test.ko] undefined!
      ERROR: modpost: "kbase_set_custom_irq_handler" [drivers/gpu/arm/midgard/tests/mali_kutf_irq_test/mali_kutf_irq_test.ko] undefined!
      ERROR: modpost: "kbase_pm_context_active" [drivers/gpu/arm/midgard/tests/mali_kutf_irq_test/mali_kutf_irq_test.ko] undefined!
      ERROR: modpost: "kbase_pm_context_idle" [drivers/gpu/arm/midgard/tests/mali_kutf_irq_test/mali_kutf_irq_test.ko] undefined!
      ERROR: modpost: "kbase_reg_read" [drivers/gpu/arm/midgard/tests/mali_kutf_irq_test/mali_kutf_irq_test.ko] undefined!
      ERROR: modpost: "kbase_gpu_irq_handler" [drivers/gpu/arm/midgard/tests/mali_kutf_irq_test/mali_kutf_irq_test.ko] undefined!
      ERROR: modpost: "mm_trace_rss_stat" [drivers/gpu/arm/midgard/mali_kbase.ko] undefined!
      
      At least the last one "mm_trace_rss_stat" is related to

      Code: Select all

      add_mm_counter(mm, MM_FILEPAGES, pages);
      function which it can be replaced, with backwards compatibility, with this:

      Code: Select all

      #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0))
                      add_mm_counter(mm, MM_FILEPAGES, pages);
      #else
                      atomic_long_add(pages, &mm->rss_stat.count[MM_FILEPAGES]);
      #endif
      
      The rest of the symbols I didn't take a look yet, but seems that are from the driver itself.

      Is suppose to be something else that I need for the driver to be able to find my GPU? I'm struggling to make this GPU to work for a while and it's annoying me :).

      User avatar
      tobetter
      Posts: 10043
      Joined: Mon Feb 25, 2013 10:55 am
      languages_spoken: Korean, English
      ODROIDs: Many
      Location: Paju, South Korea
      Has thanked: 640 times
      Been thanked: 1714 times
      Contact:

      Re: Linux kernel 5.10 on XU3/4

      Post by tobetter »

      @AdrianB, if my understanding is correct, you are porting Mali r28p0 driver and which is not tested with ODROID-XU4 yet?

      User avatar
      odroid
      Site Admin
      Posts: 39238
      Joined: Fri Feb 22, 2013 11:14 pm
      languages_spoken: English, Korean
      ODROIDs: ODROID
      Has thanked: 2565 times
      Been thanked: 1407 times
      Contact:

      Re: Linux kernel 5.10 on XU3/4

      Post by odroid »

      @AdrianB,
      Where did you obtain a Mali-T628 compatible r28p0 user land driver .so file?

      MastaG
      Posts: 407
      Joined: Mon Aug 26, 2013 6:05 pm
      languages_spoken: english
      Has thanked: 45 times
      Been thanked: 68 times
      Contact:

      Re: Linux kernel 5.10 on XU3/4

      Post by MastaG »

      chewitt wrote:
      Fri Jan 08, 2021 8:08 pm
      This is my 5.11.y branch https://github.com/chewitt/linux/commits/samsung-5.11.y it contains the same not-quite-upstream panfrost patches as my Amlogic branch. I can get kmscube to work, but Kodi faults on startup.

      For K19 to work you might need these enabling in defconfig:

      CONFIG_DMABUF_HEAPS=y
      CONFIG_DMABUF_HEAPS_SYSTEM=y
      CONFIG_DMABUF_HEAPS_CMA=y

      @AreaScout, you understand that patch series correctly, but I was told there is more needed to get it working with 5422 (which is largely undocumented). It's the correct direction to push things though.
      I have these enabled in my config already.
      It's just that playback of H264 videos seems slowed down on 5.10 vs 5.4.
      But then again I was only able to test it on Kodi on Wayland (as Kodi on GBM still crashes).
      AdrianB wrote:
      Tue Jan 12, 2021 4:43 am
      Hello all!

      Thanks to @odroid for pointing me to this thread.
      These days I was able to port the Mali Midgard OpenSource r28p0 to Linux 5.6 and later. I've was able to compile it on 5.4, 5.9 and 5.10 on my Odroid XU4. I've created also a list of what issues I've found. Also I've notice that somebody faced the same issue with dma_buf_kmap and dma_buf_kunmap functions that were removed starting with Kernel 5.6. I've adapt my code to try to use dma_buf_vmap, but I'm not a expert programmer and I don't know if is working properly. Otherwise I will try to use the idea from @tobetter - mali_r24p0.diff.txt

      Know my issue is this: the module is compiling well under all kernels but when I'm loading it is not detecting any Mali GPU :(. Before loading mali_kbase module I removed the panfrost module, which surprisingly is detecting my GPU correctly.

      Here is my experimental mali-midgard r28p0 driver:
      https://github.com/EasyNetDev/mali-midgard

      Now I'm trying "tobetter" kernel 5.10.6 using PR #20 but it gave me plenty of missing symbols:

      Code: Select all

      ERROR: modpost: "kbase_reg_write" [drivers/gpu/arm/midgard/tests/mali_kutf_irq_test/mali_kutf_irq_test.ko] undefined!
      ERROR: modpost: "kbase_set_custom_irq_handler" [drivers/gpu/arm/midgard/tests/mali_kutf_irq_test/mali_kutf_irq_test.ko] undefined!
      ERROR: modpost: "kbase_pm_context_active" [drivers/gpu/arm/midgard/tests/mali_kutf_irq_test/mali_kutf_irq_test.ko] undefined!
      ERROR: modpost: "kbase_pm_context_idle" [drivers/gpu/arm/midgard/tests/mali_kutf_irq_test/mali_kutf_irq_test.ko] undefined!
      ERROR: modpost: "kbase_reg_read" [drivers/gpu/arm/midgard/tests/mali_kutf_irq_test/mali_kutf_irq_test.ko] undefined!
      ERROR: modpost: "kbase_gpu_irq_handler" [drivers/gpu/arm/midgard/tests/mali_kutf_irq_test/mali_kutf_irq_test.ko] undefined!
      ERROR: modpost: "mm_trace_rss_stat" [drivers/gpu/arm/midgard/mali_kbase.ko] undefined!
      
      At least the last one "mm_trace_rss_stat" is related to

      Code: Select all

      add_mm_counter(mm, MM_FILEPAGES, pages);
      function which it can be replaced, with backwards compatibility, with this:

      Code: Select all

      #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0))
                      add_mm_counter(mm, MM_FILEPAGES, pages);
      #else
                      atomic_long_add(pages, &mm->rss_stat.count[MM_FILEPAGES]);
      #endif
      
      The rest of the symbols I didn't take a look yet, but seems that are from the driver itself.

      Is suppose to be something else that I need for the driver to be able to find my GPU? I'm struggling to make this GPU to work for a while and it's annoying me :).
      Thanks for also looking into the mali driver on 5.10 ! :)
      I'm not getting these missing symbols, did you make sure that both commits have been applied? (as tobetter didn't commit them)
      https://github.com/tobetter/linux/pull/ ... 171c1b9093
      https://github.com/tobetter/linux/pull/ ... 34177c23a6
      Or perhaps there's something missing in your config.

      I've attached the two commits and my config below.
      Attachments
      mali.zip
      (472.57 KiB) Downloaded 82 times
      config-5.10.zip
      (43.83 KiB) Downloaded 78 times

      AreaScout
      Posts: 1824
      Joined: Sun Jul 07, 2013 3:05 am
      languages_spoken: german, english
      ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
      N1, Go, VU5A, Show2, CloudShell2,
      H2, N2, VU7A, VuShell, Go2, C4
      Has thanked: 128 times
      Been thanked: 381 times
      Contact:

      Re: Linux kernel 5.10 on XU3/4

      Post by AreaScout »

      @chewitt @MastaG

      I have enabled DMA and UDMA buf but still Kodi crashes, anything else I have to apply ?

      Code: Select all

      #
      # DMABUF options
      #
      CONFIG_SYNC_FILE=y
      # CONFIG_SW_SYNC is not set
      CONFIG_UDMABUF=y
      CONFIG_DMABUF_HEAPS=y
      CONFIG_DMABUF_HEAPS_SYSTEM=y
      CONFIG_DMABUF_HEAPS_CMA=y
      # CONFIG_DMABUF_SELFTESTS is not set
      # end of DMABUF options
      
      RG

      AdrianB
      Posts: 18
      Joined: Thu Aug 31, 2017 5:03 am
      languages_spoken: english
      ODROIDs: C2
      XU4
      Has thanked: 4 times
      Been thanked: 2 times
      Contact:

      Re: Linux kernel 5.10 on XU3/4

      Post by AdrianB »

      Hi guys,

      Because I'm pretty new in Mali drivers and user space binaries, I'm trying to understand how these 2 are working (Kernel Driver & User Space Binaries). After a research I've found this link: http://linux-exynos.org/wiki/Mali_drivers where is mention that actually I need to match the kernel driver with user space version. These are very new facts for me.
      From here I can understand the driver r28p0 is completely useless on Android.
      The latest version of user binaries for Odroid XU3 are malit62xr12p004rel0. There is another version: malit62xr10p000rel0.

      Now I'm trying to make it work @tobetter kernel with user space binaries, but I'm notice this:

      Code: Select all

      [    2.853594] mali 11800000.gpu: GPU identified as 0x0620 r0p1 status 0
      [    2.853927] mali 11800000.gpu: Protected mode not available
      [    2.854627] mali 11800000.gpu: Probed as mali0
      
      I don't understand if r0p1 is Odroid XU3/XU4 hardware version (as I've found on Mali Driver site) or is the driver version.
      What binaries I must use with this driver?
      Sorry for these confusions, but this ARM device gave me headaches to make the hardware acceleration.

      Adrian

      AdrianB
      Posts: 18
      Joined: Thu Aug 31, 2017 5:03 am
      languages_spoken: english
      ODROIDs: C2
      XU4
      Has thanked: 4 times
      Been thanked: 2 times
      Contact:

      Re: Linux kernel 5.10 on XU3/4

      Post by AdrianB »

      Hi MastaG,

      These symbols missing complains are only when you build the driver as module. Is a headache to build it as module. If I'm integrating it into the kernel I was able to build it.
      Now I've notice plenty of warnings. After your PR it will be pushed to the main source, I will add some additional cosmetic patches to avoid all these warnings. I did it for r28p0, which seems to be totally useless for Odroid XU4.

      What user-space binaries I have to use with X11 to make this GPU working?
      MastaG wrote:
      Tue Jan 12, 2021 6:44 pm
      chewitt wrote:
      Fri Jan 08, 2021 8:08 pm
      This is my 5.11.y branch https://github.com/chewitt/linux/commits/samsung-5.11.y it contains the same not-quite-upstream panfrost patches as my Amlogic branch. I can get kmscube to work, but Kodi faults on startup.

      For K19 to work you might need these enabling in defconfig:

      CONFIG_DMABUF_HEAPS=y
      CONFIG_DMABUF_HEAPS_SYSTEM=y
      CONFIG_DMABUF_HEAPS_CMA=y

      @AreaScout, you understand that patch series correctly, but I was told there is more needed to get it working with 5422 (which is largely undocumented). It's the correct direction to push things though.
      I have these enabled in my config already.
      It's just that playback of H264 videos seems slowed down on 5.10 vs 5.4.
      But then again I was only able to test it on Kodi on Wayland (as Kodi on GBM still crashes).
      AdrianB wrote:
      Tue Jan 12, 2021 4:43 am
      Hello all!

      Thanks to @odroid for pointing me to this thread.
      These days I was able to port the Mali Midgard OpenSource r28p0 to Linux 5.6 and later. I've was able to compile it on 5.4, 5.9 and 5.10 on my Odroid XU4. I've created also a list of what issues I've found. Also I've notice that somebody faced the same issue with dma_buf_kmap and dma_buf_kunmap functions that were removed starting with Kernel 5.6. I've adapt my code to try to use dma_buf_vmap, but I'm not a expert programmer and I don't know if is working properly. Otherwise I will try to use the idea from @tobetter - mali_r24p0.diff.txt

      Know my issue is this: the module is compiling well under all kernels but when I'm loading it is not detecting any Mali GPU :(. Before loading mali_kbase module I removed the panfrost module, which surprisingly is detecting my GPU correctly.

      Here is my experimental mali-midgard r28p0 driver:
      https://github.com/EasyNetDev/mali-midgard

      Now I'm trying "tobetter" kernel 5.10.6 using PR #20 but it gave me plenty of missing symbols:

      Code: Select all

      ERROR: modpost: "kbase_reg_write" [drivers/gpu/arm/midgard/tests/mali_kutf_irq_test/mali_kutf_irq_test.ko] undefined!
      ERROR: modpost: "kbase_set_custom_irq_handler" [drivers/gpu/arm/midgard/tests/mali_kutf_irq_test/mali_kutf_irq_test.ko] undefined!
      ERROR: modpost: "kbase_pm_context_active" [drivers/gpu/arm/midgard/tests/mali_kutf_irq_test/mali_kutf_irq_test.ko] undefined!
      ERROR: modpost: "kbase_pm_context_idle" [drivers/gpu/arm/midgard/tests/mali_kutf_irq_test/mali_kutf_irq_test.ko] undefined!
      ERROR: modpost: "kbase_reg_read" [drivers/gpu/arm/midgard/tests/mali_kutf_irq_test/mali_kutf_irq_test.ko] undefined!
      ERROR: modpost: "kbase_gpu_irq_handler" [drivers/gpu/arm/midgard/tests/mali_kutf_irq_test/mali_kutf_irq_test.ko] undefined!
      ERROR: modpost: "mm_trace_rss_stat" [drivers/gpu/arm/midgard/mali_kbase.ko] undefined!
      
      At least the last one "mm_trace_rss_stat" is related to

      Code: Select all

      add_mm_counter(mm, MM_FILEPAGES, pages);
      function which it can be replaced, with backwards compatibility, with this:

      Code: Select all

      #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0))
                      add_mm_counter(mm, MM_FILEPAGES, pages);
      #else
                      atomic_long_add(pages, &mm->rss_stat.count[MM_FILEPAGES]);
      #endif
      
      The rest of the symbols I didn't take a look yet, but seems that are from the driver itself.

      Is suppose to be something else that I need for the driver to be able to find my GPU? I'm struggling to make this GPU to work for a while and it's annoying me :).
      Thanks for also looking into the mali driver on 5.10 ! :)
      I'm not getting these missing symbols, did you make sure that both commits have been applied? (as tobetter didn't commit them)
      https://github.com/tobetter/linux/pull/ ... 171c1b9093
      https://github.com/tobetter/linux/pull/ ... 34177c23a6
      Or perhaps there's something missing in your config.

      I've attached the two commits and my config below.

      MastaG
      Posts: 407
      Joined: Mon Aug 26, 2013 6:05 pm
      languages_spoken: english
      Has thanked: 45 times
      Been thanked: 68 times
      Contact:

      Re: Linux kernel 5.10 on XU3/4

      Post by MastaG »

      AreaScout wrote:
      Tue Jan 12, 2021 10:27 pm
      @chewitt @MastaG

      I have enabled DMA and UDMA buf but still Kodi crashes, anything else I have to apply ?

      Code: Select all

      #
      # DMABUF options
      #
      CONFIG_SYNC_FILE=y
      # CONFIG_SW_SYNC is not set
      CONFIG_UDMABUF=y
      CONFIG_DMABUF_HEAPS=y
      CONFIG_DMABUF_HEAPS_SYSTEM=y
      CONFIG_DMABUF_HEAPS_CMA=y
      # CONFIG_DMABUF_SELFTESTS is not set
      # end of DMABUF options
      
      RG
      Hi for the record, I wasn't able to solve the crash when building Kodi (from master git) for GBM platform.
      The freeze/segfault is unrelated to the kernel version and happens on both 5.4 and 5.10.

      The issue I was facing was regarding slow playback when running Kodi on the Wayland platform (on Gnome Desktop session), which only happens in kernel 5.10 while on 5.4 it plays perfectly fine.

      AreaScout
      Posts: 1824
      Joined: Sun Jul 07, 2013 3:05 am
      languages_spoken: german, english
      ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
      N1, Go, VU5A, Show2, CloudShell2,
      H2, N2, VU7A, VuShell, Go2, C4
      Has thanked: 128 times
      Been thanked: 381 times
      Contact:

      Re: Linux kernel 5.10 on XU3/4

      Post by AreaScout »

        @MastaG

        🍀🍀🍀

        Ok yesterday I had the time and motivation to search more for that drm:exynos_drm_gem_create error beside doing projects on ODROID C4 and Go Super, I was successful in finding the problem please have a look at the patch attached, also there are some news on a gbm wrappper which prevents patching software using gbm_bo_map, gbm modifiers and others, Rockchip wrotes a gbm wrapper which can also be used with our binary blobs for the XU4, clone this repository https://github.com/rockchip-linux/libmali build it, delete your symbolic links to libgbm.so and copy over the new generated libgbm.so from Rockchip after that you don't need the corresponding patches for Kodi anymore :)
          GEM_empty_fix.zip
          (665 Bytes) Downloaded 89 times
          RG
          These users thanked the author AreaScout for the post:
          MastaG (Tue Jan 19, 2021 5:29 pm)

          AreaScout
          Posts: 1824
          Joined: Sun Jul 07, 2013 3:05 am
          languages_spoken: german, english
          ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
          N1, Go, VU5A, Show2, CloudShell2,
          H2, N2, VU7A, VuShell, Go2, C4
          Has thanked: 128 times
          Been thanked: 381 times
          Contact:

          Re: Linux kernel 5.10 on XU3/4

          Post by AreaScout »

            @chewitt

            Back in 2018 I think, memeka and I tested the integration of GSCALER in FFmpeg DRMPrime, some thing I remember was when using GSCALER + VPU, the VPU only was able to do 30fps video, so it was limited by the GSCALER as far as I can remember, normally the VPU is able to do 1080p60, I don't know if the new solution inside the kernel is better but it might be that both of them (VPU and GSCALER) at the same time wont work very well, but I could be wrong

            RG

            User avatar
            tobetter
            Posts: 10043
            Joined: Mon Feb 25, 2013 10:55 am
            languages_spoken: Korean, English
            ODROIDs: Many
            Location: Paju, South Korea
            Has thanked: 640 times
            Been thanked: 1714 times
            Contact:

            Re: Linux kernel 5.10 on XU3/4

            Post by tobetter »

            New base image with 5.10 kernel has been uploaded.
            http://ppa.linuxfactory.or.kr/images/ra ... 118.img.xz

            ARM Mali T62X Wayland driver can be installed using the commands.

            Code: Select all

            $ sudo apt update
            $ sudo apt install mali-midgard-dkms mali-t62x-wayland-driver
            $ sudo reboot
            
            KMSCUBE has been tested, but Ubuntu GNOME Desktop with Wayland Session cannot be enabled.
            These users thanked the author tobetter for the post:
            MastaG (Fri Jan 22, 2021 9:13 pm)

            MastaG
            Posts: 407
            Joined: Mon Aug 26, 2013 6:05 pm
            languages_spoken: english
            Has thanked: 45 times
            Been thanked: 68 times
            Contact:

            Re: Linux kernel 5.10 on XU3/4

            Post by MastaG »

            AreaScout wrote:
            Sat Jan 16, 2021 4:07 pm
              @MastaG

              🍀🍀🍀

              Ok yesterday I had the time and motivation to search more for that drm:exynos_drm_gem_create error beside doing projects on ODROID C4 and Go Super, I was successful in finding the problem please have a look at the patch attached, also there are some news on a gbm wrappper which prevents patching software using gbm_bo_map, gbm modifiers and others, Rockchip wrotes a gbm wrapper which can also be used with our binary blobs for the XU4, clone this repository https://github.com/rockchip-linux/libmali build it, delete your symbolic links to libgbm.so and copy over the new generated libgbm.so from Rockchip after that you don't need the corresponding patches for Kodi anymore :)
                GEM_empty_fix.zip

                RG
                That's great news!
                Thanks for your hard work finding the leak!

                I've now built Kodi gbm with your gem-release patch and without disabling gbm bo_map/unmap, I've attached it.

                I've also built and installed libmali against the Odroid XU3 T62x by changing:

                Code: Select all

                diff --git a/meson_options.txt b/meson_options.txt
                index 8b2f44b..17ca8ed 100644
                --- a/meson_options.txt
                +++ b/meson_options.txt
                @@ -1,13 +1,13 @@
                 option('arch', type: 'combo', choices: ['auto', 'arm', 'armv7l', 'armhf', 'arm32', 'armv8', 'arm64', 'aarch64'],
                        description: 'arch (default: auto)')
                -option('gpu', type: 'string', value: 'midgard-t86x',
                -       description: 'GPU name (default: midgard-t86x)')
                -option('version', type: 'string', value: 'r18p0',
                -       description: 'GPU version (default: r18p0)')
                +option('gpu', type: 'string', value: 'midgard-t62x',
                +       description: 'GPU name (default: midgard-t62x)')
                +option('version', type: 'string', value: 'r12p0',
                +       description: 'GPU version (default: r12p0)')
                 option('subversion', type: 'string', value: 'none',
                        description: 'subversion (default: none)')
                 option('platform', type: 'combo', choices: ['x11', 'gbm', 'wayland', 'only-cl', 'dummy'],
                -       value: 'x11', description: 'platform (default: x11)')
                +       value: 'wayland', description: 'platform (default: wayland)')
                 option('with-overlay', type: 'boolean', value: 'false',
                        description: 'install overlay (default: false)')
                 option('opencl-icd', type: 'boolean', value: 'true',
                And manually copying the "libmali.so" from the ARM ODroid XU3 Mali r12p0 wayland userspace-driver package to: libmali/lib/arm-linux-gnueabihf/libmali-midgard-t62x-r12p0-wayland.so
                It will check the libmali I've added and compile libgbm wrapper with all missing functions (all of them are missing lol).
                After I installed libmali (ninja install):

                Code: Select all

                $ strings /usr/local/lib/libgbm.so.1 | grep gbm_bo | sort| uniq
                gbm_bo
                gbm_bo_create
                gbm_bo_create_with_modifiers
                gbm_bo_format
                gbm_bo_get_bpp
                gbm_bo_get_device
                gbm_bo_get_format
                gbm_bo_get_handle
                gbm_bo_get_handle_for_plane
                gbm_bo_get_height
                gbm_bo_get_modifier
                gbm_bo_get_offset
                gbm_bo_get_plane_count
                gbm_bo_get_stride
                gbm_bo_get_stride_for_plane
                gbm_bo_get_width
                gbm_bo_handle
                gbm_bo_map
                gbm_bo_unmap
                
                $ ldd /usr/local/lib/libgbm.so.1 
                	linux-vdso.so.1 (0xbec27000)
                	libmali.so.1 => /usr/local/lib/libmali.so.1 (0xb5ee3000)
                	libdl.so.2 => /lib/libdl.so.2 (0xb5ecf000)
                	libdrm.so.2 => /lib/libdrm.so.2 (0xb5eaf000)
                	libc.so.6 => /lib/libc.so.6 (0xb5d59000)
                	librt.so.1 => /lib/librt.so.1 (0xb5d41000)
                	libpthread.so.0 => /lib/libpthread.so.0 (0xb5d16000)
                	libwayland-client.so.0 => /lib/libwayland-client.so.0 (0xb5cfc000)
                	libwayland-server.so.0 => /lib/libwayland-server.so.0 (0xb5cde000)
                	libstdc++.so.6 => /lib/libstdc++.so.6 (0xb5b47000)
                	libm.so.6 => /lib/libm.so.6 (0xb5ad8000)
                	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb5aab000)
                	/lib/ld-linux-armhf.so.3 (0xb6f8b000)
                	libffi.so.6 => /lib/libffi.so.6 (0xb5a94000)
                However when I run Kodi it will constantly say:

                Code: Select all

                2021-01-19 08:24:28.264 T:1161    DEBUG <general>: CDRMUtils::DrmFbGetFromBo - failed to add framebuffer: Invalid argument (22)
                2021-01-19 08:24:28.264 T:1161    ERROR <general>: CDRMAtomic::FlipPage - Failed to get a new FBO
                So for the record, Kodi was built using the attached patch, against the libmali libgbm.so.1 and the libmali EGL/GLES/KHR headers.
                Attachments
                0001-kodi-19-ODroid-XU4-support.zip
                (2.66 KiB) Downloaded 79 times

                AreaScout
                Posts: 1824
                Joined: Sun Jul 07, 2013 3:05 am
                languages_spoken: german, english
                ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
                N1, Go, VU5A, Show2, CloudShell2,
                H2, N2, VU7A, VuShell, Go2, C4
                Has thanked: 128 times
                Been thanked: 381 times
                Contact:

                Re: Linux kernel 5.10 on XU3/4

                Post by AreaScout »

                  Check your linkage with:

                  Code: Select all

                  ldd /usr/lib/arm-linux-gnueabihf/kodi/kodi.bin | grep libgbm
                          libgbm.so.1 => /usr/lib/arm-linux-gnueabihf/libgbm.so.1 (0xb1c90000)

                  Code: Select all

                  ls -la /usr/lib/arm-linux-gnueabihf/libgb*
                  -rwxr-xr-x 1 root root 18060 Jan 16 23:08 /usr/lib/arm-linux-gnueabihf/libgbm.so
                  -rwxr-xr-x 1 root root 18060 Jan 16 23:07 /usr/lib/arm-linux-gnueabihf/libgbm.so.1
                  lrwxrwxrwx 1 root root    11 Jan 16 23:06 /usr/lib/arm-linux-gnueabihf/libgbm.so.1.0.0 -> libgbm.so.1
                  
                  libgbm.so and libgbm.so.1 both are the new binary, not clean but works ;)

                  Linkage of libgbm is:

                  Code: Select all

                  ldd /usr/lib/arm-linux-gnueabihf/libgbm.so
                          linux-vdso.so.1 (0xbeeeb000)
                          libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb6eda000)
                          libdrm.so.2 => /usr/lib/arm-linux-gnueabihf/libdrm.so.2 (0xb6ebe000)
                          libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6dc0000)
                          /lib/ld-linux-armhf.so.3 (0xb6f10000)
                          libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb6d57000)
                  Strings inside libgbm:

                  Code: Select all

                  strings /usr/lib/arm-linux-gnueabihf/libgbm.so.1 | grep gbm_bo | sort| uniq
                  gbm_bo
                  gbm_bo_create
                  gbm_bo_create_with_modifiers
                  gbm_bo_format
                  gbm_bo_get_bpp
                  gbm_bo_get_device
                  gbm_bo_get_format
                  gbm_bo_get_handle
                  gbm_bo_get_handle_for_plane
                  gbm_bo_get_height
                  gbm_bo_get_modifier
                  gbm_bo_get_offset
                  gbm_bo_get_plane_count
                  gbm_bo_get_stride
                  gbm_bo_get_stride_for_plane
                  gbm_bo_get_width
                  gbm_bo_handle
                  gbm_bo_map
                  gbm_bo_unmap
                  
                  Also delete your kodi build directory, restart cmake and start building from a clean directory

                  Mali blob I use is v1.r17p0-01rel0.d17cf84c10daf186c21e3efcfae21a65

                  https://www.areascout.at/kodi/mali-x11- ... _armhf.deb

                  Build command for libgbm wrapper was meson -Darch=auto -Dplatform=gbm -Dprefix=/usr build/

                  Patch I use for Kodi (without v4l2_m2m - not working) see below

                  RG
                  Attachments
                  kodi19.patch.zip
                  (1.61 KiB) Downloaded 74 times
                  These users thanked the author AreaScout for the post:
                  MastaG (Wed Jan 20, 2021 2:57 am)

                  MastaG
                  Posts: 407
                  Joined: Mon Aug 26, 2013 6:05 pm
                  languages_spoken: english
                  Has thanked: 45 times
                  Been thanked: 68 times
                  Contact:

                  Re: Linux kernel 5.10 on XU3/4

                  Post by MastaG »

                  AreaScout wrote:
                  Tue Jan 19, 2021 7:50 pm
                    Check your linkage with:

                    Code: Select all

                    ldd /usr/lib/arm-linux-gnueabihf/kodi/kodi.bin | grep libgbm
                            libgbm.so.1 => /usr/lib/arm-linux-gnueabihf/libgbm.so.1 (0xb1c90000)

                    Code: Select all

                    ls -la /usr/lib/arm-linux-gnueabihf/libgb*
                    -rwxr-xr-x 1 root root 18060 Jan 16 23:08 /usr/lib/arm-linux-gnueabihf/libgbm.so
                    -rwxr-xr-x 1 root root 18060 Jan 16 23:07 /usr/lib/arm-linux-gnueabihf/libgbm.so.1
                    lrwxrwxrwx 1 root root    11 Jan 16 23:06 /usr/lib/arm-linux-gnueabihf/libgbm.so.1.0.0 -> libgbm.so.1
                    
                    libgbm.so and libgbm.so.1 both are the new binary, not clean but works ;)

                    Linkage of libgbm is:

                    Code: Select all

                    ldd /usr/lib/arm-linux-gnueabihf/libgbm.so
                            linux-vdso.so.1 (0xbeeeb000)
                            libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xb6eda000)
                            libdrm.so.2 => /usr/lib/arm-linux-gnueabihf/libdrm.so.2 (0xb6ebe000)
                            libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6dc0000)
                            /lib/ld-linux-armhf.so.3 (0xb6f10000)
                            libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0xb6d57000)
                    Strings inside libgbm:

                    Code: Select all

                    strings /usr/lib/arm-linux-gnueabihf/libgbm.so.1 | grep gbm_bo | sort| uniq
                    gbm_bo
                    gbm_bo_create
                    gbm_bo_create_with_modifiers
                    gbm_bo_format
                    gbm_bo_get_bpp
                    gbm_bo_get_device
                    gbm_bo_get_format
                    gbm_bo_get_handle
                    gbm_bo_get_handle_for_plane
                    gbm_bo_get_height
                    gbm_bo_get_modifier
                    gbm_bo_get_offset
                    gbm_bo_get_plane_count
                    gbm_bo_get_stride
                    gbm_bo_get_stride_for_plane
                    gbm_bo_get_width
                    gbm_bo_handle
                    gbm_bo_map
                    gbm_bo_unmap
                    
                    Also delete your kodi build directory, restart cmake and start building from a clean directory

                    Mali blob I use is v1.r17p0-01rel0.d17cf84c10daf186c21e3efcfae21a65

                    https://www.areascout.at/kodi/mali-x11- ... _armhf.deb

                    Build command for libgbm wrapper was meson -Darch=auto -Dplatform=gbm -Dprefix=/usr build/

                    Patch I use for Kodi (without v4l2_m2m - not working) see below

                    RG
                    Hi AreaScout,

                    Thanks it's working after a full rebuild of Kodi, even the v4l2_m2m decoding works, you just need to disable the DRM Prime decoding thing in the video settings (which seems to be enabled by the default).
                    The differences between last build:
                    - You had one more additional change in your patch, which I didn't include in my last build:

                    Code: Select all

                    diff --git a/xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp b/xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp
                    index d8d775dcad..21efc02d34 100644
                    --- a/xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp
                    +++ b/xbmc/windowing/gbm/WinSystemGbmEGLContext.cpp
                    @@ -23,7 +23,7 @@ bool CWinSystemGbmEGLContext::InitWindowSystemEGL(EGLint renderableType, EGLint
                         return false;
                       }
                     
                    -  if (!m_eglContext.CreatePlatformDisplay(m_GBM->GetDevice()->Get(), m_GBM->GetDevice()->Get()))
                    +  if (!m_eglContext.CreatePlatformDisplay(m_GBM->GetDevice()->Get(), reinterpret_cast<EGLNativeDisplayType>(m_GBM->GetDevice()->Get())))
                       {
                         return false;
                       }
                    - I've removed my OS's (Fedora 33) mesa-libGL*/EGL/libgbm headers (dnf remove mesa-*-devel), and installed th ones from the libmali package (which was built and installed using the above patch using the libmali.so from the ARM r12p0 wayland/gbm/drm driver).
                    But I think it was the first change that was missing which caused the "Failed to add framebuffer" error, because RetroArch was still working with the new gbm wrapper.

                    So everything is fully working now, I'll attach the final patch for Kodi 19 for XU4 which also disables the DRM prime decoding option by default as well.
                    With the patch the only condition would be that kodi is built against FFmpeg which has --enable-v4l2-m2m enabled, optionally you can apply memeka's patch for adding bitrate control to the encoder and fixing the capture buffers. (afaik all other fixes for FFmpeg have already been upstreamed).
                    For the kernel I'm also using your s5p-mfc patch which solves some MFC instabilities when playing too many videos after each other sometimes. (this is already in tobetter's 5.10)

                    This is all on Linux 5.4 btw, haven't tested gbm on 5.10 yet.

                    Thanks again my friend, it's nice to see Kodi 19 being able to do one last round on our XU4's :)
                    This way we can still enjoy Netflix, Amazon Prime and Disney+ !


                    The only thing I need to look into is that Gnome-Shell no longer starts with the new gbm wrapper in place, it seems to segfault.
                    I'll try to debug it and report to the libmali developer.
                    Attachments
                    s5p-mfc-fix-decoding.zip
                    (617 Bytes) Downloaded 79 times
                    0001-Kodi-19-Support-ODroid-XU4.zip
                    (3.24 KiB) Downloaded 79 times
                    optional-ffmpeg-bitrate-control.zip
                    (1008 Bytes) Downloaded 72 times
                    These users thanked the author MastaG for the post (total 2):
                    AreaScout (Thu Jan 21, 2021 7:45 pm) • davidb2111 (Wed Oct 13, 2021 4:06 am)

                    AreaScout
                    Posts: 1824
                    Joined: Sun Jul 07, 2013 3:05 am
                    languages_spoken: german, english
                    ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
                    N1, Go, VU5A, Show2, CloudShell2,
                    H2, N2, VU7A, VuShell, Go2, C4
                    Has thanked: 128 times
                    Been thanked: 381 times
                    Contact:

                    Re: Linux kernel 5.10 on XU3/4

                    Post by AreaScout »

                      Good that it works :ugeek: ! I am on 5.10 and MFC was not working, but maybe v4l2_m2m decoder was not compiled in I have to reinvest, look closer for that

                      MastaG
                      Posts: 407
                      Joined: Mon Aug 26, 2013 6:05 pm
                      languages_spoken: english
                      Has thanked: 45 times
                      Been thanked: 68 times
                      Contact:

                      Re: Linux kernel 5.10 on XU3/4

                      Post by MastaG »

                      On 5.10 I've only tested Kodi wayland on Gnome.
                      The decoding was working (sort of) but video playback was slowed down by a lot and sound was OK.

                      chewitt
                      Posts: 179
                      Joined: Mon Aug 12, 2019 12:27 pm
                      languages_spoken: english
                      Has thanked: 3 times
                      Been thanked: 132 times
                      Contact:

                      Re: Linux kernel 5.10 on XU3/4

                      Post by chewitt »

                      between Linux 5.4 and 5.10 one of the Samsung maintainers removed large parts of the decoder and the unmerged 2019 series that I linked to before is the incomplete attempt at bridging the gap (chasm) between current and previous functionality. Someone who does code (so not me) needs to revive/rebase that series.

                      AreaScout
                      Posts: 1824
                      Joined: Sun Jul 07, 2013 3:05 am
                      languages_spoken: german, english
                      ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
                      N1, Go, VU5A, Show2, CloudShell2,
                      H2, N2, VU7A, VuShell, Go2, C4
                      Has thanked: 128 times
                      Been thanked: 381 times
                      Contact:

                      Re: Linux kernel 5.10 on XU3/4

                      Post by AreaScout »

                        Then one of that experts has to merge that parts back or the unmerged 2019 series, that's not an easy job as GSCALER and VPU aka MFC does look like they indifferent each other, maybe MFC firmware is also using GSCALER behind our visibility ? I have tried to apply the 2019 series on kernel 5.10 (tobetter) but large parts of the code are in conflict with existing code, I can only solve minor parts of that commits but on others you have to really know the hardware and existing code to make changes, this is over my head -> sorry, at least I have tried it !

                        RG

                        MastaG
                        Posts: 407
                        Joined: Mon Aug 26, 2013 6:05 pm
                        languages_spoken: english
                        Has thanked: 45 times
                        Been thanked: 68 times
                        Contact:

                        Re: Linux kernel 5.10 on XU3/4

                        Post by MastaG »

                        So we're kinda dead here, the kernel works fine except for the mfc, so no video decoding for kodi or whatsoever.

                        Does anyone have a working tree with the latest kernel patched up for xu3/4 that still has the mfc working?
                        I see that batocera.linux features linux 5.8 for example.

                        Paullo612
                        Posts: 12
                        Joined: Tue Sep 02, 2014 4:58 am
                        languages_spoken: english
                        ODROIDs: ODROID XU3
                        Has thanked: 0
                        Been thanked: 7 times
                        Contact:

                        Re: Linux kernel 5.10 on XU3/4

                        Post by Paullo612 »

                        Finally managed to fix Panfrost + MFC on recent kernels

                        Just applying attached paches and those two
                        https://patchwork.freedesktop.org/patch/469763/
                        https://lore.kernel.org/dri-devel/YMMxF ... l.local/t/

                        make it all work. Tested against vanilla v5.17.

                        Panfrost also requires Mesa patch. The bad news is that we now have to patch ffmpeg to pass V4L2_MEMORY_FLAG_NON_COHERENT flag to MFC queues.

                        Those are screenshots of default Kodi from Debian repository running on GBM.
                        Image

                        Image

                        Here is GNOME 3 on Wayland.
                        Image
                        Attachments
                        patches.zip
                        (5.28 KiB) Downloaded 15 times
                        These users thanked the author Paullo612 for the post (total 5):
                        odroid (Tue Jun 07, 2022 10:17 am) • AreaScout (Wed Jun 08, 2022 2:24 pm) • meveric (Sat Jun 18, 2022 8:36 pm) • MastaG (Fri Jun 24, 2022 8:05 pm) • chewitt (Sat Jun 25, 2022 9:20 pm)

                        User avatar
                        mad_ady
                        Posts: 10643
                        Joined: Wed Jul 15, 2015 5:00 pm
                        languages_spoken: english
                        ODROIDs: XU4 (HC1, HC2), C1+, C2, C4 (HC4), N1, N2, H2, Go, Go Advance, M1
                        Location: Bucharest, Romania
                        Has thanked: 645 times
                        Been thanked: 915 times
                        Contact:

                        Re: Linux kernel 5.10 on XU3/4

                        Post by mad_ady »

                        Thanks for the patches! It would be nice to get a 22.04 image with the newest kernel, even if xu4 is an old board!

                        AreaScout
                        Posts: 1824
                        Joined: Sun Jul 07, 2013 3:05 am
                        languages_spoken: german, english
                        ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
                        N1, Go, VU5A, Show2, CloudShell2,
                        H2, N2, VU7A, VuShell, Go2, C4
                        Has thanked: 128 times
                        Been thanked: 381 times
                        Contact:

                        Re: Linux kernel 5.10 on XU3/4

                        Post by AreaScout »

                          @Paullo612

                          I can't believe my eyes, did I really see Panfrost running on XU4 with MaliT628 and then there is also support for MFC in 5.10 .... this is the best patch release I have seen for quite a while ! Thank you and it's not so big ! Excellent 👌👌
                            StandingOvationGIF.gif
                            StandingOvationGIF.gif (2.13 MiB) Viewed 884 times
                            P.S.: Any chance to see the Mesa patches too ?

                            Regards,
                            Daniel

                            Paullo612
                            Posts: 12
                            Joined: Tue Sep 02, 2014 4:58 am
                            languages_spoken: english
                            ODROIDs: ODROID XU3
                            Has thanked: 0
                            Been thanked: 7 times
                            Contact:

                            Re: Linux kernel 5.10 on XU3/4

                            Post by Paullo612 »

                            P.S.: Any chance to see the Mesa patches too ?
                            Mesa patch is also quite trivial:

                            Code: Select all

                            diff --git a/src/panfrost/lib/pan_props.c b/src/panfrost/lib/pan_props.c
                            index 5884a826..22d610a8 100644
                            --- a/src/panfrost/lib/pan_props.c
                            +++ b/src/panfrost/lib/pan_props.c
                            @@ -53,6 +53,7 @@
                             
                             /* Table of supported Mali GPUs */
                             const struct panfrost_model panfrost_model_list[] = {
                            +        MODEL(0x620, "T620", "T62x", NO_ANISO, {}),
                                     MODEL(0x720, "T720", "T72x", NO_ANISO, { .no_hierarchical_tiling = true }),
                                     MODEL(0x750, "T760", "T76x", NO_ANISO, {}),
                                     MODEL(0x820, "T820", "T82x", NO_ANISO, { .no_hierarchical_tiling = true }),
                            
                            Haven't crafted FFmpeg patches yet, but it can be hacked around on kernel side:

                            Code: Select all

                            diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c
                            index 6edf4508c636..ae11392aa192 100644
                            --- a/drivers/media/common/videobuf2/videobuf2-v4l2.c
                            +++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c
                            @@ -704,7 +704,7 @@ static void validate_memory_flags(struct vb2_queue *q,
                                            *flags = 0;
                                    } else {
                                            /* Clear all unknown flags. */
                            -               *flags &= V4L2_MEMORY_FLAG_NON_COHERENT;
                            +               *flags |= V4L2_MEMORY_FLAG_NON_COHERENT;
                                    }
                             }
                             
                            
                            This always enables V4L2_MEMORY_FLAG_NON_COHERENT for all V4L queues.

                            By the way, MFC related series applies only on v5.16 and later (V4L2_MEMORY_FLAG_NON_COHERENT support in videobuf2 was introduced in v5.16-rc1).

                            MFC related series is the correct implementation of old (https://patchwork.kernel.org/project/li ... abora.com/ + https://github.com/tobetter/linux/commi ... df203aaad6) series. Did MFC work on v5.10 with this applied?
                            These users thanked the author Paullo612 for the post:
                            chewitt (Sat Jun 25, 2022 9:20 pm)

                            AreaScout
                            Posts: 1824
                            Joined: Sun Jul 07, 2013 3:05 am
                            languages_spoken: german, english
                            ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
                            N1, Go, VU5A, Show2, CloudShell2,
                            H2, N2, VU7A, VuShell, Go2, C4
                            Has thanked: 128 times
                            Been thanked: 381 times
                            Contact:

                            Re: Linux kernel 5.10 on XU3/4

                            Post by AreaScout »

                              I know the patch to add T620 support to Panfrost very long (just add them to the supported GPU's list), but are we driving the T620 GPU only on the first core group ? Because this statement is quite confusing
                              But there's little point adding such flags until someone (myself)
                              steps up to do the Mesa work.
                              Regards,
                              Daniel

                              Paullo612
                              Posts: 12
                              Joined: Tue Sep 02, 2014 4:58 am
                              languages_spoken: english
                              ODROIDs: ODROID XU3
                              Has thanked: 0
                              Been thanked: 7 times
                              Contact:

                              Re: Linux kernel 5.10 on XU3/4

                              Post by Paullo612 »

                              but are we driving the T620 GPU only on the first core group
                              Yes. Only 4 cores out of 6, unfortunately.

                              Implementing proper job scheduling across cores requires working pandecode (tool to dump libmali's command stream). But in Mesa there is only pandecode for command stream with 64 pointers (panfrost does not support 32bit command stream, T628 supports both 32 and 64 bits), our blobs using 32 bit command stream. So, without working pandecode it is quite difficult to figure out how scheduling works in libmali.

                              So, they just disabled second core group in kernel, because enabled second core group produces a lot of visual artifacts. You can see those if you won't apply patch discussed.

                              Paullo612
                              Posts: 12
                              Joined: Tue Sep 02, 2014 4:58 am
                              languages_spoken: english
                              ODROIDs: ODROID XU3
                              Has thanked: 0
                              Been thanked: 7 times
                              Contact:

                              Re: Linux kernel 5.10 on XU3/4

                              Post by Paullo612 »

                              In a first version of this patch asheplyakov suggested code that schedules all jobs to first core group. He wrote that libmali schedules little or no jobs at all to second core goup.

                              AreaScout
                              Posts: 1824
                              Joined: Sun Jul 07, 2013 3:05 am
                              languages_spoken: german, english
                              ODROIDs: X2, U3, XU3, C2, HiFi Shield, XU4, XU4Q,
                              N1, Go, VU5A, Show2, CloudShell2,
                              H2, N2, VU7A, VuShell, Go2, C4
                              Has thanked: 128 times
                              Been thanked: 381 times
                              Contact:

                              Re: Linux kernel 5.10 on XU3/4

                              Post by AreaScout »

                                Thank you for all that information 👍

                                Regards,
                                Daniel

                                Paullo612
                                Posts: 12
                                Joined: Tue Sep 02, 2014 4:58 am
                                languages_spoken: english
                                ODROIDs: ODROID XU3
                                Has thanked: 0
                                Been thanked: 7 times
                                Contact:

                                Re: Linux kernel 5.10 on XU3/4

                                Post by Paullo612 »

                                AreaScout wrote:
                                Thu Jun 09, 2022 1:24 am
                                  Thank you for all that information 👍
                                  More information about how scheduling should work may be found here.
                                  These users thanked the author Paullo612 for the post:
                                  AreaScout (Thu Jun 09, 2022 6:39 pm)

                                  MastaG
                                  Posts: 407
                                  Joined: Mon Aug 26, 2013 6:05 pm
                                  languages_spoken: english
                                  Has thanked: 45 times
                                  Been thanked: 68 times
                                  Contact:

                                  Re: Linux kernel 5.10 on XU3/4

                                  Post by MastaG »

                                  Thanks a lot Paullo612!
                                  I totally missed this when baking my Fedora 36 image.

                                  Does Gnome Wayland on panfrost work correctly?
                                  The last time I've tried it, it would show some occasional corruption on the screen, like flashing black tiles.

                                  chewitt
                                  Posts: 179
                                  Joined: Mon Aug 12, 2019 12:27 pm
                                  languages_spoken: english
                                  Has thanked: 3 times
                                  Been thanked: 132 times
                                  Contact:

                                  Re: Linux kernel 5.10 on XU3/4

                                  Post by chewitt »

                                  It's great to see T628 running mesa/panfrost finally! .. kudos to @Paullo612 for filling in some missing pieces of jigsaw.

                                  Just for fun, here's an LE11 image with Linux 5.19-rc3 + mesa 21.1.2 + Kodi 20a1: https://chewitt.libreelec.tv/testing/Li ... xu4.img.gz

                                  NB: Kodi will fail to play video unless you disable hardware decoding in Kodi player setttings. Software decoded 1080p media seems to work okay. Resurrecting the MFC to add hardware support will need either a rework of this huge bit-rotted changeset https://patchwork.kernel.org/project/li ... msung.com/ or the ffmpeg trickery @memeka outlined in this series: https://github.com/mihailescu2m/FFmpeg/ ... 2-drmprime - I've asked the RPi developer who helped me with Amlogic v4l2_m2m support to have a look, but I doubt I can persuade him to do the work (once was enough, I suspect).

                                  Post Reply

                                  Return to “Linux Kernel 5.4 Development Party”

                                  Who is online

                                  Users browsing this forum: No registered users and 2 guests