summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorSahan Fernando <sahan.h.fernando@gmail.com>2022-03-10 13:04:48 +1100
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2022-03-14 17:38:18 +0330
commit683de841e5ad3257536e677f7b0249ab932e004c (patch)
treec9a2ce0c7d46cbccc827e6563f083b503e985c5e /Userland
parentfe7d801dd97c5e439a996906cda37da124d69e0f (diff)
downloadserenity-683de841e5ad3257536e677f7b0249ab932e004c.zip
Kernel: Sandbox each GPU3DDevice file description into own host context
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Demos/VirGLDemo/VirGLDemo.cpp2
-rw-r--r--Userland/Libraries/LibC/sys/ioctl_numbers.h2
2 files changed, 4 insertions, 0 deletions
diff --git a/Userland/Demos/VirGLDemo/VirGLDemo.cpp b/Userland/Demos/VirGLDemo/VirGLDemo.cpp
index f3763a54e1..97d1a7081f 100644
--- a/Userland/Demos/VirGLDemo/VirGLDemo.cpp
+++ b/Userland/Demos/VirGLDemo/VirGLDemo.cpp
@@ -133,6 +133,8 @@ static void init()
// Open the device
gpu_fd = open("/dev/gpu0", O_RDWR);
VERIFY(gpu_fd >= 0);
+ // Create a virgl context for this file descriptor
+ VERIFY(ioctl(gpu_fd, VIRGL_IOCTL_CREATE_CONTEXT) >= 0);
// Create a VertexElements resource
VirGL3DResourceSpec vbo_spec {
.target = to_underlying(Gallium::PipeTextureTarget::BUFFER), // pipe_texture_target
diff --git a/Userland/Libraries/LibC/sys/ioctl_numbers.h b/Userland/Libraries/LibC/sys/ioctl_numbers.h
index 86709457b5..0c1448a9d9 100644
--- a/Userland/Libraries/LibC/sys/ioctl_numbers.h
+++ b/Userland/Libraries/LibC/sys/ioctl_numbers.h
@@ -125,6 +125,7 @@ enum IOCtlNumber {
SOUNDCARD_IOCTL_GET_SAMPLE_RATE,
STORAGE_DEVICE_GET_SIZE,
STORAGE_DEVICE_GET_BLOCK_SIZE,
+ VIRGL_IOCTL_CREATE_CONTEXT,
VIRGL_IOCTL_CREATE_RESOURCE,
VIRGL_IOCTL_SUBMIT_CMD,
VIRGL_IOCTL_TRANSFER_DATA,
@@ -175,6 +176,7 @@ enum IOCtlNumber {
#define SOUNDCARD_IOCTL_GET_SAMPLE_RATE SOUNDCARD_IOCTL_GET_SAMPLE_RATE
#define STORAGE_DEVICE_GET_SIZE STORAGE_DEVICE_GET_SIZE
#define STORAGE_DEVICE_GET_BLOCK_SIZE STORAGE_DEVICE_GET_BLOCK_SIZE
+#define VIRGL_IOCTL_CREATE_CONTEXT VIRGL_IOCTL_CREATE_CONTEXT
#define VIRGL_IOCTL_CREATE_RESOURCE VIRGL_IOCTL_CREATE_RESOURCE
#define VIRGL_IOCTL_SUBMIT_CMD VIRGL_IOCTL_SUBMIT_CMD
#define VIRGL_IOCTL_TRANSFER_DATA VIRGL_IOCTL_TRANSFER_DATA