int main(int argc, char const *argv[]) { struct commit *first = new_commit(0, 0, "First !"); struct commit *tmp, *victim, *last; /*first->display = display_commit_major;*/ list_add(&first->lhead, &list_complete); list_add(&first->major_list, &list_major); display_commit_major(first); printf("\n"); display_history(first); tmp = add_minor_commit(first, "Work 1"); tmp = add_minor_commit(tmp, "Work 2"); victim = add_minor_commit(tmp, "Work 3"); last = add_minor_commit(victim, "Work 4"); display_history(first); del_commit(victim); display_history(first); tmp = add_major_commit(last, "Release 1"); tmp = add_minor_commit(tmp, "Work 1"); tmp = add_minor_commit(tmp, "Work 2"); tmp = add_major_commit(tmp, "Release 2"); tmp = add_minor_commit(tmp, "Work 1"); display_history(first); add_minor_commit(last, "Oversight !!!"); display_history(first); infos(first, 1, 2); infos(first, 1, 7); infos(first, 4, 2); #ifdef DEBUG printf("\n== TEST SUPP MAJEUR ==\n"); del_commit(first); display_history(NULL); #endif freeHistory(); return 0; }
int main(int argc, char const* argv[]) { struct commit *first = new_commit(0, 0, "First !"); struct commit *tmp, *victim, *last; display_commit(first); printf("\n"); display_history(first); tmp = add_minor_commit(first, "Work 1"); tmp = add_minor_commit(tmp, "Work 2"); victim = add_minor_commit(tmp, "Work 3"); last = add_minor_commit(victim, "Work 4"); display_history(first); del_commit(victim); display_history(first); tmp = add_major_commit(last, "Realse 1"); tmp = add_minor_commit(tmp, "Work 1"); tmp = add_minor_commit(tmp, "Work 2"); tmp = add_major_commit(tmp, "Realse 2"); tmp = add_minor_commit(tmp, "Work 1"); display_history(first); add_minor_commit(last, "Oversight !!!"); display_history(first); infos(first, 1, 2); infos(first, 1, 7); infos(first, 4, 2); return 0; }
/** * drm_atomic_helper_commit - commit validated state object * @dev: DRM device * @state: the driver state object * @async: asynchronous commit * * This function commits a with drm_atomic_helper_check() pre-validated state * object. This can still fail when e.g. the framebuffer reservation fails. For * now this doesn't implement asynchronous commits. * * RETURNS * Zero for success or -errno. */ int msm_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state, bool async) { int nplanes = dev->mode_config.num_total_plane; int ncrtcs = dev->mode_config.num_crtc; struct msm_commit *c; int i, ret; ret = drm_atomic_helper_prepare_planes(dev, state); if (ret) return ret; c = new_commit(state); if (!c) return -ENOMEM; /* * Figure out what crtcs we have: */ for (i = 0; i < ncrtcs; i++) { struct drm_crtc *crtc = state->crtcs[i]; if (!crtc) continue; c->crtc_mask |= (1 << drm_crtc_index(crtc)); } /* * Figure out what fence to wait for: */ for (i = 0; i < nplanes; i++) { struct drm_plane *plane = state->planes[i]; struct drm_plane_state *new_state = state->plane_states[i]; if (!plane) continue; if ((plane->state->fb != new_state->fb) && new_state->fb) add_fb(c, new_state->fb); } /* * Wait for pending updates on any of the same crtc's and then * mark our set of crtc's as busy: */ ret = start_atomic(dev->dev_private, c->crtc_mask); if (ret) return ret; /* * This is the point of no return - everything below never fails except * when the hw goes bonghits. Which means we can commit the new state on * the software side now. */ drm_atomic_helper_swap_state(dev, state); /* * Everything below can be run asynchronously without the need to grab * any modeset locks at all under one conditions: It must be guaranteed * that the asynchronous work has either been cancelled (if the driver * supports it, which at least requires that the framebuffers get * cleaned up with drm_atomic_helper_cleanup_planes()) or completed * before the new state gets committed on the software side with * drm_atomic_helper_swap_state(). * * This scheme allows new atomic state updates to be prepared and * checked in parallel to the asynchronous completion of the previous * update. Which is important since compositors need to figure out the * composition of the next frame right after having submitted the * current layout. */ if (async) { msm_queue_fence_cb(dev, &c->fence_cb, c->fence); return 0; } ret = msm_wait_fence_interruptable(dev, c->fence, NULL); if (ret) { WARN_ON(ret); // TODO unswap state back? or?? kfree(c); return ret; } complete_commit(c); return 0; }