virtio-gpu: convert virito-gpu fb_register to virtio_gpu_fb_register

Signed-off-by: jianglianfang <jianglianfang@xiaomi.com>
This commit is contained in:
jianglianfang 2023-11-15 12:50:47 +08:00 committed by Xiang Xiao
parent 9d50d180b1
commit 5f631e2b2b
2 changed files with 23 additions and 33 deletions

View File

@ -570,7 +570,7 @@ static int virtio_gpu_probe(FAR struct virtio_device *vdev)
g_virtio_gpu[disp] = priv;
priv->display = disp;
ret = fb_register(disp, 0);
ret = virtio_gpu_fb_register(disp);
if (ret < 0)
{
vrterr("ERROR: Failed to initialize framebuffer driver, ret=%d",
@ -690,53 +690,41 @@ int virtio_register_gpu_driver(void)
}
/****************************************************************************
* Name: up_fbinitialize
* Name: virtio_gpu_fb_register
*
* Description:
* Initialize the framebuffer video hardware associated with the display.
*
* Input Parameters:
* display - In the case of hardware with multiple displays, this
* specifies the display. Normally this is zero.
* display - The display number for the case of boards supporting multiple
* displays or for hardware that supports multiple
* layers (each layer is consider a display). Typically zero.
*
* Returned Value:
* Zero is returned on success; a negated errno value is returned on any
* Zero (OK) is returned success; a negated errno value is returned on any
* failure.
*
****************************************************************************/
int up_fbinitialize(int display)
int virtio_gpu_fb_register(int display)
{
return display < VIRTIO_GPU_MAX_DISP ? OK : -EINVAL;
}
FAR struct fb_vtable_s *vtable;
/****************************************************************************
* Name: up_fbgetvplane
*
* Description:
* Return a reference to the framebuffer object for the specified video
* plane of the specified plane.
* Many OSDs support multiple planes of video.
*
* Input Parameters:
* display - In the case of hardware with multiple displays, this
* specifies the display. Normally this is zero.
* vplane - Identifies the plane being queried.
*
* Returned Value:
* A non-NULL pointer to the frame buffer access structure is returned on
* success; NULL is returned on any failure.
*
****************************************************************************/
FAR struct fb_vtable_s *up_fbgetvplane(int display, int vplane)
{
if (display < 0 || display >= VIRTIO_GPU_MAX_DISP ||
vplane < 0 || vplane >= VIRTIO_GPU_MAX_PLANE || !g_virtio_gpu[display])
!g_virtio_gpu[display])
{
vrterr("get vplane (%d,%d) failed", display, vplane);
return NULL;
vrterr("ERROR: display number %d is out of range [%d, %d]",
display, 0, VIRTIO_GPU_MAX_DISP - 1);
return -EINVAL;
}
return &g_virtio_gpu[display]->vtable;
vtable = &g_virtio_gpu[display]->vtable;
if (vtable == NULL)
{
vrterr("ERROR: get vtable failed\n");
return -EINVAL;
}
return fb_register_device(display, 0, vtable);
}

View File

@ -521,6 +521,8 @@ extern "C"
int virtio_register_gpu_driver(void);
int virtio_gpu_fb_register(int display);
#undef EXTERN
#ifdef __cplusplus
}