Commit Graph

281 Commits

Author SHA1 Message Date
Xiang Xiao b068e2357a circbuf: Move from mm/circbuf to libs/libc/misc
so that it can be used by userspace program.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
2024-10-09 08:41:49 +08:00
Xu Xingliang f51a9d5ac5 drivers/fb: use ENOTTY to replace assert
Some drivers may not implement certain ioctls, but applications
may still call these ioctl functions for consistency.
In this case, to avoid an assertion, return ENOTTY.

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-10-08 23:23:26 +08:00
jianglianfang 7db5e6bdb0 driver: add GOLDFISH_GPU_FB_PRIORITY for goldfish_gpu_fb_vsync_thread
We need to configure the priority of FB Vsync thread to prevent nxcamera from preempting scheduling without sleep, which currently causes issues with Goldfish x86_64's default FIFO scheduling.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2024-10-08 23:23:08 +08:00
rongyichang 83c2a7f54e drivers/fb: add panbuffer clear ioctl
Some devices need to clear the fb panbuf when waking up from sleep
to avoid outputting residual buffers from before sleeping

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2024-09-13 09:15:38 +08:00
jianglianfang 7abd460131 fb:add select overlay FB_NO_OVERLAY
It is expected that select_overlay can switch from overlay to main
plane.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2024-08-26 16:26:53 +08:00
Petro Karashchenko d499ac9d58 nuttx: fix multiple 'FAR', 'CODE' and style issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00
Petro Karashchenko d252b6229f nuttx: use sizeof instead of define or number in snprintf
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00
jianglianfang 4d42fdf195 video/fb: changed circbuf_write assert to warning
Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2024-08-22 15:33:56 +08:00
shizhenghui 04dfae545c video/v4l2_cap: fix sign extension
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2024-08-21 23:29:47 +08:00
jianglianfang 1e29b8de1d driver/fb:remove overlay from fb_notify_vsync
Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2024-08-21 02:57:08 +08:00
jianglianfang 468617096e goldfish_fb: add notify vsync
Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2024-08-21 02:57:08 +08:00
jianglianfang 8122cbd5d2 drivers/video: add fb_vsync_pollnotify
when the vsync comes, fb drivers should call fb_vsync_pollnotify to notify POLLPRI, so that users can catch the synchronization time of vsync and do something.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2024-08-21 02:57:08 +08:00
rongyichang 8c3872b919 drivers/video: add goldfish gpu fb
In order to better use the Android goldfish emulator,
a GPU FB driver has been added. This allows the goldfish
emulator  side to achieve more flexible display effects,
such as UI skins.

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
2024-08-18 10:15:00 +08:00
shizhenghui 80da796897 video/v4l2_cap: fix no return after checked null
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2024-06-22 11:50:25 -03:00
shizhenghui aa451d3740 video/v4l2_cap: fix use after free
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2024-06-22 11:50:25 -03:00
shizhenghui 47905c9132 video/v4l2_cap: fix dereference before null check
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2024-06-22 11:50:25 -03:00
shizhenghui 33b539a07d video/v4l2_cap: fix type overflow
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2024-06-22 11:50:25 -03:00
yangsen5 33b5e1414c arch/sim_encoder: g_bufsize initialization error in g_sim_encoder_ops structure
Signed-off-by: yangsen5 <yangsen5@xiaomi.com>
2024-05-15 22:03:18 +08:00
shizhenghui ed1ad1be65 Add v4l2m2m & sim decoder
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2024-05-15 22:03:18 +08:00
jianglianfang a7961a3d48 driver/vnc:fix vnc kbd assert cause by wrong data conversion
Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2024-05-13 18:12:48 +08:00
simbit18 792b99473c fix nxstyle
corrected comments in C89 style
2024-05-09 23:44:40 +08:00
Yanfeng Liu 9d6e2b97fb video/fb: add munmap support
This adds support to user-space munmap() requests in kernel build.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-05-05 22:01:26 +08:00
Yanfeng Liu 041ef1d9ea video/fb: kernel build framebuffer support
This supports running fb demo app in kernel build with new
config `rv-virt/kfb64`. The demo shows colored rectangles
in graphic window with the following console logs:

```
nsh> cat /proc/version
NuttX version 12.4.0 1ea10ddacc-dirty May  3 2024 07:03:59 rv-virt/kfb64
nsh> fb
VideoInfo:
      fmt: 13
     xres: 640
     yres: 480
  nplanes: 1
PlaneInfo (plane 0):
    fbmem: 0x80218010
    fblen: 1228800
   stride: 2560
  display: 0
      bpp: 32
Mapped FB: 0xc2000010
 0: (  0,  0) (640,480)
 1: ( 58, 43) (524,394)
 2: (116, 86) (408,308)
 3: (174,129) (292,222)
 4: (232,172) (176,136)
 5: (290,215) ( 60, 50)
Test finished
```

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-05-03 23:58:39 +08:00
Xiang Xiao 81c8f902b6 video: Move video_format_s from video.h to v4l2_cap.c
since it is only used in v4l2_cap.c.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-04-14 12:08:30 -03:00
jianglianfang 62a4799409 video/vnc: add vnc_fb_register
To optimize the initialization of vnc, change it to vnc_fb_register.

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
2024-04-12 17:42:49 +08:00
SPRESENSE d5c654914e drivers/video/isx019: Fix default_value of 3A status
Fix default_value of ioctl(VIDIOC_QUERYCTRL)(id=V4L2_CID_3A_STATUS)
to AE operating and AWB operating, because both AE and AWB are
automatical adjustment mode by default.
2024-03-29 16:05:37 +08:00
SPRESENSE 33485cfe7c drivers/video/isx019: Fix the default_value of some parameters
Because the exposure time and ISO sensitivity are adjusted automatically
by default, the default value can not be defined.
So, return the value out of range as the default_value of
ioctl(VIDIOC_QUERYCTRL).
2024-03-26 20:52:28 +08:00
Xiang Xiao 79f834dcbb video: Make v4l2_ops_s to support the mutilple context
which is useful in the m2m usage scenario, by replacing the first
argument of callback from "struct v4l2_ops_s *" to "struct file *"

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-03-26 15:21:05 +08:00
Xiang Xiao c6821c741d video_framebuff: Replace critical section with spinlock
to avoid th global big lock and improve the performance.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-03-26 15:21:05 +08:00
Xiang Xiao 0db82210fd video_framebuff: Hold mutex in video_framebuff_realloc_container
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-03-26 15:21:05 +08:00
Xiang Xiao efee5f86e8 video_framebuff: Remove the unnecessary vbuf_curr field
since vbuf_curr is always equal to vbuf_next

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-03-26 15:21:05 +08:00
yaojingwei 25e7d9e43e video: add video buffer overflow warning info.
Signed-off-by: yaojingwei <yaojingwei@xiaomi.com>
2024-03-26 15:21:05 +08:00
shizhenghui fa1b55d297 v4l2-cap: Add FAR to pointer
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2024-03-26 15:21:05 +08:00
yaojingwei f03a1a14f3 video: move user define mem_ops into imgdata_ops.
Signed-off-by: yaojingwei <yaojingwei@xiaomi.com>
2024-03-26 15:21:05 +08:00
yaojingwei 64aecbcc5c video: add user define memory ops for v4l2 frame buffers.
Signed-off-by: yaojingwei <yaojingwei@xiaomi.com>
2024-03-26 15:21:05 +08:00
SPRESENSE 1d2fcc81f4 drivers/video/isx012: Make the I2C access more efficient
Store the i2c configuration in power on
because they are not changed permanently.
2024-03-26 07:41:21 +01:00
SPRESENSE d9f9c0143c drivers/video/isx019: Make the I2C access more efficient
Store the length of address and the frequency in power on
because they are not changed permanently.
2024-03-26 07:41:21 +01:00
shizhenghui 3afd26bcd1 Add ioctl interface used in v4l2m2m
Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2024-03-21 19:23:53 +08:00
shizhenghui 255090d594 Refactor nuttx v4l2
Adjust the v4l2 framework to support both capture and v4l2m2m,
and can easily add other v4l2 features.

Signed-off-by: shizhenghui <shizhenghui@xiaomi.com>
2024-03-13 09:51:08 +08:00
yaojingwei c3a3f79741 video: extend imgsensor_s interface for getting sensor device params.
Signed-off-by: yaojingwei <yaojingwei@xiaomi.com>
2024-03-13 09:51:08 +08:00
SPRESENSE bac0228825 drivers/video/isx012: Fix buffer overrun of isx012_putreg()
The maximum size of ISX012 register is 4 bytes.
So, extend temporary buffer size.

Detected by CodeSonar 141893
2024-03-11 15:44:39 +01:00
SPRESENSE 3419f018a4 drivers/video/isx019: Delete unnecessary code
Because of misunderstanding spec, unnecessary codes exist.
Delete them.
2024-03-11 15:44:39 +01:00
SPRESENSE baa2dc5cad drivers/video/isx019: Store initial gamma value
Set initial gamma value to enable application to get
the correct initial gamma value.
2024-03-11 15:44:39 +01:00
SPRESENSE 2b04210b16 drivers/video/isx019: Fix default ISO sensitivity
ISX019's ISO sensitivity is in auto adjustment mode by default.
Then, default ISO sensitivity value should be auto adjusted value.
2024-03-11 15:44:39 +01:00
SPRESENSE ae970a8ed3 drivers/video: Fix bug that can not use scene mode
Because the mode is set in scene parameter table,
All scene modes was recognized as disabled.
2024-03-11 15:44:39 +01:00
SPRESENSE 8f0ed67339 drivers/video/isx019: Fix mismatch bug of HUE value
Because the ratio between API value and ISX019 register value
is 128 : 90 about HUE, some different API values become the
same register value.
So, store the value specified by application in setting,
and return the stored value in getting so that the gotten value
is the same as the setting value by application.
2024-03-11 15:44:39 +01:00
SPRESENSE de3bee313e drivers/video/isx019: Fix control type about some parameters
About IMGSENSOR_ID_EXPOSURE_AUTO, IMGSENSOR_ID_ISO_SENSITIVITY_AUTO,
and IMGSENSOR_ID_EXPOSURE_METERING, enumerations are defined.
So, control type should be not integer but integer menu.
2024-03-11 15:44:39 +01:00
SPRESENSE 865c88e34b drivers/video: Add elems setting
Add elems setting to ioctl(VIDIOC_QUERY_EXT_CTRL)
for V4L2 compatibility.
2024-03-11 15:44:39 +01:00
SPRESENSE fd5c2d4922 drivers/video/isx019: Fix bug that read value is not correct
About parameter whose register size is less than 4 bytes,
when transfer read value to API parameter, cast appropriately
to avoid the following problems.
- Read value includes garbage value
- Negative value becomes huge positive value
2024-03-11 15:44:39 +01:00
SPRESENSE 33f7923d72 drivers/video/isx019: Fix bug that initial exposure time is not correct
Because exposure time calculation needs the cxd56xx clock value,
get the cxd56xx clock value before saving initial value.
2024-03-11 15:44:39 +01:00