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

[FEATURE REQ] Support for NV12 sensor format #113

Open
dxwil opened this issue May 1, 2024 · 15 comments
Open

[FEATURE REQ] Support for NV12 sensor format #113

dxwil opened this issue May 1, 2024 · 15 comments

Comments

@dxwil
Copy link

dxwil commented May 1, 2024

Hi, I downloaded clight and through another issue found out that only 3 video formats are supported for the sensor. I'm running linux on an M1 Macbook Air and the built-in camera reports NV12 as the format. Is there any way for me to use clight with this built-in camera. Thanks

Driver Info: Driver name : apple-isp Card type : FaceTime HD Camera Bus info : platform:22a000000.isp Driver version : 6.8.7 Capabilities : 0x84200001 Video Capture Streaming Extended Pix Format Device Capabilities Device Caps : 0x04200001 Video Capture Streaming Extended Pix Format Priority: 2 Video input : 0 (apple-isp: ok) Format Video Capture: Width/Height : 1280/720 Pixel Format : 'NV12' (Y/UV 4:2:0) Field : None Bytes per Line : 1280 Size Image : 1382400 Colorspace : Rec. 709 Transfer Function : Rec. 709 YCbCr/HSV Encoding: Rec. 709 Quantization : Default (maps to Limited Range) Flags : Streaming Parameters Video Capture: Capabilities : timeperframe Frames per second: 30.000 (7680/256) Read buffers : 2

@FedeDP
Copy link
Owner

FedeDP commented May 7, 2024

Hi! Thanks for opening this feat req! I will move this one to Clightd repo, since it belongs there :)

It should not be much work to support NV12, i can arrange that; would you be willing to help me test the implementation?

@FedeDP FedeDP transferred this issue from FedeDP/Clight May 7, 2024
@dxwil
Copy link
Author

dxwil commented May 8, 2024

Hi, totally missed your reply. Yes, I could definitely help test it.

@dxwil
Copy link
Author

dxwil commented May 13, 2024

Good evening, not to rush or anything but are there any updates on this so far :)

@FedeDP
Copy link
Owner

FedeDP commented May 14, 2024

I just opened #115 :) can you test it?

@dxwil
Copy link
Author

dxwil commented May 14, 2024

Installed it and this is the output, weirdly enough it doesn't even mention the sensor

clight --verbose
Clightd found, version: 5.10-1cfe352.
Disarmed timerfd on fd 9.
AC screen backlight curve: y = -0.024825 + 0.191641x + -0.008928x^2
BL
^
| **
| **
| *
| *
| *
| *
|
| *
|*
|
---------->BR
BATT screen backlight curve: y = -0.010629 + 0.153844x + -0.007284x^2
BL
^
|
|
| ***
| **
| *
| *
| *
| *
|
|

---------->BR
Set timeout of 30s 0ns on fd 16.
Keyboard backlight calibration supported.
AC keyboard backlight curve: y = 0.998811 + -0.013086x + -0.008928x^2
BL
^
**
| **
| *
| *
| *
| *
|
| *
| *
|
+---------
>BR
BATT keyboard backlight curve: y = 0.799371 + -0.008156x + -0.007284x^2
BL
^
|
|


