drivers/video/fb: fix poll event lost

Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
pengyiqiang 2023-02-24 17:21:25 +08:00 committed by Xiang Xiao
parent b7bfd9e530
commit 621bf54efc
2 changed files with 22 additions and 2 deletions

View File

@ -58,6 +58,7 @@ struct fb_chardev_s
size_t fblen; /* Size of the framebuffer */
uint8_t plane; /* Video plan number */
uint8_t bpp; /* Bits per pixel */
volatile bool pollready; /* Poll ready flag */
};
/****************************************************************************
@ -160,6 +161,8 @@ static ssize_t fb_write(FAR struct file *filep, FAR const char *buffer,
inode = filep->f_inode;
fb = (FAR struct fb_chardev_s *)inode->i_private;
fb->pollready = false;
/* Get the start and size of the transfer */
start = filep->f_pos;
@ -526,6 +529,14 @@ static int fb_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
DEBUGASSERT(pinfo != NULL && fb->vtable != NULL &&
fb->vtable->pandisplay != NULL);
ret = fb->vtable->pandisplay(fb->vtable, pinfo);
fb->pollready = false;
}
break;
case FBIO_CLEARNOTIFY:
{
fb->pollready = false;
ret = OK;
}
break;
@ -725,6 +736,11 @@ static int fb_poll(FAR struct file *filep, struct pollfd *fds, bool setup)
{
return -EBUSY;
}
if (fb->pollready)
{
poll_notify(&fb->fds, 1, POLLOUT);
}
}
else if (fds->priv)
{
@ -754,6 +770,8 @@ void fb_pollnotify(FAR struct fb_vtable_s *vtable)
fb = vtable->priv;
fb->pollready = true;
/* Notify framebuffer is writable. */
poll_notify(&fb->fds, 1, POLLOUT);

View File

@ -286,12 +286,14 @@
* Argument: read-only struct
* fb_planeinfo_s* */
#define FBIO_CLEARNOTIFY _FBIOC(0x0017) /* Clear notify signal */
/* Linux Support ************************************************************/
#define FBIOGET_VSCREENINFO _FBIOC(0x0017) /* Get video variable info */
#define FBIOGET_VSCREENINFO _FBIOC(0x0018) /* Get video variable info */
/* Argument: writable struct
* fb_var_screeninfo */
#define FBIOGET_FSCREENINFO _FBIOC(0x0018) /* Get video fix info */
#define FBIOGET_FSCREENINFO _FBIOC(0x0019) /* Get video fix info */
/* Argument: writable struct
* fb_fix_screeninfo */