Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust: samples: fix init argument #335

Open
wants to merge 1,040 commits into
base: asahi
Choose a base branch
from

Conversation

Bruno-Eduardo
Copy link

I was trying to compile the rust_minimal for arm64 using asahi rust/kernel and found the following error:

$ make CROSS_COMPILE="aarch64-linux-gnu-" ARCH=arm64 LLVM=1 ./samples/rust/rust_minimal.o
  CALL    scripts/checksyscalls.sh
  RUSTC [M] samples/rust/rust_minimal.o
error[E0050]: method `init` has 1 parameter but the declaration in trait `kernel::Module::init` has 2
  --> /largeFiles/linux_asahi/samples/rust/rust_minimal.rs:20:22
   |
20 |     fn init(_module: &'static ThisModule) -> Result<Self> {
   |                      ^^^^^^^^^^^^^^^^^^^ expected 2 parameters, found 1
   |
   = note: `init` from trait: `fn(&'static kernel::prelude::CStr, &'static kernel::ThisModule) -> core::result::Result<Self, kernel::error::Error>`

error: aborting due to 1 previous error

And an equivalent error for ./samples/rust/rust_print.o

After commit c96b547:
rust: Addname argument to Module::init()
init needs a name argument. Since both rust samples were made
before that, they fail to compile.

After fix:

$ make CROSS_COMPILE="aarch64-linux-gnu-" ARCH=arm64 LLVM=1 ./samples/rust/rust_minimal.o
  CALL    scripts/checksyscalls.sh
  RUSTC [M] samples/rust/rust_minimal.o
$ make CROSS_COMPILE="aarch64-linux-gnu-" ARCH=arm64 LLVM=1 ./samples/rust/rust_print.o
  CALL    scripts/checksyscalls.sh
  RUSTC [M] samples/rust/rust_print.o

jannau and others added 30 commits September 16, 2024 13:46
Prevents KDE for now to set modes not reported by IOMFB. Seen on j493
with the common display resolution of 2560x1600.

Signed-off-by: Janne Grunau <[email protected]>
Apparently what happens here is that the DCP's idea of backlight
brightness is desynced with the real brightness across power cycles.
This means that even if we just force an update after a power cycle, it
doesn't work since it considers it unchanged. To fix this, we need to
both force an update on poweron and also explicitly turn the backlight
off on poweroff, which makes DCP listen to us and actually update the
backlight state properly.

Signed-off-by: Asahi Lina <[email protected]>
…ated

On non mini-LED displays the backlight comes out of power-off (DPMS)
with minimal backlight brightness. This seems to be a DCP firmware
issue. It logs "[BrightnessLCD.cpp:743][AFK]nitsToDBV: iDAC out of
range" to syslog although the brightness in the swap_submit call is
valid.

This fixes the issue only for clients using swap. For other clients an
atomic backlight update has to be scheduled via a work queue.

Signed-off-by: Janne Grunau <[email protected]>
The hardware does not have a vblank IRQ and drm already knows how to
deal with that appropriately, so don't pretend it does.

Fixes Xorg.

Signed-off-by: Asahi Lina <[email protected]>
Selecting the mode with the highest score may result in HDR mode for
some displays. Since HDR is not support on driver side this produces
an unexpected color representation.
Full parsing allows us to reject virtual color modes (should already be
invalid due to missing "Score").
Preparation for color and timing mode tracing.

Signed-off-by: Janne Grunau <[email protected]>
Prevents trace points of unused color modes.

Signed-off-by: Janne Grunau <[email protected]>
Restrict symbol mapping for EOTF, pixel encoding and colorimetry to
tracing due to low confidence that it is correct. Main concern is the
colorimetry mapping.

Signed-off-by: Janne Grunau <[email protected]>
DCP best scored color mode might result in an HDR mode. As long as the
driver (and DRM) is not ready for HDR try to avoid such modes.

Signed-off-by: Janne Grunau <[email protected]>
Probably not important but avoids an unnecessary difference compred to
macOS.

Signed-off-by: Janne Grunau <[email protected]>
Seems to work now with 'surface.colorspace = 12'.

Signed-off-by: Janne Grunau <[email protected]>
Can be used on devices with camera notch to use the full display height
and thus show the notch.

Signed-off-by: Janne Grunau <[email protected]>
This reverts commit d395421.

'w30r' is a wide gammut mode. As long as the display is SDR DCP will end
up displaying picture correctly but on HDR displays like the display in
the Macbook Pro 14"/16" (2021) or external displays with HDR EOTF the
picture has oversaturated / black colors.

The non-wide gammut 10-bit per component pixelformats "l10r" and "R10k"
 are not supported.

Signed-off-by: Janne Grunau <[email protected]>
This works on both 8-bit and 10-bit modes without any weirdness, and
gives us the native colorspace without any conversion. Color correction
should probably be handled in software anyway.

However, we need to use surface 1 (at least on t600x), since 0 seems
stuck in bg-sRGB mode for some reason...

Signed-off-by: Hector Martin <[email protected]>
With "drm/apple: Enable 10-bit mode & set colorspace to native" kernel
log messages are shown in an Apple logo shaped region in the middle of
the display when using BGRA.
The field currently identified as "opaque" is mislabeled and has to be
investigated further.

Signed-off-by: Janne Grunau <[email protected]>
- opaque -> is_premultiplied
- swap_enabled BIT(31) seems to be update background with
  dcp_swap.bg_color
- add unused fields is_tearing_allowed, ycbcr_matrix, protection_opts,
  unk_num, unk_denom

Changes: use is_premultiplied only for XRGB8/XBGR8, Update background
only when necessary.

Signed-off-by: Janne Grunau <[email protected]>
This does not seem to be as racy as drm_aperture_remove_framebuffers()
and seems to reliably takes over simpledrm's device node.

Signed-off-by: Janne Grunau <[email protected]>
This check for the "nomodeset" kernel command line parameter in its
register method.

Signed-off-by: Janne Grunau <[email protected]>
drm's documentaion explicitly tells us not to use devm_kzalloc(). drm
device structures might out live the device when they are in use by
userspace while the device vanishes.
There was a report of a race between DRM device registration (and
removal of the simpledrm device) and GDM startup.

The component based device binding ensures that all necessary devices
are bind in the probe method of the last missing component.

Technically the piodma-mapper should be a component of dcp but since it
is only used for its iommu it can be a component of the display
subsystem.

Signed-off-by: Janne Grunau <[email protected]>
Avoids "[drm] Cannot find any crtc or sizes" during fbdev initialization
if a display is connected.

Signed-off-by: Janne Grunau <[email protected]>
Fixes following warning when systemd-backlight restores the backlight
level on boot before a mode is set:

Call trace:
  drm_atomic_helper_crtc_duplicate_state+0x58/0x74
  drm_atomic_get_crtc_state+0x84/0x120
  dcp_set_brightness+0xd8/0x21c [apple_dcp]
  backlight_device_set_brightness+0x78/0x130
  ...

Signed-off-by: Janne Grunau <[email protected]>
After commit c96b547:
    rust: Add `name` argument to Module::init()
init needs a name argument. Since both rust samples were made
    before that, they fail to compile.

Signed-off-by: Bruno Oliveira <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.