void scene_set_eye(struct scene * scene, Vec3 position, Vec3 direction) { scene_lock(scene); scene->eye_pos = position; scene->eye_dir = direction; scene_unlock(scene); }
void scene_add_object(struct scene * scene, struct model * model, Mat4 matrix) { scene_lock(scene); if (scene->objects_len == scene->objects_size) { uint32_t old_size = scene->objects_size; uint32_t added = scene->objects_size / 2; scene->objects_size = old_size + added; scene->objects = realloc(scene->objects, scene->objects_size); memset(scene->objects + old_size, 0, added * sizeof(struct scene_object)); } uint32_t i = scene->objects_len++; struct scene_object * obj = &scene->objects[i]; obj->model_matrix = matrix; obj->model = model; obj->s.matrix_dirty = 1; obj->s.mesh_dirty = 1; scene->s.objects_dirty = 1; scene_unlock(scene); }
static int sunxi_ohci_hcd_suspend(struct device *dev) { struct sunxi_hci_hcd *sunxi_ohci = NULL; struct usb_hcd *hcd = NULL; struct ohci_hcd *ohci = NULL; unsigned long flags = 0; if(dev == NULL){ DMSG_PANIC("ERR: Argment is invalid\n"); return 0; } hcd = dev_get_drvdata(dev); if(hcd == NULL){ DMSG_PANIC("ERR: hcd is null\n"); return 0; } sunxi_ohci = dev->platform_data; if(sunxi_ohci == NULL){ DMSG_PANIC("ERR: sunxi_ohci is null\n"); return 0; } if(sunxi_ohci->probe == 0){ DMSG_PANIC("ERR: sunxi_ohci is disable, can not suspend\n"); return 0; } ohci = hcd_to_ohci(hcd); if(ohci == NULL){ DMSG_PANIC("ERR: ohci is null\n"); return 0; } if(sunxi_ohci->not_suspend){ DMSG_INFO("[%s]: not suspend\n", sunxi_ohci->hci_name); scene_lock(&ohci_standby_lock[sunxi_ohci->usbc_no]); enable_wakeup_src(CPUS_USBMOUSE_SRC, 0); }else{ DMSG_INFO("[%s]: sunxi_ohci_hcd_suspend\n", sunxi_ohci->hci_name); /* Root hub was already suspended. Disable irq emission and * mark HW unaccessible, bail out if RH has been resumed. Use * the spinlock to properly synchronize with possible pending * RH suspend or resume activity. * * This is still racy as hcd->state is manipulated outside of * any locks =P But that will be a different fix. */ spin_lock_irqsave(&ohci->lock, flags); ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); (void)ohci_readl(ohci, &ohci->regs->intrdisable); clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); spin_unlock_irqrestore(&ohci->lock, flags); sunxi_stop_ohc(sunxi_ohci); } return 0; }