* 12to11.man: Document new protocol.
* compositor.h (enum _RenderMode): Add RenderModeVsyncAsync.
* picture_renderer.c (SwapBackBuffers, PresentToWindow)
(NotifyMsc): Handle new render mode.
* sync_source.c (GetWantedSynchronizationType): Use presentation
if the mode is VsyncAsync.
(NoteFrame): Set the vsync presentation mode to
RenderModeVsyncAsync.
This is in preparation for a migration to the Present extension
on systems that do not support frame synchronization.
* 12to11.man: Remove option that is no longer useful.
* Imakefile (SRCS, OBJS): Add `sync_source.c.'.
* compositor.h (enum _RenderMode): New enum.
(struct _RenderFuncs): Add some new functions.
(enum _FrameMode): Remove ModeNotifyDisablePresent.
* frame_clock.c (struct _FrameClockCallback): Add draw time to
frame callback.
(struct _FrameClock): Rearrange for alignment and remove many
unused members.
(BumpFrame): New function.
(FreezeForValue): Remove code that is no longer useful, as
clock->frozen no longer exists.
(StartFrame, EndFrame): Remove clock "freezing" logic. Only
`need_configure' remains.
(RunFrameCallbacks, NoteFakeFrame): Add frame drawn time.
(XLFrameClockAfterFrame): Adjust for new type of callback.
(XLFrameClockFreeze): Remove function.
(XLFrameClockFrameInProgress): Remove test for
`frozen_until_end_frame'.
(XLFrameClockHandleFrameEvent): Improve code in accordance with
above changes.
(XLFrameClockUnfreeze, XLFrameClockNeedConfigure): Remove
functions.
(XLFrameClockIsFrozen): Remove function.
(XLFrameClockSetFreezeCallback): Accept new callback
`fast_forward_callback'.
(XLFrameClockGetFrameTime): Remove unused function.
* icon_surface.c (struct _IconSurface, ReleaseBacking)
(ReleaseBuffer, RunFrameCallbacks, AfterFrame, Commit)
(SubsurfaceUpdate, XLGetIconSurface)
(XLHandleOneXEventForIconSurfaces): Switch the icon surface to
the sync helper abstraction, and allow asynch buffer release
from inside.
* picture_renderer.c (struct _PictureTarget): New field
`next_msc' and `render_mode'.
(SwapBackBuffers): Respect the render mode.
(InitSynchronizedPresentation): Delete function.
(InitAdditionalModifiers): Remove incorrect comment.
(InitRenderFuncs): Stop initializing obsolete option.
(SetRenderMode): New function.
(PresentToWindow): Respect the render mode.
(NotifyMsc): New function.
(picture_render_funcs): Add notify_msc.
(HandlePresentCompleteNotify): Call completion callback with the
fraame counter.
* renderer.c (RenderSetRenderMode):
(RenderNotifyMsc): New functions.
* subcompositor.c (struct _Subcompositor)
(SubcompositorSetNoteFrameCallback): Add msc and ust to note
frame callback.
(PresentCompletedCallback, RenderCompletedCallback): Call with
msc and ust.
(BeginFrame): When presentation is being synchronized and there
is no existing presentation callback, ask for an event to be
sent on the next frame.
(EndFrame): Do not clear the presentation callbacks, as the
update might not touch anything.
* test.c (NoteFrame): Update prototype.
* xdg_popup.c (InternalReposition): Stop "freezing" the frame
clock.
* xdg_surface.c (struct _XdgRole): Replace the frame clock with
the sync helper abstraction.
(RunFrameCallbacks): Run with the frame time.
(RunFrameCallbacksConditionally): Save the pending frame time.
(UpdateFrameRefreshPrediction): Delete function.
(XLHandleXEventForXdgSurfaces): Give events to the sync helper
instead.
(Unfreeze, IsRoleMapped, CheckFrame): Remove functions.
(Commit, SubsurfaceUpdate): Update using the sync helper
instead, only if not pending ack commit.
(MaybeRunLateFrame, AfterFrame): Delete functions.
(NoteConfigure, NoteBounds): Update for the sync helper.
(WriteRedirectProperty): Always require redirection for now.
Disabling redirection requires sorting out some Present problems
on the X server side.
(WasFrameQueued, NoteFrame): Delete functions.
(HandleFreeze): Delete function.
(HandleResize, CheckFastForward, HandleFrameCallback): New
functions.
(XLGetXdgSurface): Use the sync helper for most things.
(XLXdgRoleSendConfigure, XLXdgRoleReconstrain)
(XLXdgRoleGetFrameClock): Delete function.
(XLXdgRoleNoteRejectedConfigure): Clean up for using the sync
clock instead.
* README: Document changes.
* compositor.h (struct _BufferFuncs): Rename `get_render_device'
to `get_render_devices' and make it return a list of providers.
* dmabuf.c (MakeFeedback): Send 1 tranche for each device.
(InitDrmDevice): Rename to InitDrmDevices. Set up for multiple
devices.
(WriteFormatTable): Adjust call accordingly.
* egl.c (GetRenderDevice): Remove function.
(GetRenderDevices): New function.
(egl_buffer_funcs): Change accordingly.
* output.c (XLInitRROutputs): Require RandR 1.4.
* picture_renderer.c (GetRenderDevice): Remove calls to open.
(GetRenderDevices): New function.
(picture_buffer_funcs): Adjust accordingly.
* renderer.c (RenderGetRenderDevice): Delete function.
(RenderGetRenderDevices): New function.
* compositor.h (struct _RenderFuncs): Add function `set_client'.
(struct _ClientErrorData): New struct.
* icon_surface.c (XLGetIconSurface): Attach client to render
target.
* picture_renderer.c (struct _BackBuffer): Keep track of how
many pixels were allocated.
(struct _PictureTarget): Keep track of the client data.
(SetClient): New function.
(FreeBackBuffer, FreeBackBuffers, CreateBackBuffer)
(SetStandardEventMask, NoteTargetSize, DestroyRenderTarget)
(picture_render_funcs): Keep track of the number of pixels
allocated on behalf of each client.
* renderer.c (RenderSetClient): New function.
* run.c (RunStep): Disconnect clients pending disconnect.
* shm.c (InitRender): Export the render error base.
* test.c (GetTestSurface):
* xdg_surface.c (XLGetXdgSurface): Attach the client to the
render target.
* xerror.c (enum _ClientMemoryCategory): New enum.
(ReleaseClientData, HandleClientDestroy, ErrorDataForClient)
(CategorizeClients, SavePendingDisconnectClient)
(DisconnectOneClient, ProcessPendingDisconnectClients)
(HandleBadAlloc): New functions.
(ErrorHandler): Handle BadAlloc errors by disconnecting pixmap
hogs.
* compositor.h: Update prototypes.
* frame_clock.c (struct _FrameClock): New fields for keeping
track of configure events.
(FreezeForValue): If the freeze is outdated, bring the counter
up to date now.
(XLFrameClockHandleFrameEvent): Set the number of configure
events that should have been considered by the frame clock upon
processing.
(XLFrameClockNoteConfigure): New function.
* picture_renderer.c (SwapBackBuffers): Remove outdated comment.
* xdg_surface.c (NoteConfigure, XLXdgRoleReconstrain):
* xdg_toplevel.c (NoteWindowResized): Note frame clock
configure.
* 12to11.conf (DRMFOURCCH): New variable.
* 12to11.man: Document new resource.
* Imakefile (GENHEADERS): Add
drm_modifiers.h.:(drm_modifiers.h): New target.
(cleandir): Clean up.
* compositor.h: Update prototypes.
* fns.c (TransformBox): Move to transform.c.
* frame_clock.c (PostEndFrame): Use 200 us, since 100 us is not
always enough.
* picture_renderer.c (struct _DrmModifierName): New structure.
(known_modifiers): New array.
(AddAdditionalModifier, ParseAdditionalModifiers)
(InitAdditionalModifiers): New functions.
(InitRenderFuncs): Call them.
(ApplyInverseTransform): Accept buffer width and height instead
of PictureBuffer. Move to transform.c.
(MaybeApplyTransform): Adjust calls.
(FindSupportedModifiers, InitDrmFormats): Stop adding the linear
format by default, and let the user specify it instead.
* subcompositor.c (InvertTransform): Move to transform.c.
* svnignore.txt: Add new generated header.
* transform.c (ApplyInverseTransform, TransformBox)
(InvertTransform): Move some functions here as they will be used
in the EGL backend.
* 12to11.c (XLMain): Initialize idle inhibition.
* 12to11.man: Document new resources.
* Imakefile (SRCS): Add idle_inhibit.c and process.c.
(OBJS): Add idle_inhibit.o and process.o.
(idle-inhibit-unstable-v1): New scanner target.
* README: Explain what is now supported.
* compositor.h (enum _ClientDataType): Add IdleInhibitData.
(struct _Surface): Keep track of the number of focused seats.
* fns.c (UnblockSigbus): Fix unblocking of SIGBUS.
(XLAddFdFlag): New function.
* picture_renderer.c (GetRenderDevice):
* seat.c (WriteKeymap):
* drm_lease.c (AddProvider): Make various file descriptors
close-on-exec.
* run.c (RunStep): Change poll function to one that applies the
result of SIGCHLD.
* surface.c (XLSurfaceNoteFocus): Keep track of the number of
focused seats and call idle inhibit hooks when that changes.
* 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.
* compositor.h (XLAssert): Make a macro.
* dnd.c (HandleCirculateNotify, HandleReparentNotify): Fix NULL
checks.
(ReadProtocolProperties): Return suitable values for windows
that aren't in the cache.
* egl.c (HaveEglExtension1): Avoid redundant assignment to n.
* fns.c (XLAssert): Delete function.
* picture_renderer.c (GetRenderDevice): Remove redundant TODO.
(BufferFromShm): Assert that pict_format is non-NULL.
(ValidateShmParams): Likewise.
* pointer_constraints.c (ApplyLines): Remove redundant
assignment to i.
* renderer.c (PickRenderer): Fix build with non-GCC compilers.
* seat.c (ComputeHotspot): Return values when surface is NULL.
(XLSeatExplicitlyGrabSurface): Don't save keyboard grab state.
* shm.c (CreatePool): Close fd and return if pool could not be
allocated.
* subcompositor.c (GetContentScale): Move earlier.
(ViewDamageBuffer, ViewGetContentScale): New functions.
(SubcompositorUpdate): Remove redundant assignment.
* surface.c (ApplyViewport): Make dest_width and dest_height
double.
(ApplyDamage): Call ViewDamageBuffer.
(ScaleToWindow):
* text_input.c (HandleNewIM):
* xdg_toplevel.c (SendDecorationConfigure1, HandleWmStateChange)
(HandleAllowedActionsChange, HandleDecorationResourceDestroy):
Avoid NULL pointer dereferences in various cases.
* 12to11.c (DetermineServerTime): Correctly handle server time
truncation.
* Imakefile (SRCS): Add time.c
(OBJS): Add time.o.
* compositor.h (struct _Timestamp, enum _TimestampDifference):
New structure and enum.
(TimestampIs, TimeIs): New macros.
(struct _CreateOfferFuncs): Accept Timestamp, not Time.
* data_device.c (UpdateSingleReferenceWithForeignOffer)
(XLSetForeignSelection, XLClearForeignSelection): Accept
Timestamp, not Time.
* dnd.c (XLDoDragMotion):
* picture_renderer.c (InitRenderFuncs):
* primary_selection.c (UpdateSingleReferenceWithForeignOffer)
(XLSetForeignPrimary, XLClearForeignPrimary): Adjust for changed
timestamp handling.
* seat.c (struct _Seat): New field `last_user_time'.
(HandleRawKey, DispatchMotion): Record last user time as
timestamp.
(GetLastUserTime, XLSeatGetLastUserTime): Return Timestamp, not
Time.
* select.c (FindWriteTransfer, TransferFinished)
(TransferBecameReadable, ConvertSelectionMultiple)
(HandleSelectionRequest, DrainQueuedTransfers)
(HandlePropertyDelete, HandlePropertyNotify): Allow duplicate
write transfers if the other is only waiting for property
deletion.
* xdata.c (ReceiveBody, HandleOfferResourceDestroy)
(AllocateTimestamp, CreateOffer, CreatePrimaryOffer, SendOffers)
(SendPrimaryOffers, HandleNewSelection, NoticeClipboardCleared)
(NoticePrimaryCleared, HandleSelectionNotify)
(XLNoteSourceDestroyed, NoteLocalSelectionBody)
(NoteLocalSelectionFooter): Adjust timestamp handling to use
wraparound-safe Timestamp and not Time.
* 12to11.c (XLMain): Initialize wp_viewporter.
* Imakefile (ETAGS): Remove unused variable.
(SRCS, OBJS): Add wp_viewporter.c and wp_viewporter.o.
(GENHEADERS): Remove unnecessary headers.
(viewporter): New scanner target.
* README: Document support for wp_viewporter.
* compositor.h (struct _ViewportExt): New forward declaration.
(struct _DrawParams): New fields for cropping and stretching.
(struct _RenderFuncs): Describe how composite works.
(struct _BufferFuncs): Make update_buffer_for_damage take
DrawParams as an argument.
(struct _State): New fields for viewporting.
(struct _Surface): New field `viewport' and associated input
delta.
(struct _XdgRoleImplementationFuncs): New field
`is_window_mapped'. Do not commit while unmapped.
* dmabuf.c (XLInitDmabuf): Remove outdated comment.
* dnd.c (HandleMotion): Use TruncateWindowToSurface.
* egl.c (struct _EglBuffer): Add 3x3 reverse transformation
matrix.
(struct _CompositeProgram): Rename `scale' to `source'.
(Index): New macro.
(PickBetterVisual, FindVisual): Compensate for EGL picking a
non-RGBA visual.
(EglCompileCompositeProgram): Look for source, not scale.
(ComputeTransformMatrix): New function.
(Composite): Compute transformation matrix and draw using that.
(BufferFromDmaBuf, BufferFromShm): Copy identity transform and
stop setting scale.
(ReverseTransformToBox): New function.
(UpdateShmBufferIncrementally): Accept DrawParams and invert
damage according to that.
(UpdateBuffer, UpdateBufferForDamage): Pass draw params to the
incremental buffer update function.
* fns.c (XLExtendRegion): New function.
* frame_clock.c (CurrentHighPrecisionTimestamp): Delete
function.
(HighPrecisionTimestamp, HighPrecisionTimestamp32): New
functions.
(PostEndFrame): Handle X server time truncation to 32 bits.
(XLFrameClockFreeze): Remove trailing whitespace.
* picture_renderer.c (GetSourceX, GetSourceY, CompareStretch):
New functions.
(MaybeApplyTransform): Check more values before applying
transformations. Then, handle stretch and offset.
* positioner.c (GetAdjustmentOffset, ApplyConstraintAdjustment)
(XLPositionerCalculateGeometry): Scale coordinates using new
functions.
* renderer.c (RenderUpdateBufferForDamage): Accept DrawParams
instead of scale.
* shaders.txt (Composite Rectangle Fragment Shader RGBA)
(Composite Rectangle Fragment Shader RGBX)
(Composite Rectangle Fragment Shader External): Stop
transforming texcoords.
(Composite Rectangle Vertex Shader): Transform texcoords in the
vertex shader instead.
* subcompositor.c (IsViewported, SetViewported,
ClearViewported): New functions.
(struct _View): New fields for tracking viewports and fractional
offsets.
(ViewAttachBuffer): Do not garbage upon buffer size change if a
viewport is set.
(ViewMoveFractional): New function.
(ViewDamage): Describe what the damage is and is not transformed
by.
(GetContentScale): New function.
(ViewWidth, ViewHeight): Apply viewport.
(ViewSetScale): Use ViewAfterSizeUpdate instead of duplicating
code.
(ViewSetViewport, ViewClearViewport): New functions.
(ViewComputeTransform): Compute transform for viewports. New
arg draw; use it to determine whether or not to include a
fractional offset.
(IntersectBoxes): Fix intersection calculation.
(SubcompositorUpdate): Don't keep calling ViewWidth and
ViewHeight in a loop.
(SubcompositorExpose): Adjust for changes to buffer damage
uploading.
* subsurface.c (MoveFractional): New function. Handle
fractional offsets after scaling.
(MaybeUpdateOutputs, AfterParentCommit, Setup, Rescale): Use
that function to move the subsurface instead.
* surface.c (ApplyScale): Update comment.
(ApplyViewport, CheckViewportValues): New functions.
(HandleScaleChanged): Apply the viewport as well upon scale
change.
(ApplyDamage): Improve damage calculation for viewported
surfaces.
(SavePendingState, InternalCommit): Save and commit viewport
state; check old values upon buffer commit.
(InitState): Initialize viewport to initial values.
(XLSurfaceRunFrameCallbacks): Handle overflows of 32-bit time at
the 49-day mark.
(SurfaceToWindow, ScaleToWindow, WindowToSurface, ScaleToSurface)
(TruncateScaleToWindow, TruncateScaleToWindow)
(TruncateWindowToSurface, TruncateScaleToSurface): New functions
for handling scale.
* xdg_popup.c (MoveWindow, IsWindowMapped, XLGetXdgPopup):
* xdg_surface.c (IsRoleMapped, Commit, Subframe)
(GetResizeDimensions, XLXdgRoleCalcNewWindowSize):
* xdg_toplevel.c (IsWindowMapped, NoteConfigureTime, SendStates)
(RecordStateSize, HandleWindowGeometryChange, NoteWindowPreResize)
(XLGetXdgToplevel): Use them instead of manually multiplying
with the factor.
* egl.c (TargetFromPixmap): Set new `IsPixmap' flag.
(FinishRender): Call glFinish on single-buffered pixmap surface.
* picture_renderer.c (HavePixmapFormat): New function.
(FindSupportedFormats): Check that the relevant pixmap format is
supported.
(DepthForFormat): Return bpp in new bpp argument.
(BufferFromShm): Adjust accordingly.
(GetScanlinePad): New function.
(Roundup): New macro.
(ValidateShmParams): Take into account bytes per pixel and
scanline pad.
(SetupMitShm): Require pixmap formats mandated by Wayland
specification.
(InitBufferFuncs): Initialize supported pixmap formats.
* seat.c (CursorRingElements, CursorRingBusy): New macros.
(struct _CursorRing): New struct.
(struct _SeatCursor): Assign cursor ring to seat cursor.
(MakeCursorRing, MaybeCreateCursor, GetUnusedCursor)
(FreeCursorRing, ResizCursorRing): New functions for managing a
ring of cursor render targets.
(UpdateCursorOutput, FreeCursor, UpdateCursorFromSubcompositor)
(ApplyEmptyCursor, Subframe, EndSubframe): Use cursors provided
by that ring to avoid creating new render targets while
animating cursors.
* 12to11.c (XLMain): Initialize explicit synchronization.
* Imakefile (SRCS, OBJS): Remove generated files.
(ScannerTarget): New macro.
(clean): Clean GENSRCS as well.
(linux-dmabuf-unstable-v1.h):
(linux-dmabuf-unstable-v1.c):
(xdg-shell.h):
(xdg-shell.c):
(primary-selection-unstable-v1.h):
(primary-selection-unstable-v1.c): Remove and replace with
ScannerTarget.
* README: Announce explicit synchronization support.
* compositor.h (union _RenderFence): New union.
(struct _RenderFuncs): Add fence functions.
(struct _Surface): New fields for explicit synchronization
objects and release callbacks.
* egl.c (EglInitFuncs, EglInitGlFuncs, EglInitDisplay):
Initialize functions and extensions used for explicit
synchronization, and set render func flags.
(ImportFdFence, WaitFence, DeleteFence, HandleFenceReadable)
(GetFinishFence): New functions.
(egl_render_funcs): Add those functions.
(AddRenderFlag): New function.
* fns.c (MaybeInstallBusHandler): Fix coding style.
* picture_renderer.c (ImportFdFence, WaitFence, DeleteFence)
(GetFinishFence): New stubs.
(picture_render_funcs): Add those functions; they should never
be called.
* renderer.c (RenderImportFdFence):
(RenderWaitFence):
(RenderDeleteFence):
(RenderGetFinishFence): New wrapper functions.
* run.c (struct _PollFd, XLAddWriteFd, XLAddReadFd): Add pollfd
field to callback args.
(RunStep): Pass them to callbacks. Also, fix a comment.
* surface.c (DoRelease): New function.
(DestroySurface): Clear release if possible.
(SavePendingState, TryEarlyRelease): Extract release code to
DoRelease.
(InternalCommit): Wait for sync fences before continuing.
(Commit): Close acquire fence and release sync release object.
(HandleSurfaceDestroy): Destroy release callback and close
acquire fence.
(XLCreateSurface): Clear acquire fence field with right initial
value.
* xdata.c (NoticeTransferWritable):
(NoticeTransferReadable):
(NoticeConversionTransferReadable):
(NoticeConversionTransferWritable): Adjust arguments for new
callback data.
* 12to11.c (MakeColormap): Delete function.
(XLMain): Stop making colormap here.
* compositor.h (ImmediateRelease): New flag.
(struct _BufferFuncs): New field can_release_now.
(struct _State): New flag `BufferAlreadyReleased'.
* egl.c (struct _CompositeProgram): New field `invert_y'.
(EglCompileCompositeProgram): Get new uniform index.
(Composite): Apply InvertY.
(egl_render_funcs): Set ImmediateRelease flag.
(BufferFromDmaBuf): Set InvertY flag if set.
(UpdateTexture, UpdateShmBufferIncrementally): Set CanRelease
flag on SHM buffers.
(UpdateBuffer): Don't update if damage is empty.
(CanReleaseNow): New function.
(egl_buffer_funcs): Add CanReleaseNow.
* picture_renderer.c (MakeCheckWindow): New function.
(FindSupportedModifiers): Use a more similar window to look for
modifiers.
(CanReleaseNow): New function.
(picture_buffer_funcs): Add CanReleaseNow.
* renderer.c (RenderCanReleaseNow): New wrapper function.
(InstallRenderer): Create colormaps here, so the buffer init
function can get it.
* shaders.txt (Composite Rectangle Fragment Shader RGBA)
(Composite Rectangle Fragment Shader RGBX)
(Composite Rectangle Fragment Shader External): New uniform
`invert_y'.
(main): Use it.
* subcompositor.c (SubcompositorUpdate): Always update attached
buffer from damage, even if damage is empty.
* surface.c (TryEarlyRelease): New function.
(InternalCommit): Call it. Also, do not call role
release_buffer hook if ImmediateRelease is specified by the
renderer.
(SavePendingState): Likewise, release buffers immediately if
possible.