mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-28 02:26:16 +00:00
xrt: Use U_TYPED_CALLOC
This commit is contained in:
parent
e57e858351
commit
f7d990c7e3
|
@ -11,6 +11,8 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "util/u_misc.h"
|
||||
|
||||
#include "client/comp_gl_api.h"
|
||||
#include "client/comp_gl_client.h"
|
||||
|
||||
|
@ -185,7 +187,7 @@ client_gl_swapchain_create(struct xrt_compositor *xc,
|
|||
}
|
||||
|
||||
struct client_gl_swapchain *sc =
|
||||
calloc(1, sizeof(struct client_gl_swapchain));
|
||||
U_TYPED_CALLOC(struct client_gl_swapchain);
|
||||
sc->base.base.destroy = client_gl_swapchain_destroy;
|
||||
sc->base.base.acquire_image = client_gl_swapchain_acquire_image;
|
||||
sc->base.base.wait_image = client_gl_swapchain_wait_image;
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "util/u_misc.h"
|
||||
|
||||
#include "comp_vk_client.h"
|
||||
|
||||
|
||||
|
@ -199,7 +201,7 @@ client_vk_swapchain_create(struct xrt_compositor *xc,
|
|||
};
|
||||
|
||||
struct client_vk_swapchain *sc =
|
||||
calloc(1, sizeof(struct client_vk_swapchain));
|
||||
U_TYPED_CALLOC(struct client_vk_swapchain);
|
||||
sc->base.base.destroy = client_vk_swapchain_destroy;
|
||||
sc->base.base.acquire_image = client_vk_swapchain_acquire_image;
|
||||
sc->base.base.wait_image = client_vk_swapchain_wait_image;
|
||||
|
@ -243,7 +245,7 @@ client_vk_compositor_create(struct xrt_compositor_fd *xcfd,
|
|||
{
|
||||
VkResult ret;
|
||||
struct client_vk_compositor *c =
|
||||
calloc(1, sizeof(struct client_vk_compositor));
|
||||
U_TYPED_CALLOC(struct client_vk_compositor);
|
||||
|
||||
c->base.base.create_swapchain = client_vk_swapchain_create;
|
||||
c->base.base.begin_session = client_vk_compositor_begin_session;
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "util/u_misc.h"
|
||||
|
||||
#include "xrt/xrt_gfx_xlib.h"
|
||||
|
||||
#include "client/comp_xlib_client.h"
|
||||
|
@ -38,7 +40,7 @@ client_xlib_compositor_create(struct xrt_compositor_fd *xcfd,
|
|||
GLXContext glxContext)
|
||||
{
|
||||
struct client_xlib_compositor *c =
|
||||
calloc(1, sizeof(struct client_xlib_compositor));
|
||||
U_TYPED_CALLOC(struct client_xlib_compositor);
|
||||
|
||||
if (!client_gl_compositor_init(&c->base, xcfd, glXGetProcAddress)) {
|
||||
free(c);
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <stdarg.h>
|
||||
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_misc.h"
|
||||
|
||||
#include "main/comp_compositor.h"
|
||||
#include "main/comp_client_interface.h"
|
||||
|
@ -465,7 +466,7 @@ compositor_init_renderer(struct comp_compositor *c)
|
|||
struct xrt_compositor_fd *
|
||||
comp_compositor_create(struct xrt_device *xdev, bool flip_y)
|
||||
{
|
||||
struct comp_compositor *c = calloc(1, sizeof(struct comp_compositor));
|
||||
struct comp_compositor *c = U_TYPED_CALLOC(struct comp_compositor);
|
||||
|
||||
c->base.base.create_swapchain = comp_swapchain_create;
|
||||
c->base.base.begin_session = compositor_begin_session;
|
||||
|
|
|
@ -594,7 +594,7 @@ renderer_init(struct comp_renderer *r)
|
|||
|
||||
renderer_init_descriptor_pool(r);
|
||||
|
||||
r->distortion = calloc(1, sizeof(struct comp_distortion));
|
||||
r->distortion = U_TYPED_CALLOC(struct comp_distortion);
|
||||
|
||||
comp_distortion_init(r->distortion, r->c, r->render_pass,
|
||||
r->pipeline_cache, r->settings->distortion_model,
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "util/u_misc.h"
|
||||
|
||||
#include "main/comp_compositor.h"
|
||||
|
||||
|
||||
|
@ -223,7 +225,7 @@ comp_swapchain_create(struct xrt_compositor *xc,
|
|||
VkResult ret;
|
||||
|
||||
|
||||
struct comp_swapchain *sc = calloc(1, sizeof(struct comp_swapchain));
|
||||
struct comp_swapchain *sc = U_TYPED_CALLOC(struct comp_swapchain);
|
||||
sc->base.base.destroy = swapchain_destroy;
|
||||
sc->base.base.acquire_image = swapchain_acquire_image;
|
||||
sc->base.base.wait_image = swapchain_wait_image;
|
||||
|
|
|
@ -242,8 +242,7 @@ hdk_device_create(hid_device *dev,
|
|||
bool print_spew,
|
||||
bool print_debug)
|
||||
{
|
||||
struct hdk_device *hd =
|
||||
(struct hdk_device *)calloc(1, sizeof(struct hdk_device));
|
||||
struct hdk_device *hd = U_TYPED_CALLOC(struct hdk_device);
|
||||
hd->base.blend_mode = XRT_BLEND_MODE_OPAQUE;
|
||||
hd->base.destroy = hdk_device_destroy;
|
||||
hd->base.get_tracked_pose = hdk_device_get_tracked_pose;
|
||||
|
|
|
@ -115,8 +115,7 @@ hdk_prober_autoprobe(struct xrt_prober *p)
|
|||
struct xrt_prober *
|
||||
hdk_create_prober()
|
||||
{
|
||||
struct hdk_prober *hhp =
|
||||
(struct hdk_prober *)calloc(1, sizeof(struct hdk_prober));
|
||||
struct hdk_prober *hhp = U_TYPED_CALLOC(struct hdk_prober);
|
||||
hhp->base.destroy = hdk_prober_destroy;
|
||||
hhp->base.lelo_dallas_autoprobe = hdk_prober_autoprobe;
|
||||
|
||||
|
|
|
@ -216,8 +216,7 @@ oh_device_create(ohmd_context *ctx,
|
|||
bool print_spew,
|
||||
bool print_debug)
|
||||
{
|
||||
struct oh_device *ohd =
|
||||
(struct oh_device *)calloc(1, sizeof(struct oh_device));
|
||||
struct oh_device *ohd = U_TYPED_CALLOC(struct oh_device);
|
||||
ohd->base.destroy = oh_device_destroy;
|
||||
ohd->base.get_tracked_pose = oh_device_get_tracked_pose;
|
||||
ohd->base.get_view_pose = oh_device_get_view_pose;
|
||||
|
|
|
@ -101,7 +101,7 @@ oh_prober_autoprobe(struct xrt_prober *p)
|
|||
struct xrt_prober *
|
||||
oh_create_prober()
|
||||
{
|
||||
struct oh_prober *ohp = calloc(1, sizeof(struct oh_prober));
|
||||
struct oh_prober *ohp = U_TYPED_CALLOC(struct oh_prober);
|
||||
ohp->base.destroy = oh_prober_destroy;
|
||||
ohp->base.lelo_dallas_autoprobe = oh_prober_autoprobe;
|
||||
ohp->ctx = ohmd_ctx_create();
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_time.h"
|
||||
#include "util/u_misc.h"
|
||||
|
||||
#include "xrt/xrt_compiler.h"
|
||||
#include "xrt/xrt_prober.h"
|
||||
|
@ -37,8 +38,7 @@ oxr_instance_create(struct oxr_logger *log,
|
|||
const XrInstanceCreateInfo *createInfo,
|
||||
struct oxr_instance **out_instance)
|
||||
{
|
||||
struct oxr_instance *inst =
|
||||
(struct oxr_instance *)calloc(1, sizeof(struct oxr_instance));
|
||||
struct oxr_instance *inst = U_TYPED_CALLOC(struct oxr_instance);
|
||||
inst->debug = OXR_XR_DEBUG_INSTANCE;
|
||||
inst->prober = xrt_create_prober();
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "util/u_misc.h"
|
||||
|
||||
#include "xrt/xrt_gfx_xlib.h"
|
||||
|
||||
#include "oxr_objects.h"
|
||||
|
@ -32,8 +34,7 @@ oxr_session_create_gl_xlib(struct oxr_logger *log,
|
|||
" failed create a compositor");
|
||||
}
|
||||
|
||||
struct oxr_session *sess =
|
||||
(struct oxr_session *)calloc(1, sizeof(struct oxr_session));
|
||||
struct oxr_session *sess = U_TYPED_CALLOC(struct oxr_session);
|
||||
|
||||
sess->debug = OXR_XR_DEBUG_SESSION;
|
||||
sess->sys = sys;
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "util/u_misc.h"
|
||||
|
||||
#include "xrt/xrt_gfx_vk.h"
|
||||
|
||||
#include "oxr_objects.h"
|
||||
|
@ -36,8 +38,7 @@ oxr_session_create_vk(struct oxr_logger *log,
|
|||
" failed create a compositor");
|
||||
}
|
||||
|
||||
struct oxr_session *sess =
|
||||
(struct oxr_session *)calloc(1, sizeof(struct oxr_session));
|
||||
struct oxr_session *sess = U_TYPED_CALLOC(struct oxr_session);
|
||||
sess->debug = OXR_XR_DEBUG_SESSION;
|
||||
sess->sys = sys;
|
||||
sess->compositor = &xcvk->base;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "math/m_api.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_misc.h"
|
||||
|
||||
#include "oxr_objects.h"
|
||||
#include "oxr_logger.h"
|
||||
|
@ -61,8 +62,7 @@ oxr_space_reference_create(struct oxr_logger *log,
|
|||
"(createInfo->poseInReferenceSpace)");
|
||||
}
|
||||
|
||||
struct oxr_space *spc =
|
||||
(struct oxr_space *)calloc(1, sizeof(struct oxr_space));
|
||||
struct oxr_space *spc = U_TYPED_CALLOC(struct oxr_space);
|
||||
spc->debug = OXR_XR_DEBUG_SPACE;
|
||||
spc->sess = sess;
|
||||
spc->is_reference = true;
|
||||
|
|
|
@ -10,7 +10,9 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "xrt/xrt_gfx_xlib.h"
|
||||
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_misc.h"
|
||||
|
||||
#include "oxr_objects.h"
|
||||
#include "oxr_logger.h"
|
||||
|
@ -99,8 +101,7 @@ oxr_create_swapchain(struct oxr_logger *log,
|
|||
" failed to create swapchain");
|
||||
}
|
||||
|
||||
struct oxr_swapchain *sc =
|
||||
(struct oxr_swapchain *)calloc(1, sizeof(struct oxr_swapchain));
|
||||
struct oxr_swapchain *sc = U_TYPED_CALLOC(struct oxr_swapchain);
|
||||
sc->debug = OXR_XR_DEBUG_SWAPCHAIN;
|
||||
sc->sess = sess;
|
||||
sc->swapchain = xsc;
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "util/u_misc.h"
|
||||
|
||||
#include "xrt/xrt_gfx_vk.h"
|
||||
|
||||
#include "oxr_objects.h"
|
||||
|
@ -88,7 +90,7 @@ oxr_vk_get_physical_device(struct oxr_logger *log,
|
|||
"VkPhysicalDevices");
|
||||
}
|
||||
|
||||
VkPhysicalDevice *phys = calloc(count, sizeof(VkPhysicalDevice));
|
||||
VkPhysicalDevice *phys = U_TYPED_ARRAY_CALLOC(VkPhysicalDevice, count);
|
||||
vk_ret = vkEnumeratePhysicalDevices(vkInstance, &count, phys);
|
||||
if (vk_ret != VK_SUCCESS) {
|
||||
free(phys);
|
||||
|
|
Loading…
Reference in a new issue