Turnstone Operating System
Loading...
Searching...
No Matches
video_virtio.64.c File Reference

Video virtio driver. More...

#include <driver/video_virtio.h>
#include <driver/virtio.h>
#include <device/mouse.h>
#include <cpu/interrupt.h>
#include <apic.h>
#include <memory/paging.h>
#include <memory/frame.h>
#include <cpu/sync.h>
#include <future.h>
#include <systeminfo.h>
#include <utils.h>
#include <time/timer.h>
#include <cpu/task.h>
#include <driver/video_edid.h>
#include <cpu.h>
#include <logging.h>
#include <graphics/image.h>
#include <graphics/virgl.h>
#include <graphics/font.h>
#include <graphics/screen.h>
#include <graphics/text_cursor.h>
#include <strings.h>
#include <hashmap.h>

Functions

 MODULE ("turnstone.kernel.hw.video.virtiogpu")
 
uint64_t virtio_gpu_select_features (virtio_dev_t *dev, uint64_t selected_features)
 
int8_t virtio_gpu_create_queues (virtio_dev_t *dev)
 
int8_t virtio_gpu_controlq_isr (interrupt_frame_ext_t *frame)
 
int8_t virtio_gpu_cursorq_isr (interrupt_frame_ext_t *frame)
 
int8_t virtio_gpu_display_init (uint32_t scanout)
 
int8_t mouse_init (void)
 
int8_t virtio_gpu_font_init (void)
 
void virtio_gpu_display_flush (uint32_t scanout, uint64_t buf_offset, uint32_t x, uint32_t y, uint32_t width, uint32_t height)
 
void virtio_gpu_mouse_move (uint32_t x, uint32_t y)
 
void virtio_gpu_clear_screen_area (uint32_t x, uint32_t y, uint32_t width, uint32_t height, color_t background)
 
void video_text_print (const char_t *string)
 
static int8_t virtio_gpu_wait_for_queue_command (uint32_t queue_no, lock_t **lock, uint16_t desc_index, uint32_t desc_length)
 
static uint8_tvirtio_gpu_queue_get_offset_and_desc_index (uint32_t queue_no, uint16_t *desc_index)
 
static int8_t virtio_gpu_queue_send_transfer3d (uint32_t queue_no, lock_t **lock, uint32_t context_id, uint32_t resource_id, uint32_t fence_id, uint64_t buf_offset, uint32_t x, uint32_t y, uint32_t width, uint32_t height, uint32_t stride, uint32_t layer_stride, uint32_t level)
 
static int8_t virtio_gpu_queue_send_flush (uint32_t queue_no, lock_t **lock, uint32_t context_id, uint32_t resource_id, uint32_t fence_id, uint32_t x, uint32_t y, uint32_t width, uint32_t height)
 
static int8_t virtio_gpu_queue_attach_backing (uint32_t queue_no, lock_t **lock, uint32_t context_id, uint32_t fence_id, uint32_t resource_id, uint64_t resource_physical_address, uint64_t resource_size)
 
static int8_t virtio_gpu_queue_context_attach_resource (uint32_t queue_no, lock_t **lock, uint32_t context_id, uint32_t resource_id)
 
static int8_t virtio_gpu_queue_context_create_resource_internal (uint32_t queue_no, lock_t **lock, uint32_t context_id, uint32_t resource_id, uint32_t fence_id, uint32_t resource_width, uint32_t resource_height, virgl_bind_t bind, uint32_t format, uint32_t target, uint32_t flags)
 
static int8_t virtio_gpu_queue_context_create_buffer_resource (uint32_t queue_no, lock_t **lock, uint32_t context_id, uint32_t resource_id, uint32_t fence_id, uint32_t resource_size, virgl_bind_t bind)
 
static int8_t virtio_gpu_queue_context_create_3d_resource (uint32_t queue_no, lock_t **lock, uint32_t context_id, uint32_t resource_id, uint32_t fence_id, uint32_t resource_width, uint32_t resource_height, boolean_t is_y_0_top)
 
static uint8_tvirtio_gpu_queue_get_cmd_offset_and_desc_index (uint32_t queue_no, uint16_t *desc_index)
 
static int8_t virtio_gpu_queue_send_commad (uint32_t queue_no, lock_t **lock, uint32_t fence_id, virgl_cmd_t *cmd)
 
static int8_t virtio_gpu_create_surface (uint32_t resource_id, boolean_t is_texture, uint32_t *surface_id)
 
static void mouse_move_internal (virtio_gpu_ctrl_type_t type, uint32_t x, uint32_t y)
 
static void virtio_gpu_scrool_screen (void)
 
static int8_t virtio_gpu_create_font_colored (uint32_t *font_colored_resource_id)
 
static int8_t virtio_gpu_change_font_color (color_t foreground, color_t background, uint32_t *font_colored_resource_id)
 
static void virtio_gpu_print_glyph_with_stride (wchar_t wc, color_t foreground, color_t background, pixel_t *destination_base_address, uint32_t x, uint32_t y, uint32_t stride)
 
static int8_t virtio_gpu_init_text_cursor_data (void)
 
static void virtio_gpu_draw_text_cursor (int32_t x, int32_t y, int32_t width, int32_t height, boolean_t flush)
 
static int8_t virtio_gpu_font_init_empty_line (void)
 
int8_t virtio_video_init (memory_heap_t *heap, const pci_dev_t *pci_dev)
 

Variables

virtio_gpu_wrapper_tvirtio_gpu_wrapper = NULL
 
static boolean_t virtio_gpu_dont_transfer_on_flush = false
 
hashmap_tvirtio_gpu_font_color_palette = NULL
 
uint32_t virtio_gpu_cursor_vertex_buffer_res_id = 0
 
uint32_t virtio_gpu_cursor_vertex_elements_res_id = 0
 
uint32_t virtio_gpu_cursor_shader_vert_id = 0
 
uint32_t virtio_gpu_cursor_shader_frag_id = 0
 
uint32_t virtio_gpu_cursor_surface_id = 0
 
uint32_t virtio_gpu_cursor_blend_state_id = 0
 
uint32_t virtio_gpu_cursor_dsa_state_id = 0
 
uint32_t virtio_gpu_cursor_rasterizer_state_id = 0
 
const char_t *const virtio_gpu_cursor_shader_vert_text
 
const char_t *const virtio_gpu_cursor_shader_frag_text
 
static void * virtio_gpu_font_empty_line_value = NULL
 

Detailed Description

Video virtio driver.

This work is licensed under TURNSTONE OS Public License. Please read and understand latest version of Licence.

Variable Documentation

◆ virtio_gpu_cursor_shader_frag_text

const char_t* const virtio_gpu_cursor_shader_frag_text
Initial value:
=
"FRAG\n"
"DCL IN[0], COLOR, LINEAR\n"
"DCL OUT[0], COLOR\n"
" 0: MOV OUT[0], IN[0]\n"
" 1: END\n"

◆ virtio_gpu_cursor_shader_vert_text

const char_t* const virtio_gpu_cursor_shader_vert_text
Initial value:
=
"VERT\n"
"DCL IN[0]\n"
"DCL IN[1]\n"
"DCL OUT[0], POSITION\n"
"DCL OUT[1], COLOR\n"
" 0: MOV OUT[1], IN[1]\n"
" 1: MOV OUT[0], IN[0]\n"
" 2: END\n"