Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
redox-os
website
Commits
c59f0f84
Commit
c59f0f84
authored
1 year ago
by
Anhad Singh
Browse files
Options
Downloads
Patches
Plain Diff
rsoc-virtio-2
Signed-off-by:
Anhad Singh
<
andypythonappdeveloper@gmail.com
>
parent
5f82ed9e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!350
rsoc-virtio-2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
content/news/rsoc-virtio-2.md
+56
-0
56 additions, 0 deletions
content/news/rsoc-virtio-2.md
with
56 additions
and
0 deletions
content/news/rsoc-virtio-2.md
0 → 100644
+
56
−
0
View file @
c59f0f84
+++
title = "RSoC: virtio drivers - 2"
author = "Andy-Python-Programmer"
date = "2023-09-04"
+++
*This is a continuation of https://redox-os.org/news/rsoc-virtio-1/*
Over the past few weeks, there has been significant progress with the
`virtio-gpu`
drivers, resulting in working 2D acceleration! 🎉
In addition to writing the driver itself, changes were required on how applications interact with the display device.
## The `inputd` driver.
This driver is responsible for multiplexing the input from multiple input devices ("producer channel") and provide it to Orbital
("consumer channel"). This before was done inside of the VESA driver, however with the introduction of other display
drivers, isolating the input handling into a separate driver made the interface much cleaner.
In addition, every display device now opens an "inputd handle" to register the device and a VT# is assigned to each display. When a user
switches to a different VT, the inputd driver sends an event to the respective device, disabling the current one and enabling the newly
selected device. Additionally, the inputd driver offers functionality to set the VT mode (text or graphics) using
`inputd -G VT#`
and
to switch between VTs using
`inputd -A VT#`
.
## Asynchronous Virtio Drivers - Experimentation
The virtio drivers are now asynchronous. I've been experimenting with different ways to implement asynchronous schemes.
However, due to the blocking nature of POSIX syscalls, asynchronous calls are currently converted into synchronous calls.
Despite this, I believe that having an async driver codebase is better because it enhances code readability.
### Example
```
rust
// Synchronous Approach
fn
read_at
(
&
self
,
_
:
usize
,
buffer
:
&
mut
[
u8
]
->
usize
{
if
self
.buffer
.is_empty
()
&&
self
.flags
&
O_NONBLOCK
==
O_NONBLOCK
{
return
Err
(
WOULDBLOCK
);
}
// Wait until there is an item in the buffer.
while
self
.buffer
.is_empty
()
{
yield
();
}
buffer
[
0
]
=
self
.buffer
.pop
();
return
1
;
}
```
```
rust
// Aynchronous Approach
async
fn
read_at
(
&
self
,
_
:
usize
,
buffer
:
&
mut
[
u8
])
->
usize
{
buffer
[
0
]
=
self
.buffer
.pop
()
.await
;
// Talking advantage of asynchronous rust syntax.
return
1
;
}
```
## Other changes
*
Implementation of a mechanism to reinitialize the queues following a device reset.
*
Added support for legacy transport. Wanna try it out, append "disable-modern=on" to the device arguments when running Qemu!
Stay tuned for more exciting updates! 🚀
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment