mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
drivers/video: Refine the update region notification mechanism
1.Expose the notification through fb_vtable_s::updatearea 2.Incorporate old nx_notify_rectangle into the new updatearea callback 3.Migrate the calle of nx_notify_rectangle to fb_vtable_s::updatearea Change-Id: Ia3d1f73e8757b2d381586d76ec6adc16c810018d Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
@@ -109,6 +109,11 @@ static int up_setcursor(FAR struct fb_vtable_s *vtable,
|
||||
FAR struct fb_setcursor_s *settings);
|
||||
#endif
|
||||
|
||||
/* Update the host window when there is a change to the framebuffer */
|
||||
|
||||
static int up_updateearea(FAR struct fb_vtable_s *vtable,
|
||||
FAR const struct fb_area_s *area);
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
@@ -403,6 +408,44 @@ static int up_setcursor(FAR struct fb_vtable_s *vtable,
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_updateearea
|
||||
****************************************************************************/
|
||||
|
||||
static int up_updateearea(FAR struct fb_vtable_s *vtable,
|
||||
FAR const struct fb_area_s *area)
|
||||
{
|
||||
FAR struct vnc_fbinfo_s *fbinfo = (FAR struct vnc_fbinfo_s *)vtable;
|
||||
FAR struct vnc_session_s *session;
|
||||
struct nxgl_rect_s rect;
|
||||
int ret = OK;
|
||||
|
||||
DEBUGASSERT(fbinfo != NULL && area != NULL);
|
||||
|
||||
/* Recover the session information from the display number in the planeinfo
|
||||
* structure.
|
||||
*/
|
||||
|
||||
DEBUGASSERT(fbinfo->display >= 0 && fbinfo->display < RFB_MAX_DISPLAYS);
|
||||
session = g_vnc_sessions[fbinfo->display];
|
||||
|
||||
/* Verify that the session is still valid */
|
||||
|
||||
if (session != NULL && session->state == VNCSERVER_RUNNING)
|
||||
{
|
||||
/* Queue the rectangular update */
|
||||
|
||||
nxgl_area2rect(&rect, area);
|
||||
ret = vnc_update_rectangle(session, &rect, true);
|
||||
if (ret < 0)
|
||||
{
|
||||
gerr("ERROR: vnc_update_rectangle failed: %d\n", ret);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: vnc_start_server
|
||||
*
|
||||
@@ -774,6 +817,7 @@ FAR struct fb_vtable_s *up_fbgetvplane(int display, int vplane)
|
||||
fbinfo->vtable.getcursor = up_getcursor,
|
||||
fbinfo->vtable.setcursor = up_setcursor,
|
||||
#endif
|
||||
fbinfo->vtable.updatearea = up_updateearea,
|
||||
fbinfo->display = display;
|
||||
fbinfo->initialized = true;
|
||||
}
|
||||
@@ -821,55 +865,3 @@ void up_fbuninitialize(int display)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: nx_notify_rectangle
|
||||
*
|
||||
* Description:
|
||||
* When CONFIG_NX_UPDATE=y, then the graphics system will callout to
|
||||
* inform some external module that the display has been updated. This
|
||||
* would be useful in a couple for cases.
|
||||
*
|
||||
* - When a serial LCD is used, but a framebuffer is used to access the
|
||||
* LCD. In this case, the update callout can be used to refresh the
|
||||
* affected region of the display.
|
||||
*
|
||||
* - When VNC is enabled. This is case, this callout is necessary to
|
||||
* update the remote frame buffer to match the local framebuffer.
|
||||
*
|
||||
* When this feature is enabled, some external logic must provide this
|
||||
* interface. This is the function that will handle the notification. It
|
||||
* receives the rectangular region that was updated on the provided plane.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NX_UPDATE
|
||||
void nx_notify_rectangle(FAR NX_PLANEINFOTYPE *pinfo,
|
||||
FAR const struct nxgl_rect_s *rect)
|
||||
{
|
||||
FAR struct vnc_session_s *session;
|
||||
int ret;
|
||||
|
||||
DEBUGASSERT(pinfo != NULL && rect != NULL);
|
||||
|
||||
/* Recover the session information from the display number in the planeinfo
|
||||
* structure.
|
||||
*/
|
||||
|
||||
DEBUGASSERT(pinfo->display >= 0 && pinfo->display < RFB_MAX_DISPLAYS);
|
||||
session = g_vnc_sessions[pinfo->display];
|
||||
|
||||
/* Verify that the session is still valid */
|
||||
|
||||
if (session != NULL && session->state == VNCSERVER_RUNNING)
|
||||
{
|
||||
/* Queue the rectangular update */
|
||||
|
||||
ret = vnc_update_rectangle(session, rect, true);
|
||||
if (ret < 0)
|
||||
{
|
||||
gerr("ERROR: vnc_update_rectangle failed: %d\n", ret);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user