Skip to content

Commit

Permalink
virtio-gpu: convert virito-gpu fb_register to virtio_gpu_fb_register
Browse files Browse the repository at this point in the history
Signed-off-by: jianglianfang <[email protected]>
  • Loading branch information
jianglianfang authored and xiaoxiang781216 committed Dec 13, 2023
1 parent 9d50d18 commit 5f631e2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 33 deletions.
54 changes: 21 additions & 33 deletions drivers/virtio/virtio-gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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;
}

/****************************************************************************
* 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 *vtable;

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;
}

vtable = &g_virtio_gpu[display]->vtable;

if (vtable == NULL)
{
vrterr("ERROR: get vtable failed\n");
return -EINVAL;
}

return &g_virtio_gpu[display]->vtable;
return fb_register_device(display, 0, vtable);
}
2 changes: 2 additions & 0 deletions drivers/virtio/virtio-gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,8 @@ extern "C"

int virtio_register_gpu_driver(void);

int virtio_gpu_fb_register(int display);

#undef EXTERN
#ifdef __cplusplus
}
Expand Down

0 comments on commit 5f631e2

Please sign in to comment.