Skip to content

Commit

Permalink
Merge pull request #39 from hungyuhang/master
Browse files Browse the repository at this point in the history
Fix build failures with Linux v6.8+
  • Loading branch information
jserv authored Jul 15, 2024
2 parents d39b6ea + d6e9d4b commit 7156b86
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
25 changes: 17 additions & 8 deletions fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "fb.h"

struct vcamfb_info {
struct fb_info info;
struct fb_info *info;
void *addr;
unsigned int offset;
char name[FB_NAME_MAXLENGTH];
Expand Down Expand Up @@ -363,7 +363,10 @@ int vcamfb_init(struct vcam_device *dev)
/* malloc vcamfb_info */
fb_data = vmalloc(sizeof(struct vcamfb_info));
dev->fb_priv = (void *) fb_data;
info = &fb_data->info;

/* malloc fb_info */
fb_data->info = framebuffer_alloc(0, &dev->vdev.dev);
info = fb_data->info;

/* malloc framebuffer and init framebuffer */
size = dev->input_format.sizeimage * 2;
Expand Down Expand Up @@ -402,8 +405,6 @@ int vcamfb_init(struct vcam_device *dev)
info->fbops = &vcamfb_ops;
info->par = dev;
info->pseudo_palette = NULL;
info->flags = FBINFO_FLAG_DEFAULT;
info->device = &dev->vdev.dev;
INIT_LIST_HEAD(&info->modelist);

/* set the fb_cmap */
Expand All @@ -428,25 +429,33 @@ int vcamfb_init(struct vcam_device *dev)

fb_alloc_failure:
fb_dealloc_cmap(&info->cmap);
framebuffer_release(info);
return -EINVAL;
}

void vcamfb_destroy(struct vcam_device *dev)
{
struct vcamfb_info *fb_data = (struct vcamfb_info *) dev->fb_priv;
struct fb_info *info = &fb_data->info;
struct fb_info *info;

if (!fb_data)
return;

info = fb_data->info;
if (info) {
unregister_framebuffer(info);
vfree(fb_data->addr);
fb_dealloc_cmap(&info->cmap);
vfree(dev->fb_priv);
framebuffer_release(info);
}

vfree(fb_data->addr);
vfree(fb_data);
}

void vcamfb_update(struct vcam_device *dev)
{
struct vcamfb_info *fb_data = (struct vcamfb_info *) dev->fb_priv;
struct fb_info *info = &fb_data->info;
struct fb_info *info = fb_data->info;
struct vcam_in_queue *q = &dev->in_queue;

/* remalloc the framebuffer and vcam_in_queue */
Expand Down
4 changes: 4 additions & 0 deletions videobuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ int vcam_out_videobuf2_setup(struct vcam_device *dev)
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
q->ops = &vcam_vb2_ops;
q->mem_ops = &vb2_vmalloc_memops;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
q->min_queued_buffers = 2;
#else
q->min_buffers_needed = 2;
#endif
q->lock = &dev->vcam_mutex;

return vb2_queue_init(q);
Expand Down

0 comments on commit 7156b86

Please sign in to comment.