Clightd icon indicating copy to clipboard operation
Clightd copied to clipboard

[FEATURE REQ] Support for NV12 sensor format

Open dxwil opened this issue 1 year ago • 15 comments

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

dxwil avatar May 01 '24 16:05 dxwil

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 avatar May 07 '24 09:05 FedeDP

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

dxwil avatar May 08 '24 23:05 dxwil

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

dxwil avatar May 13 '24 18:05 dxwil

I just opened https://github.com/FedeDP/Clightd/pull/115 :) can you test it?

FedeDP avatar May 14 '24 07:05 FedeDP

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.`

dxwil avatar May 14 '24 12:05 dxwil

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 ""

FedeDP avatar May 14 '24 12:05 FedeDP

I get Call failed: Connection timed out

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

dxwil avatar May 14 '24 13:05 dxwil

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 avatar May 14 '24 15:05 dxwil

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 avatar May 14 '24 17:05 dxwil

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

dxwil avatar May 17 '24 14:05 dxwil

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 avatar May 20 '24 07:05 FedeDP

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).

FedeDP avatar May 20 '24 07:05 FedeDP

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.

dxwil avatar May 20 '24 08:05 dxwil

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) ?

FedeDP avatar May 20 '24 08:05 FedeDP

(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

dxwil avatar May 20 '24 08:05 dxwil