From: Karol Herbst Date: Wed, 1 Jun 2022 20:16:56 +0000 (+0200) Subject: nouveau/ws: add context support X-Git-Tag: upstream/23.3.3~4604 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bede03cbd8a40bf1e06537f71240f406c066cff6;p=platform%2Fupstream%2Fmesa.git nouveau/ws: add context support Part-of: --- diff --git a/src/nouveau/winsys/meson.build b/src/nouveau/winsys/meson.build index 7ce1762..08d73dd 100644 --- a/src/nouveau/winsys/meson.build +++ b/src/nouveau/winsys/meson.build @@ -3,6 +3,8 @@ libnouveau_ws = static_library( [ 'nouveau_bo.h', 'nouveau_bo.c', + 'nouveau_context.h', + 'nouveau_context.c', 'nouveau_device.h', 'nouveau_device.c', 'nouveau_private.h', diff --git a/src/nouveau/winsys/nouveau_context.c b/src/nouveau/winsys/nouveau_context.c new file mode 100644 index 0000000..54c7768 --- /dev/null +++ b/src/nouveau/winsys/nouveau_context.c @@ -0,0 +1,34 @@ +#include "nouveau_context.h" + +#include +#include + +#include "nouveau_device.h" + +int +nouveau_ws_context_create(struct nouveau_ws_device *dev, struct nouveau_ws_context **out) +{ + struct nouveau_ws_device_priv *pdev = nouveau_ws_device(dev); + struct nvc0_fifo nvc0_data = { }; + uint32_t size = sizeof(nvc0_data); + + *out = CALLOC_STRUCT(nouveau_ws_context); + if (!*out) + return -ENOMEM; + + int ret = nouveau_object_new(&pdev->dev->object, 0, NOUVEAU_FIFO_CHANNEL_CLASS, + &nvc0_data, size, &(*out)->channel); + if (ret) { + FREE(*out); + return ret; + } + + return 0; +} + +void +nouveau_ws_context_destroy(struct nouveau_ws_context *context) +{ + nouveau_object_del(&context->channel); + FREE(context); +} diff --git a/src/nouveau/winsys/nouveau_context.h b/src/nouveau/winsys/nouveau_context.h new file mode 100644 index 0000000..44db4b4 --- /dev/null +++ b/src/nouveau/winsys/nouveau_context.h @@ -0,0 +1,15 @@ +#ifndef NOUVEAU_CONTEXT +#define NOUVEAU_CONTEXT 1 + +#include "nouveau_private.h" + +struct nouveau_ws_device; + +struct nouveau_ws_context { + struct nouveau_object *channel; +}; + +int nouveau_ws_context_create(struct nouveau_ws_device *, struct nouveau_ws_context **out); +void nouveau_ws_context_destroy(struct nouveau_ws_context *); + +#endif