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>
This commit is contained in:
parent
2b4ab6cd29
commit
83c2a7f54e
@ -110,6 +110,8 @@ static FAR struct circbuf_s *fb_get_panbuf(FAR struct fb_chardev_s *fb,
|
|||||||
static int fb_add_paninfo(FAR struct fb_chardev_s *fb,
|
static int fb_add_paninfo(FAR struct fb_chardev_s *fb,
|
||||||
FAR const union fb_paninfo_u *info,
|
FAR const union fb_paninfo_u *info,
|
||||||
int overlay);
|
int overlay);
|
||||||
|
static int fb_clear_paninfo(FAR struct fb_chardev_s *fb,
|
||||||
|
int overlay);
|
||||||
static int fb_open(FAR struct file *filep);
|
static int fb_open(FAR struct file *filep);
|
||||||
static int fb_close(FAR struct file *filep);
|
static int fb_close(FAR struct file *filep);
|
||||||
static ssize_t fb_read(FAR struct file *filep, FAR char *buffer,
|
static ssize_t fb_read(FAR struct file *filep, FAR char *buffer,
|
||||||
@ -217,6 +219,39 @@ static int fb_add_paninfo(FAR struct fb_chardev_s *fb,
|
|||||||
return ret <= 0 ? -ENOSPC : OK;
|
return ret <= 0 ? -ENOSPC : OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: fb_clear_paninfo
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
static int fb_clear_paninfo(FAR struct fb_chardev_s *fb,
|
||||||
|
int overlay)
|
||||||
|
{
|
||||||
|
FAR struct circbuf_s *panbuf;
|
||||||
|
irqstate_t flags;
|
||||||
|
|
||||||
|
DEBUGASSERT(fb != NULL);
|
||||||
|
|
||||||
|
panbuf = fb_get_panbuf(fb, overlay);
|
||||||
|
if (panbuf == NULL)
|
||||||
|
{
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Disable the interrupt when writing to the queue to
|
||||||
|
* prevent it from being modified by the interrupted
|
||||||
|
* thread during the writing process.
|
||||||
|
*/
|
||||||
|
|
||||||
|
flags = enter_critical_section();
|
||||||
|
|
||||||
|
circbuf_reset(panbuf);
|
||||||
|
|
||||||
|
/* Re-enable interrupts */
|
||||||
|
|
||||||
|
leave_critical_section(flags);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: fb_open
|
* Name: fb_open
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -861,6 +896,12 @@ static int fb_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case FBIOPAN_CLEAR:
|
||||||
|
{
|
||||||
|
ret = fb_clear_paninfo(fb, (int)arg);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case FBIOSET_VSYNCOFFSET:
|
case FBIOSET_VSYNCOFFSET:
|
||||||
{
|
{
|
||||||
fb->vsyncoffset = USEC2TICK(arg);
|
fb->vsyncoffset = USEC2TICK(arg);
|
||||||
|
@ -301,15 +301,19 @@
|
|||||||
* Argument: read-only struct
|
* Argument: read-only struct
|
||||||
* fb_planeinfo_s* */
|
* fb_planeinfo_s* */
|
||||||
|
|
||||||
#define FBIOSET_VSYNCOFFSET _FBIOC(0x0019) /* Set VSync offset in usec
|
#define FBIOPAN_CLEAR _FBIOC(0x0019) /* Pan clear */
|
||||||
|
/* Argument: read-only
|
||||||
|
* unsigned long */
|
||||||
|
|
||||||
|
#define FBIOSET_VSYNCOFFSET _FBIOC(0x001a) /* Set VSync offset in usec
|
||||||
* Argument: int */
|
* Argument: int */
|
||||||
|
|
||||||
/* Linux Support ************************************************************/
|
/* Linux Support ************************************************************/
|
||||||
|
|
||||||
#define FBIOGET_VSCREENINFO _FBIOC(0x001a) /* Get video variable info */
|
#define FBIOGET_VSCREENINFO _FBIOC(0x001b) /* Get video variable info */
|
||||||
/* Argument: writable struct
|
/* Argument: writable struct
|
||||||
* fb_var_screeninfo */
|
* fb_var_screeninfo */
|
||||||
#define FBIOGET_FSCREENINFO _FBIOC(0x001b) /* Get video fix info */
|
#define FBIOGET_FSCREENINFO _FBIOC(0x001c) /* Get video fix info */
|
||||||
/* Argument: writable struct
|
/* Argument: writable struct
|
||||||
* fb_fix_screeninfo */
|
* fb_fix_screeninfo */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user