MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / virtio_gpu_create_2d_resource

Function virtio_gpu_create_2d_resource

components/drivers/virtio/virtio_gpu.c:178–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178static rt_err_t virtio_gpu_create_2d_resource(struct virtio_gpu_device *virtio_gpu_dev, enum virtio_gpu_formats format,
179 rt_uint32_t *resource_id, rt_uint32_t width, rt_uint32_t height)
180{
181 struct virtio_gpu_ctrl_hdr res;
182 struct virtio_gpu_resource_create_2d req;
183
184 *resource_id = ++virtio_gpu_dev->next_resource_id;
185
186 req.hdr.type = VIRTIO_GPU_CMD_RESOURCE_CREATE_2D;
187 req.resource_id = *resource_id;
188 req.format = format;
189 req.width = width;
190 req.height = height;
191
192 virtio_gpu_ctrl_send_command(virtio_gpu_dev, &req, sizeof(req), &res, sizeof(res));
193
194 if (res.type == VIRTIO_GPU_RESP_OK_NODATA)
195 {
196 return RT_EOK;
197 }
198
199 return -RT_ERROR;
200}
201
202static rt_err_t virtio_gpu_unref_resource(struct virtio_gpu_device *virtio_gpu_dev, rt_uint32_t resource_id)
203{

Callers 1

virtio_gpu_controlFunction · 0.85

Calls 1

Tested by

no test coverage detected