Commit graph

4 commits

Author SHA1 Message Date
hujianwei
a05a62d9d0 Rework subcompositor damage culling and use a back buffer in the pict renderer
Note that the EGL renderer has been broken by these changes.

* compositor.h (struct _RenderFuncs): Change arguments to
`finish_render'.  Add `cancel_completion_callback'.  Remove
`cancel_presentation'.
(struct _BufferFuncs): Add `is_buffer_opaque'.
* egl.c: Note that the EGL renderer is currently broken.
* fence_ring.c (FenceFree, struct _Fence, GetFence, FenceAwait)
(FenceToXFence): Repurpose fence code as a generic allocator of
fences.
* frame_clock.c (EndFrame): Adjust calculation of even value.
* picture_renderer.c (struct _BufferActivityRecord): Remove
`fence'.
(struct _PictureBuffer): Remove unused field.
(struct _PresentCompletionCallback): Remove unused fields
linking it to the target.
(struct _BackBuffer): New structure.
(IsBufferBusy, SetBufferBusy, ClearBufferBusy): New macros.
(struct _PictureTarget): Add back buffer and GC fields.
(use_sync_fences): Remove variable.
(RecordBufferActivity): Don't take fence.
(UnlinkActivityRecord): Don't wait on fence.
(FreeBackBuffer, FreeBackBuffers, CreateBackBuffer)
(MakePresentationCallback, SwapBackBuffers)
(SwapBackBuffersWithCopy, MaybeAwaitBuffer, GetNextBackBuffer)
(EnsurePicture): New functions.
(TargetFromDrawable): Don't create picture for window targets,
and create GC for those.
(NoteTargetSize): Free back buffers instead of creating
presentation windows.
(DestroyRenderTarget): Free back buffers.
(ViewContainsExtents): Delete function.
(FinishRender): Swap back buffers and handle callbacks.
(CancelCompletionCallback): New function.
(TargetAge): Implement accordingly.
(PresentToWindow, CancelPresentationCallback): Present to the
regular window instead of a separate ``presentation window''.
(CancelPresentation): Remove function.
(picture_render_funcs): Add CancelCompletionCallback; remove
NeverAges and CancelPresentation.
(BufferFromDmaBuf, FinishDmaBufRecord, BufferFromShm): Set
opaque flag accordingly.
(IsBufferOpaque): New function.
(picture_buffer_funcs): Add IsBufferOpaque.
(HandlePresentCompleteNotify, HandlePresentIdleNotify): Handle
back buffer release.

* renderer.c (RenderFinishRender, RenderCancelCompletionCallback)
(RenderCancelPresentation, RenderIsBufferOpaque): Adjust
accordingly.
* seat.c (InterpolateAxes): Fix NULL-pointer dereference.

* subcompositor.c (SetFrozen, IsFrozen): Get rid of unused
state.
(struct _View): Cache the width and height.  Add cull_region
field.
(struct _Subcompositor): Add `render_key' field.
(ViewAfterSizeUpdate): Set cached width and height.
(ViewAttachBuffer): Correctly handle size changes.
(ViewDamage): Apply buffer damage.
(ViewDamageBuffer): use ViewDamage.
(ApplyBufferDamage): New function.:(FillBoxesWithTransparency,
ViewContainsExtents, IntersectBoxes): Delete unused functions.
(RenderCompletedCallback): New function.
(NoViewsAfter): Delete function.
(SkipSlug): New slug.
(SubcompositorUpdateAncillary, TryPresent, AnyParentUnmapped)
(DoCull, DrawBackground, CompositeSingleView, InitBackground)
(SubcompositorComposite1, SubcompositorComposite): New
functions.  Implement new redisplay logic here.
(SubcompositorUpdate, CopyRegion): New function.
(SubcompositorExpose, SubcompositorFree): Clear render callback
if set.
(SubcompositorLookupView): Use cached width and height.
(SubcompositorFreeze, SubcompositorUnfreeze): Remove unused
functions.
* time.c (InitTime): Fix use of uninitialized value initializing
the Sync extension.
* transform.c (TransformBox): Pacify compiler warning.
2022-10-29 05:21:35 +00:00
hujianwei
768f2d98b5 Implement buffer transforms on the XRender backend
* 12to11.conf (XSHMFENCELIB): New library.
* 12to11.man: Document that surface transforms are now
supported.
* Imakefile (LOCAL_LIBRARIES): Add XSHMFENCELIB.
(SRCS, OBJS): Add fence_ring.c and fence_ring.o.
* README: Require xshmfence.
* buffer.c: Include stdio.h.
* compositor.h (enum _BufferTransform): New enum.
(struct _DrawParams): Add TransformSet.
(RotatesDimensions): New macro.
(struct _State): Add buffer transform.
* egl.c: Add TODO for buffer transforms.
* fns.c (TransformBox, XLTransformRegion): New functions.
* picture_renderer.c (struct _BufferActivityRecord): New field
`fence'.
(struct _PictureBuffer): Add buffer width and height.
(struct _DmaBufRecord, RecordBufferActivity, UnlinkActivityRecord)
(DestroyRenderTarget, GetBufferTransform, MaybeApplyTransform)
(Composite, FinishRender, BufferFromDmaBuf, FinishDmaBufRecord)
(BufferFromDmaBufAsync, BufferFromShm, FreeAnyBuffer): Record
width and height, and handle transforms; add some disabled
fencing code.
* subcompositor.c (struct _View): Add transform.  Rearrange
fields for alignment.
(MakeView): Initialize transform.
(InvertTransform): New function.
(BufferWidthAfterTransform, BufferHeightAfterTransform)
(TransformBufferDamage): New functions.
(ViewDamageBuffer): Transform buffer damage if necessary.
(ViewWidth, ViewHeight): Use width and height after transform.
(ViewComputeTransform): Apply transform.
* surface.c (ApplyBufferTransform): New function.
(ApplyViewport, CheckViewportValues, SavePendingState)
(InternalCommit, GetBufferTransform, SetBufferTransform,
InitState): Initialize and handle transforms.
(XLStateAttachBuffer, XLStateDetachBuffer): Delete unused
functions.
* time.c (InitTime): Require a newer version of the Sync
extension.
* transform.c (MatrixRotate, MatrixMirrorHorizontal): New
functions.
2022-10-25 10:15:28 +00:00
oldosfan
d143b45496 Implement _NET_WM_PING and some WIP Present code
* 12to11.c (XLMain): Initialize timestamp tracking.
* 12to11.man: Document *.useDirectPresentation resource.
* atoms.c (names): Add _NET_WM_PID and _NET_WM_PING.
(XLInitAtoms): Likewise.
* compositor.h (struct _RenderFuncs): Update doc of
cancel_presentation.
(enum _FrameMode): Add ModeNotifyDisablePresent.
(struct _XdgRoleList, struct _XdgWmBase): New structs.
* frame_clock.c (StartFrame): Return if the clock was really
started.
(XLFrameClockStartFrame): Likewise.
(XLInitFrameClock): Move Sync extension initialization to
InitTime.
* picture_renderer.c (struct _PresentCompletionCallback)
(struct _PictureTarget, InitSynchronizedPresentation)
(InitRenderFuncs, TargetFromDrawable, DestroyRenderTarget)
(PresentToWindow, CancelPresentationCallback, AddRenderFlag)
(HandlePresentCompleteNotify): Link structure on target.  When
synchronized presentation is enabled, use the approriate msc to
present, and record the last known msc.
* run.c (HandleOneXEvent): Handle timestamp events.
* subcompositor.c (SubcompositorUpdate): Note frame with
ModeNotifyDisablePresent.
(FindSystemCounter, ValueToScalar, ScalarToValue, StartAlarms)
(HandleAlarmNotify, HandleOneXEventForTime, InitTime): New
functions.
* xdg_surface.c (struct _XdgRole): New fields `link' and
`wm_base'.
(struct _PingEvent): New structure.
(ReleaseBacking): Release all ping events.
(NoteFrame, WriteRedirectProperty): Allow unredirection under
some circumstances.
(XLGetXdgSurface): Attach wm base.
(XLXdgRoleHandlePing, ReplyPingEvent, XLXdgRoleReplyPing): New
function.
* xdg_toplevel.c (GetClientMachine): New function.
(WriteCredentialProperties): New function.
(Attach): Write credential properties.
(ReplyToPing): New function.
(XLHandleXEventForXdgToplevels): Handle ping events.
* xdg_wm.c (Pong): Reply to ping events once pong is received
from the client.
(HandleResourceDestroy): Detach all surfaces and run their ping
events.
(HandleBind): Allocate memory for XdgWmBase.
(XLXdgWmBaseSendPing): New function.
2022-10-20 03:55:19 +00:00
oldosfan
08c70b8e3e Check in new file for improved time handling
* time.c: New file.
2022-10-16 03:29:55 +00:00