driver/fb: add fb_get_planeinfo and initialize local variable pinfo

VELAPLATFO-11808

Change-Id: I32db03d52b778cc7dd1784adea0a432976fde6bf
Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
This commit is contained in:
jianglianfang 2023-07-21 16:33:48 +08:00 committed by Xiang Xiao
parent 6536ddcdcf
commit 43ea7e65e1

View File

@ -98,6 +98,9 @@ static int fb_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup);
static int fb_get_panelinfo(FAR struct fb_chardev_s *fb,
FAR struct fb_panelinfo_s *panelinfo);
static int fb_get_planeinfo(FAR struct fb_chardev_s *fb,
FAR struct fb_planeinfo_s *pinfo,
uint8_t display);
/****************************************************************************
* Private Data
@ -429,9 +432,8 @@ static int fb_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
FAR struct fb_planeinfo_s *pinfo =
(FAR struct fb_planeinfo_s *)((uintptr_t)arg);
DEBUGASSERT(pinfo != 0 && fb->vtable != NULL &&
fb->vtable->getplaneinfo != NULL);
ret = fb->vtable->getplaneinfo(fb->vtable, fb->plane, pinfo);
DEBUGASSERT(pinfo != 0);
ret = fb_get_planeinfo(fb, pinfo, pinfo->display);
}
break;
@ -701,16 +703,14 @@ static int fb_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
(FAR struct fb_var_screeninfo *)((uintptr_t)arg);
DEBUGASSERT(varinfo != 0 && fb->vtable != NULL &&
fb->vtable->getvideoinfo != NULL &&
fb->vtable->getplaneinfo != NULL);
fb->vtable->getvideoinfo != NULL);
ret = fb->vtable->getvideoinfo(fb->vtable, &vinfo);
if (ret < 0)
{
break;
}
memset(&pinfo, 0, sizeof(pinfo));
ret = fb->vtable->getplaneinfo(fb->vtable, fb->plane, &pinfo);
ret = fb_get_planeinfo(fb, &pinfo, 0);
if (ret < 0)
{
break;
@ -795,16 +795,14 @@ static int fb_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
(FAR struct fb_fix_screeninfo *)((uintptr_t)arg);
DEBUGASSERT(fixinfo != 0 && fb->vtable != NULL &&
fb->vtable->getvideoinfo != NULL &&
fb->vtable->getplaneinfo != NULL);
fb->vtable->getvideoinfo != NULL);
ret = fb->vtable->getvideoinfo(fb->vtable, &vinfo);
if (ret < 0)
{
break;
}
memset(&pinfo, 0, sizeof(pinfo));
ret = fb->vtable->getplaneinfo(fb->vtable, fb->plane, &pinfo);
ret = fb_get_planeinfo(fb, &pinfo, 0);
if (ret < 0)
{
break;
@ -950,15 +948,9 @@ static int fb_get_panelinfo(FAR struct fb_chardev_s *fb,
}
#endif
DEBUGASSERT(fb->vtable != NULL);
DEBUGASSERT(fb->vtable->getplaneinfo != NULL);
memset(&pinfo, 0, sizeof(pinfo));
ret = fb->vtable->getplaneinfo(fb->vtable, fb->plane, &pinfo);
ret = fb_get_planeinfo(fb, &pinfo, 0);
if (ret < 0)
{
gerr("ERROR: getplaneinfo() failed: %d\n", ret);
return ret;
}
@ -969,6 +961,33 @@ static int fb_get_panelinfo(FAR struct fb_chardev_s *fb,
return OK;
}
/****************************************************************************
* Name: fb_get_planeinfo
****************************************************************************/
static int fb_get_planeinfo(FAR struct fb_chardev_s *fb,
FAR struct fb_planeinfo_s *pinfo,
uint8_t display)
{
int ret;
DEBUGASSERT(fb->vtable != NULL);
DEBUGASSERT(fb->vtable->getplaneinfo != NULL);
memset(pinfo, 0, sizeof(struct fb_planeinfo_s));
pinfo->display = display;
ret = fb->vtable->getplaneinfo(fb->vtable, fb->plane, pinfo);
if (ret < 0)
{
gerr("ERROR: getplaneinfo() failed: %d\n", ret);
return ret;
}
return OK;
}
/****************************************************************************
* Name: fb_do_pollnotify
****************************************************************************/
@ -1110,11 +1129,9 @@ int fb_register(int display, int plane)
/* Get plane info */
DEBUGASSERT(fb->vtable->getplaneinfo != NULL);
ret = fb->vtable->getplaneinfo(fb->vtable, fb->plane, &pinfo);
ret = fb_get_planeinfo(fb, &pinfo, 0);
if (ret < 0)
{
gerr("ERROR: getplaneinfo() failed: %d\n", ret);
goto errout_with_fb;
}