-
-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
linux/lakka/rpi: patch for scaled modes
- Loading branch information
Showing
1 changed file
with
317 additions
and
0 deletions.
There are no files selected for viewing
317 changes: 317 additions & 0 deletions
317
packages/linux/patches/Lakka-raspberrypi/add_support_for_scaled_modes_in_VEC.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,317 @@ | ||
From 234cfe71ba316c9666ecd501b7df1a4b5bdb7c03 Mon Sep 17 00:00:00 2001 | ||
From: Mateusz Kwiatkowski <[email protected]> | ||
Date: Mon, 11 Oct 2021 23:34:25 +0200 | ||
Subject: [PATCH 1/2] drm/vc4: Add vertically scaled progressive modes for VEC | ||
|
||
The Raspberry Pi firmware, when configured to output progressive | ||
composite video, scales 720x480/720x576 framebuffer into a | ||
720x240/720x288 physical video mode. | ||
|
||
This commit adds support for replicating such behavior, as this provides | ||
square-ish virtual pixels, and some userland software rely on this. | ||
|
||
Signed-off-by: Mateusz Kwiatkowski <[email protected]> | ||
--- | ||
drivers/gpu/drm/vc4/vc4_plane.c | 40 +++++++++++++++++++++ | ||
drivers/gpu/drm/vc4/vc4_vec.c | 63 ++++++++++++++++++++++++++++++--- | ||
2 files changed, 98 insertions(+), 5 deletions(-) | ||
|
||
diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c | ||
index 7947cf47b6e13..96b60fb245982 100644 | ||
--- a/drivers/gpu/drm/vc4/vc4_plane.c | ||
+++ b/drivers/gpu/drm/vc4/vc4_plane.c | ||
@@ -334,6 +334,42 @@ static int vc4_plane_margins_adj(struct drm_plane_state *pstate) | ||
return 0; | ||
} | ||
|
||
+static int vc4_plane_scaling_adj(struct drm_plane_state *pstate) | ||
+{ | ||
+ struct vc4_plane_state *vc4_pstate = to_vc4_plane_state(pstate); | ||
+ struct drm_crtc_state *crtc_state; | ||
+ | ||
+ crtc_state = drm_atomic_get_new_crtc_state(pstate->state, | ||
+ pstate->crtc); | ||
+ | ||
+ if (crtc_state->mode.hdisplay != crtc_state->adjusted_mode.hdisplay) { | ||
+ vc4_pstate->crtc_x = | ||
+ DIV_ROUND_CLOSEST(vc4_pstate->crtc_x * | ||
+ crtc_state->adjusted_mode.hdisplay, | ||
+ crtc_state->mode.hdisplay); | ||
+ vc4_pstate->crtc_w = | ||
+ DIV_ROUND_CLOSEST(vc4_pstate->crtc_w * | ||
+ crtc_state->adjusted_mode.hdisplay, | ||
+ crtc_state->mode.hdisplay); | ||
+ } | ||
+ | ||
+ if (crtc_state->mode.vdisplay != crtc_state->adjusted_mode.vdisplay) { | ||
+ vc4_pstate->crtc_y = | ||
+ DIV_ROUND_CLOSEST(vc4_pstate->crtc_y * | ||
+ crtc_state->adjusted_mode.vdisplay, | ||
+ crtc_state->mode.vdisplay); | ||
+ vc4_pstate->crtc_h = | ||
+ DIV_ROUND_CLOSEST(vc4_pstate->crtc_h * | ||
+ crtc_state->adjusted_mode.vdisplay, | ||
+ crtc_state->mode.vdisplay); | ||
+ } | ||
+ | ||
+ if (!vc4_pstate->crtc_w || !vc4_pstate->crtc_h) | ||
+ return -EINVAL; | ||
+ | ||
+ return 0; | ||
+} | ||
+ | ||
static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state) | ||
{ | ||
struct vc4_plane_state *vc4_state = to_vc4_plane_state(state); | ||
@@ -378,6 +414,10 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state) | ||
if (ret) | ||
return ret; | ||
|
||
+ ret = vc4_plane_scaling_adj(state); | ||
+ if (ret) | ||
+ return ret; | ||
+ | ||
vc4_state->x_scaling[0] = vc4_get_scaling_mode(vc4_state->src_w[0], | ||
vc4_state->crtc_w); | ||
vc4_state->y_scaling[0] = vc4_get_scaling_mode(vc4_state->src_h[0], | ||
diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c | ||
index 255e5c6c48e04..14eb28c859eb4 100644 | ||
--- a/drivers/gpu/drm/vc4/vc4_vec.c | ||
+++ b/drivers/gpu/drm/vc4/vc4_vec.c | ||
@@ -253,6 +253,7 @@ enum vc4_vec_tv_mode_id { | ||
struct vc4_vec_tv_mode { | ||
const struct drm_display_mode *interlaced_mode; | ||
const struct drm_display_mode *progressive_mode; | ||
+ const struct drm_display_mode *scaled_progressive_mode; | ||
u32 config0; | ||
u32 config1; | ||
u32 custom_freq; | ||
@@ -298,6 +299,12 @@ static const struct drm_display_mode drm_mode_240p = { | ||
240, 240 + 3, 240 + 3 + 3, 262, 0, 0) | ||
}; | ||
|
||
+static const struct drm_display_mode drm_mode_scaled_480p = { | ||
+ DRM_MODE("720x480 (scaled)", DRM_MODE_TYPE_DRIVER, 2 * 13500, | ||
+ 720, 720 + 14, 720 + 14 + 64, 720 + 14 + 64 + 60, 0, | ||
+ 2 * 240, 2 * (240 + 3), 2 * (240 + 3 + 3), 2 * 262, 0, 0) | ||
+}; | ||
+ | ||
static const struct drm_display_mode drm_mode_576i = { | ||
DRM_MODE("720x576i", DRM_MODE_TYPE_DRIVER, 13500, | ||
720, 720 + 20, 720 + 20 + 64, 720 + 20 + 64 + 60, 0, | ||
@@ -311,16 +318,24 @@ static const struct drm_display_mode drm_mode_288p = { | ||
288, 288 + 2, 288 + 2 + 3, 312, 0, 0) | ||
}; | ||
|
||
+static const struct drm_display_mode drm_mode_scaled_576p = { | ||
+ DRM_MODE("720x576 (scaled)", DRM_MODE_TYPE_DRIVER, 2 * 13500, | ||
+ 720, 720 + 20, 720 + 20 + 64, 720 + 20 + 64 + 60, 0, | ||
+ 2 * 288, 2 * (288 + 2), 2 * (288 + 2 + 3), 2 * 312, 0, 0) | ||
+}; | ||
+ | ||
static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = { | ||
[VC4_VEC_TV_MODE_NTSC] = { | ||
.interlaced_mode = &drm_mode_480i, | ||
.progressive_mode = &drm_mode_240p, | ||
+ .scaled_progressive_mode = &drm_mode_scaled_480p, | ||
.config0 = VEC_CONFIG0_NTSC_STD | VEC_CONFIG0_PDEN, | ||
.config1 = VEC_CONFIG1_C_CVBS_CVBS, | ||
}, | ||
[VC4_VEC_TV_MODE_NTSC_J] = { | ||
.interlaced_mode = &drm_mode_480i, | ||
.progressive_mode = &drm_mode_240p, | ||
+ .scaled_progressive_mode = &drm_mode_scaled_480p, | ||
.config0 = VEC_CONFIG0_NTSC_STD, | ||
.config1 = VEC_CONFIG1_C_CVBS_CVBS, | ||
}, | ||
@@ -328,6 +343,7 @@ static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = { | ||
/* NTSC with PAL chroma frequency */ | ||
.interlaced_mode = &drm_mode_480i, | ||
.progressive_mode = &drm_mode_240p, | ||
+ .scaled_progressive_mode = &drm_mode_scaled_480p, | ||
.config0 = VEC_CONFIG0_NTSC_STD, | ||
.config1 = VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ, | ||
.custom_freq = 0x2a098acb, | ||
@@ -335,18 +351,21 @@ static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = { | ||
[VC4_VEC_TV_MODE_PAL] = { | ||
.interlaced_mode = &drm_mode_576i, | ||
.progressive_mode = &drm_mode_288p, | ||
+ .scaled_progressive_mode = &drm_mode_scaled_576p, | ||
.config0 = VEC_CONFIG0_PAL_BDGHI_STD, | ||
.config1 = VEC_CONFIG1_C_CVBS_CVBS, | ||
}, | ||
[VC4_VEC_TV_MODE_PAL_M] = { | ||
.interlaced_mode = &drm_mode_480i, | ||
.progressive_mode = &drm_mode_240p, | ||
+ .scaled_progressive_mode = &drm_mode_scaled_480p, | ||
.config0 = VEC_CONFIG0_PAL_M_STD, | ||
.config1 = VEC_CONFIG1_C_CVBS_CVBS, | ||
}, | ||
[VC4_VEC_TV_MODE_PAL_N] = { | ||
.interlaced_mode = &drm_mode_576i, | ||
.progressive_mode = &drm_mode_288p, | ||
+ .scaled_progressive_mode = &drm_mode_scaled_576p, | ||
.config0 = VEC_CONFIG0_PAL_N_STD, | ||
.config1 = VEC_CONFIG1_C_CVBS_CVBS, | ||
}, | ||
@@ -354,6 +373,7 @@ static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = { | ||
/* PAL-M with chroma frequency of regular PAL */ | ||
.interlaced_mode = &drm_mode_480i, | ||
.progressive_mode = &drm_mode_240p, | ||
+ .scaled_progressive_mode = &drm_mode_scaled_480p, | ||
.config0 = VEC_CONFIG0_PAL_M_STD, | ||
.config1 = VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ, | ||
.custom_freq = 0x2a098acb, | ||
@@ -361,6 +381,7 @@ static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = { | ||
[VC4_VEC_TV_MODE_SECAM] = { | ||
.interlaced_mode = &drm_mode_576i, | ||
.progressive_mode = &drm_mode_288p, | ||
+ .scaled_progressive_mode = &drm_mode_scaled_576p, | ||
.config0 = VEC_CONFIG0_SECAM_STD, | ||
.config1 = VEC_CONFIG1_C_CVBS_CVBS, | ||
.custom_freq = 0x29c71c72, | ||
@@ -420,7 +441,9 @@ static void vc4_vec_connector_destroy(struct drm_connector *connector) | ||
static int vc4_vec_connector_get_modes(struct drm_connector *connector) | ||
{ | ||
struct drm_connector_state *state = connector->state; | ||
- struct drm_display_mode *interlaced_mode, *progressive_mode; | ||
+ struct drm_display_mode *interlaced_mode; | ||
+ struct drm_display_mode *progressive_mode; | ||
+ struct drm_display_mode *scaled_progressive_mode; | ||
|
||
interlaced_mode = | ||
drm_mode_duplicate(connector->dev, | ||
@@ -428,24 +451,33 @@ static int vc4_vec_connector_get_modes(struct drm_connector *connector) | ||
progressive_mode = | ||
drm_mode_duplicate(connector->dev, | ||
vc4_vec_tv_modes[state->tv.mode].progressive_mode); | ||
- if (!interlaced_mode || !progressive_mode) { | ||
+ scaled_progressive_mode = | ||
+ drm_mode_duplicate(connector->dev, | ||
+ vc4_vec_tv_modes[state->tv.mode].scaled_progressive_mode); | ||
+ if (!interlaced_mode || !progressive_mode || !scaled_progressive_mode) { | ||
DRM_ERROR("Failed to create a new display mode\n"); | ||
drm_mode_destroy(connector->dev, interlaced_mode); | ||
drm_mode_destroy(connector->dev, progressive_mode); | ||
+ drm_mode_destroy(connector->dev, scaled_progressive_mode); | ||
return -ENOMEM; | ||
} | ||
|
||
if (connector->cmdline_mode.specified && | ||
connector->cmdline_mode.refresh_specified && | ||
- !connector->cmdline_mode.interlace) | ||
+ !connector->cmdline_mode.interlace) { | ||
/* progressive mode set at boot, let's make it preferred */ | ||
- progressive_mode->type |= DRM_MODE_TYPE_PREFERRED; | ||
- else | ||
+ if (connector->cmdline_mode.yres > 300) | ||
+ scaled_progressive_mode->type |= DRM_MODE_TYPE_PREFERRED; | ||
+ else | ||
+ progressive_mode->type |= DRM_MODE_TYPE_PREFERRED; | ||
+ } else { | ||
/* otherwise, interlaced mode is preferred */ | ||
interlaced_mode->type |= DRM_MODE_TYPE_PREFERRED; | ||
+ } | ||
|
||
drm_mode_probed_add(connector, interlaced_mode); | ||
drm_mode_probed_add(connector, progressive_mode); | ||
+ drm_mode_probed_add(connector, scaled_progressive_mode); | ||
|
||
return 1; | ||
} | ||
@@ -628,6 +660,27 @@ static int vc4_vec_encoder_atomic_check(struct drm_encoder *encoder, | ||
const struct drm_display_mode *reference_mode = | ||
vc4_vec_tv_modes[conn_state->tv.mode].interlaced_mode; | ||
|
||
+ if (!(crtc_state->adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE) && | ||
+ crtc_state->adjusted_mode.vtotal > 312) { | ||
+ /* vertically scaled progressive mode */ | ||
+ if (crtc_state->adjusted_mode.crtc_vdisplay % 2 != 0 || | ||
+ crtc_state->adjusted_mode.crtc_vsync_start % 2 != 0 || | ||
+ crtc_state->adjusted_mode.crtc_vsync_end % 2 != 0 || | ||
+ crtc_state->adjusted_mode.crtc_vtotal % 2 != 0) | ||
+ return -EINVAL; | ||
+ | ||
+ crtc_state->adjusted_mode.clock /= 2; | ||
+ crtc_state->adjusted_mode.crtc_clock /= 2; | ||
+ crtc_state->adjusted_mode.vdisplay /= 2; | ||
+ crtc_state->adjusted_mode.crtc_vdisplay /= 2; | ||
+ crtc_state->adjusted_mode.vsync_start /= 2; | ||
+ crtc_state->adjusted_mode.crtc_vsync_start /= 2; | ||
+ crtc_state->adjusted_mode.vsync_end /= 2; | ||
+ crtc_state->adjusted_mode.crtc_vsync_end /= 2; | ||
+ crtc_state->adjusted_mode.vtotal /= 2; | ||
+ crtc_state->adjusted_mode.crtc_vtotal /= 2; | ||
+ } | ||
+ | ||
if (crtc_state->adjusted_mode.crtc_clock != reference_mode->clock || | ||
crtc_state->adjusted_mode.crtc_htotal != reference_mode->htotal || | ||
crtc_state->adjusted_mode.crtc_hdisplay % 4 != 0 || | ||
|
||
From 3c08549f11d5fb031661d8b1d1b2325ea6153656 Mon Sep 17 00:00:00 2001 | ||
From: Mateusz Kwiatkowski <[email protected]> | ||
Date: Tue, 12 Oct 2021 00:30:02 +0200 | ||
Subject: [PATCH 2/2] drm/vc4: Add support for horizontally caled VEC modes | ||
|
||
Composite output uses non-square pixels. By allowing horizontally scaled | ||
modes, we can simulate a different pixel clock and thus make it possible | ||
to simulate square pixels at either 4:3 or 16:9 target aspect ratio. | ||
|
||
Signed-off-by: Mateusz Kwiatkowski <[email protected]> | ||
--- | ||
drivers/gpu/drm/vc4/vc4_vec.c | 40 ++++++++++++++++++++++++++++++----- | ||
1 file changed, 35 insertions(+), 5 deletions(-) | ||
|
||
diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c | ||
index 14eb28c859eb4..e60a5c1e01472 100644 | ||
--- a/drivers/gpu/drm/vc4/vc4_vec.c | ||
+++ b/drivers/gpu/drm/vc4/vc4_vec.c | ||
@@ -681,13 +681,43 @@ static int vc4_vec_encoder_atomic_check(struct drm_encoder *encoder, | ||
crtc_state->adjusted_mode.crtc_vtotal /= 2; | ||
} | ||
|
||
- if (crtc_state->adjusted_mode.crtc_clock != reference_mode->clock || | ||
- crtc_state->adjusted_mode.crtc_htotal != reference_mode->htotal || | ||
- crtc_state->adjusted_mode.crtc_hdisplay % 4 != 0 || | ||
- crtc_state->adjusted_mode.crtc_hsync_end - | ||
- crtc_state->adjusted_mode.crtc_hsync_start < 1) | ||
+ if (crtc_state->adjusted_mode.hdisplay % 4 != 0 || | ||
+ crtc_state->adjusted_mode.hsync_end - | ||
+ crtc_state->adjusted_mode.hsync_start < 1) | ||
return -EINVAL; | ||
|
||
+ crtc_state->adjusted_mode.hdisplay = | ||
+ DIV_ROUND_CLOSEST(crtc_state->adjusted_mode.hdisplay * | ||
+ reference_mode->clock, | ||
+ crtc_state->adjusted_mode.clock); | ||
+ crtc_state->adjusted_mode.hsync_start = | ||
+ DIV_ROUND_CLOSEST(crtc_state->adjusted_mode.hsync_start * | ||
+ reference_mode->clock, | ||
+ crtc_state->adjusted_mode.clock); | ||
+ crtc_state->adjusted_mode.hsync_end = | ||
+ DIV_ROUND_CLOSEST(crtc_state->adjusted_mode.hsync_end * | ||
+ reference_mode->clock, | ||
+ crtc_state->adjusted_mode.clock); | ||
+ crtc_state->adjusted_mode.htotal = | ||
+ DIV_ROUND_CLOSEST(crtc_state->adjusted_mode.htotal * | ||
+ reference_mode->clock, | ||
+ crtc_state->adjusted_mode.clock); | ||
+ crtc_state->adjusted_mode.clock = reference_mode->clock; | ||
+ | ||
+ if (crtc_state->adjusted_mode.htotal != reference_mode->htotal) | ||
+ return -EINVAL; | ||
+ | ||
+ if (crtc_state->adjusted_mode.hsync_end - | ||
+ crtc_state->adjusted_mode.hsync_start < 1) | ||
+ crtc_state->adjusted_mode.hsync_end = | ||
+ crtc_state->adjusted_mode.hsync_start + 1; | ||
+ | ||
+ crtc_state->adjusted_mode.crtc_clock = crtc_state->adjusted_mode.clock; | ||
+ crtc_state->adjusted_mode.crtc_hdisplay = crtc_state->adjusted_mode.hdisplay; | ||
+ crtc_state->adjusted_mode.crtc_hsync_start = crtc_state->adjusted_mode.hsync_start; | ||
+ crtc_state->adjusted_mode.crtc_hsync_end = crtc_state->adjusted_mode.hsync_end; | ||
+ crtc_state->adjusted_mode.crtc_htotal = crtc_state->adjusted_mode.htotal; | ||
+ | ||
switch (reference_mode->vtotal) { | ||
case 525: | ||
if (crtc_state->adjusted_mode.crtc_vdisplay < 1 || |
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, what does this commit do exactly? I know it's about the composite "240p" output, which I always use btw, but what does this patch do to it?
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in Lakka 3.5.1 we added the support with other patches from @kFYatek. Some patches got merged upstream/raspberry. The others (here) were submitted as separate PR, are not yet merged.
As the code-base changed (the Linux version for RPi used by Lakka/LibreELEC was updated), the original patches did not work, so I removed them (in separate commit) and added re-based patches from the PR (link in commit message).
This commit adds basically the same support to 4.0 that was added in 3.5.1.
To make sure, you can test next nightly or image from here:
https://nightly.builds.lakka.tv/PRs/pr_1624_000460/
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok thanks for the info and builds! Will test soon.
BUT I can already tell you something:
I flashed a 4.0 nightly from about 2 days ago (Lakka-RPi4.aarch64-nightly-v4.x-20220304-e6a5bb5)
and the 240p output worked perfectly well! But, it looked too bright, but I found that disabling the "enable_tvout=1" line made the colors look normal.
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it worked, because it was using older kernel (5.10.76 iirc), where the patch applied without any issues (but I'm still glad that it worked - I have no way of confirming on my end). Yesterday LibreELEC released 10.0.2 and I started merging it into our Lakka v4.x branch. As I was testing and fixing stuff, this patch popped out as failing, so first I removed it completely and then after searching I found the PR with the scaling and grabbed those updated patches (I wouldn't dare to re-base the patches on my own).
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All right! Sorry it took me forever to test but I'm finally able to, aaaand it doesn't work haha.
The screen is completely black.
Normally I can see the Lakka resizing process when it first boots on a CRT, with the Lakka icon. But with the image from the link you posted, it looks completely black.
I can tell it's working though, because it will flicker after a few seconds just like when it's done resizing and restarts.
(Hmmm I think I've written those exact words somewhere before! Ah yes it's that old thread. #1290 (comment))
I've tested only Pi3B+.
I do have a Pi4B, let me know if that needs testing too.
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just out of curiosity - you've added those extra lines to config.txt, as described in the original issue / wiki?
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I always do that since I always use my CRT as my main kind of TV for Lakka. The same exact config that gets me AV out to work on the nightly from March 4 2022 just gives me black on this one.
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you, please, give me exact image names that give output and that don't give ouput?
E.g.:
This will help narrowing down, where the problem might be.
Thank you!
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AV out works!
I thought I'd note this because I've never seen this before, probably unimportant but hey!
It has a small weird behavior where it waits a few seconds to show up even though it's already working before showing up on the TV.
Meaning that when the resizing process appeared on the TV, it was already in the middle of the process all of a sudden, it didn't show the beginning of it.
When it starts RetroArch, it appears black at first for a few seconds and then shows up already inside the XMB. Normally I see the Lakka icon first for a few seconds. (Meaning that the icon was likely there and the image just didnt get sent to the TV until later)
Lakka-RPi3.aarch64-nightly-v4.x-20220304-e6a5bb5.img
AV out works!
The behavior described above did not happen and was working how I've always seen it.
Lakka-RPi3.aarch64-nightly-v4.x-20220306-4a4f17c.img
AV out works! Again, normally.
Lakka-RPi3.aarch64-nightly-v4.x-20220307-d2f7f5c.img
AV out does not work! Screen is black, and remains black forever.
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the tests, @jayare5. I asked the author of the patch/PR for help. Something changed when merging raspberrypi/linux#4406 or after re-base of raspberrypi/linux#4636.
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch! I hope it gets resolved :)
I am always happy to test things so don't hesitate to send me any future builds!
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OH my, you're not gonna believe this. I took the liberty of messing with it given it's now confirmed something changed. And I found out how to make it work! I literally had went to sleep but got out of bed to try an idea xD
I added
,composite=1
at the end of the dtoverlay line from distroconfig.txt... it just works fine now!This was something that had to be done for the Pi4 but not the Pi3.
Why I felt like trying that, I don't know XD it certainly isn't there in an older Pi3 image I have that also works fine.
The new line as a whole says
dtoverlay=vc4-kms-v3d,composite=1
Alternatively, one can just add this line to config.txt and leave distroconfig.txt alone.
Anyway, do let us know what the author says just in case there's anything else to know. In the end I guess only the wiki needs to be updated :P
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, great news :-)
So in the end the instructions for Pi3 and Pi4 are the same? I will update wiki accordingly.
Again, thank you for your tests and experimentation!
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It got more similar but not quite the same yet!
Pi3 does not require the
enable_tvout=1
line.And the dtoverlay is different as it has a -pi4 added for the Pi4 version.
And you're welcome! It is the least I can do :D
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wiki is now updated - https://github.com/libretro/Lakka-LibreELEC/wiki/Raspberry-Pi#composite-output
If it is wrong, let me know :-)
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything except one thing looks correct! Did you delete the
enable_tvout=1
from the Pi4 instructions?Because that one I think remains true for Pi4, I was only saying that it doesn't go on the Pi3 instructions so they aren't the same :)
Oh wait nevermind I see it now!
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey I have something to report!
I've continued to use this build of Lakka to see if everything works. But are some things supposed to be missing? I get no audio.
I already know that with Lakka we've had to use a custom audio device config line, saying either
default:CARD=vc4hdmi
for HDMI ordefault:CARD=Headphones
for composite out. However, the Headphones one does not work. (Meaning the AV out of course)Using the Raspberry Pi 3 with an HDMI monitor and using the vc4hdmi line, it does get me sound and lets me see what devices are available if I go to that option and press left and right!
I also know that we had to SSH into Lakka and use a command to display the available devices, so just to be sure I did that and this is what I get:
(No Headphone one, none of these work through the composite out)
Side note: Mupen64 Plus Next doesn't work. I mean I know that core only works every 10 builds, but this time it's different, it will attempt to load it, the screen will go black (to where it says the Lakka version on the top left) and stay there forever.
Just saying in case this gives any hints :P I thought it wasn't working because of the lack of "Headphones" device (which DOES cause some core to behave differently!) but it happened when connected to HDMI too.
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to me it looks like the analog audio connector is not initialized. I googled a bit and found that following needs to be present in
config.txt
:can you check if it is present?
EDIT: I checked the buildsystem, we are adding
dtparam=audio=on
todistroconfig.txt
, but we are missing thedtoverlay=pisound
part. please, add it manually, preferably before the line withdtparam=audio=on
(but not sure if the order matters).20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much!!! It works now.
I did try a lot of different things, and the 2 alternative ways that work are:
config.txt
the way you put it there, both lines have to be present inconfig.txt
even though thedistroconfig.txt
already hasdtparam=audio=on
or else it didn't work.dtoverlay=pisound
manually todistroconfig.txt
before thedtparam=audio=on
just as you suggest in your edit! The order matters, so switching their placement did not produce sound.It's time to see how things are on the Pi4! I don't think I have an image with this update? Send me a link when you can :)
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I will add that to wiki.
For RPi4 you can download latest nightly, but you will have to make changes to the config files as for RPi3 probably for the audio and video to go through analog.
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And maybe I should remove
enable_tvout=1
from the RPi4 instructions?You mentioned (20ee335#commitcomment-68095065) that colors were too bright before you disabled it. But maybe test before with current nightly build to confirm this.
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I tested Pi4 and followed the Wiki directly just to make sure the info there doesn't have any errors!
It turns out that everything is correct for the Pi4, you don't need to make changes! Yes even the thing I had a problem with the brightness did not happen now. I tried what I could to replicate it with my personal config files that I always copy to the microSD whenever I flash a new image, but it didn't happen.
But there's a little more.
enable_tvout=1
itself doesn't seem necessary because it can send the signal just fine without it, I only putdtoverlay=vc4-kms-v3d-pi4,composite=1
in the config.txt and it works. BUT I'd still prefer you don't remove it from the instructions because we know the Pi4 once needed it at least, who knows if an update in the future is gonna make this option necessary again, don't want to make you have to edit the wiki again at that point. I will personally be always including it in my Pi4 images until I find a problem, then I'll report.Anyway the bottom line is you don't need to change the instructions!! :D
Btw I noticed that now the distroconfig.txt looks different:
dtoverlay=vc4-kms-v3d,cma-512
not sure what cma-512 does.Oh wait a minute I DID notice something that you might need to edit. There seem to be spaces before each line that arent there for the others:
Oh, one more thing (sorry, so much info lol!) it seems the Pi4 did not need the dtoverlay=pisound option, I was getting sound just fine.
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the wiki. Not exactly sure what
cma-512
does, but it seems it is related to memory (reserving some memory for cpu/gpu...?).20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh ok, we'll see how it goes then! The wiki looks perfect now :D
Other than that, Lakka 4.x is looking really solid! Haven't found any other issues.
20ee335
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ToKe79 Your help is needed once again :(
I just flashed Lakka 4.2, composite gets stuck on the Lakka icon.
Edit: What... so I got back to it again and now it loads?
I have no idea how these mysterious devices work sometimes. I was here last night trying several times and it wouldn't get past the Lakka icon after waiting minutes. Today I edit a file and it works. But I reverted the file to before I edited it and it still works. This makes no sense!!!!! Ah well, sorry to bother ya man :P (no need to do anything, you can ignore but I'll leave this here just in case I find something out down the line but I doubt it.)
Edit2: Whoa I figured it out... it turns out that now I have to unplug the HDMI cable if I try to use composite.
Literally unplugging the HDMI cable while it's stuck, gets it unstuck and proceeds to RetroArch. I think this must be some new behavior that took me by surprise :P PERHAPS you could do something about this after all! Which is, you could update the wiki with a note explaining to make sure HDMI is unplugged or something because it can get stuck?
Edit3: Hey I found a new thing. So it used to be that to get audio through HDMI, I needed to have
audio_device = "default:CARD=vc4hdmi"
in retroarch.cfg. This used to be true for both Pi3 and Pi4, but now Pi4 requires me to have a 0 or 1 added at the end (Im assuming depending on which port I'm using) soaudio_device = "default:CARD=vc4hdmi0"