| **
| *
| *
| *
| *
|
| *
+---------*>BR
init(): Failed to get screen temperature.
Failed to init. Killing module.
Failed to create org.freedesktop.ScreenSaver dbus interface: Unknown error -1
Monitoring requests to org.freedesktop.ScreenSaver name owner.
Disarmed timerfd on fd 40.
AC cable disconnected.
Laptop lid opened.
Emitting 'AcState' property
Disarmed timerfd on fd 43.
Pausing SCREEN: TIMEOUT
Emitting 'LidState' property
Could not find location cache file.`

@FedeDP
Copy link
Owner

FedeDP commented May 14, 2024

You can also quickly test through clightd dbus api:
busctl call org.clightd.clightd /org/clightd/clightd/Sensor/Camera org.clightd.clightd.Sensor Capture "sis" "" 5 ""

@dxwil
Copy link
Author

dxwil commented May 14, 2024

I get Call failed: Connection timed out

Also interesting:
{gamma.c:61} Failed to init. Killing module.

@dxwil
Copy link
Author

dxwil commented May 14, 2024

Mora logs, this time what clightd reports back when launching clight:

May 14 17:47:40 asahi systemd[1]: Starting clightd.service - Bus service to manage various screen related properties (gamma, dpms, backlight)...
May 14 17:47:40 asahi systemd[1]: Started clightd.service - Bus service to manage various screen related properties (gamma, dpms, backlight).
May 14 17:47:40 asahi clightd[6478]: ddca_get_display_info_list2 called before ddca_init2() or ddca_init()
May 14 17:47:40 asahi libddcutil[6478]: Initializing libddcutil. ddcutil version: 2.1.2, shared library: /usr/lib64/libddcutil.so.5.1.1
May 14 17:47:40 asahi libddcutil[6478]: Library initialization complete.
May 14 17:47:40 asahi clightd[6478]: failed to set gamma table
May 14 17:47:40 asahi clightd[6478]: failed to create gamma table

@dxwil
Copy link
Author

dxwil commented May 14, 2024

You can also quickly test through clightd dbus api: busctl call org.clightd.clightd /org/clightd/clightd/Sensor/Camera org.clightd.clightd.Sensor Capture "sis" "" 5 ""

Actually now, after a reboot, I'm getting a new message:
Call failed: No such device

@dxwil
Copy link
Author

dxwil commented May 17, 2024

Good evening, any news on this? I really want to get it to work.

@FedeDP
Copy link
Owner

FedeDP commented May 20, 2024

Hi! Sorry, haven't had the time to look into it :/

Actually now, after a reboot, I'm getting a new message:

Are you sure you are running Clightd from the HEAD of the linked PR now?

@FedeDP
Copy link
Owner

FedeDP commented May 20, 2024

Anyway, reading https://stackoverflow.com/tags/nv12-nv21/info and https://paulbourke.net/dataformats/nv12/ it seems like NV12 should be very similar yo yuyv, already supported (considering Clightd only cares about intensity).

@dxwil
Copy link
Author

dxwil commented May 20, 2024

Hi! Sorry, haven't had the time to look into it :/

Actually now, after a reboot, I'm getting a new message:
Are you sure you are running Clightd from the HEAD of the linked PR now?

In the clight log it shows the clightd version and commit, which is the same as the one in that branch. At this point I have no idea what's going on. When I launch clight it says absolutely nothing about a sensor, I've looked at other people's logs and there's always something to do with a sensor, and I also remember the old version said that my sensor is not detected or something like that. Now there's simply nothing.

@FedeDP
Copy link
Owner

FedeDP commented May 20, 2024

In the clight log it shows the clightd version and commit,

Yes i saw that! I thought that perhaps after the reboot the original Clightd was running instead of the one from the PR head. Never mind :)

Can you share the whole Clight log file (https://github.com/FedeDP/Clight/wiki/FAQ#where-is-clight-log) ?

@dxwil
Copy link
Author

dxwil commented May 20, 2024

(W)[10:55:06]{config.c:408} Config file /home/dxwil/.config/clight.conf not found.

Clight

  • Software version: 4.12-a4d4762
  • Global config dir: /etc/clight
  • Global data dir: /usr/share/clight
  • Starting time: Mon May 20 10:55:06 2024

Starting options:

GENERIC

  • Verbose (debug): Disabled
  • ResumeDelay: 0

BACKLIGHT

  • Smooth trans: Enabled
  • Smooth step: 0.05
  • Smooth timeout: 30
  • Smooth fixed: 0
  • Daily timeouts: AC 600 BATT 1200
  • Nightly timeouts: AC 2700 BATT 5400
  • Event timeouts: AC 300 BATT 600
  • Shutter threshold: 0.00
  • Autocalibration: Enabled
  • Pause on lid closed: Disabled
  • Capture on lid opened: Disabled
  • Restore On Exit: Disabled
  • Delay on hotplug: 0

SENSOR

  • Captures: AC 5 BATT 5
  • Device: Unset
  • Settings: Unset

KEYBOARD

  • Timeouts: AC 15 BATT 5

GAMMA

  • Smooth trans: Enabled
  • Smooth steps: 50
  • Smooth timeout: 300
  • Daily screen temp: 6500
  • Nightly screen temp: 4000
  • Long transition: Disabled
  • Ambient gamma: Disabled
  • Restore On Exit: Disabled

DAYTIME

  • User position: Unset
  • User set sunrise: Unset
  • User set sunset: Unset
  • Event duration: 1800
  • Sunrise offset: 0
  • Sunset offset: 0

DIMMER

  • ENTER Smooth trans: Enabled
  • ENTER Smooth step: 0.05
  • ENTER Smooth timeout: 30
  • ENTER Smooth fixed: 0
  • EXIT Smooth trans: Enabled
  • EXIT Smooth step: 0.05
  • EXIT Smooth timeout: 30
  • EXIT Smooth fixed: 0
  • Timeouts: AC 45 BATT 20
  • Backlight pct: 0.20

DPMS

  • Timeouts: AC 900 BATT 300

SCREEN

  • Timeouts: AC 5 BATT -1

INHIBIT

  • Docked: Disabled
  • PowerManagement: Disabled
  • Backlight: Disabled

(I)[10:55:06]{main.c:145} Clightd found, version: 5.10-1cfe352.
(I)[10:55:06]{keyboard.c:159} Keyboard backlight calibration supported.
(W)[10:55:06]{gamma.c:61} Failed to init. Killing module.
(I)[10:55:06]{interface.c:176} Monitoring requests to org.freedesktop.ScreenSaver name owner.
(I)[10:55:06]{upower.c:55} AC cable disconnected.
(I)[10:55:06]{upower.c:66} Laptop lid opened.
(I)[10:55:06]{location.c:107} New location received: 48.11, 11.61.
(I)[10:55:06]{daytime.c:197} Next alarm due to: Mon May 20 20:19:00 2024

And then after that last message it hangs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants