Commit graph

170 commits

Author SHA1 Message Date
hujianwei
e73914d7dd Correctly implement nested subsurface sync or desync
* compositor.h (struct _RoleFuncs): Get rid of note_desync_child
and co.
* frame_clock.c (StartFrame): Fix typo.
* subsurface.c (struct _Subsurface): New field
`should_be_desync'.
(NoteDesyncChild, NoteChildSynced): Delete functions.
(IsParentSynchronous): New function.
(SetSync1, NoteSubsurfaceDesynchronous, NoteSubsurfaceTeardown):
New functions.
(SetSync): Make all children synchronous when required.
(SetDesync): Desynchronize all children if possible; otherwise,
keep the surface synchronous but set the `should_be_desync'
flag.
(EarlyCommit): Merge pending state if required.
(Setup): Call SetSync1 to make children synchronous.
(Teardown): Call NoteSubsurfaceTeardown to make children
desynchronous as required.
(GetSubsurface): Stop setting
note_child_synced/note_desync_child.

* surface.c (InternalCommit1): New function.
(InternalCommit): Move state merging logic to InternalCommit1.
(XLSurfaceMergeCachedState): New function.

* xdg_surface.c (struct _XdgRole): Remove `n_desync_children'.
(UpdateFrameRefreshPrediction): Resort to counting the number of
children on each frame instead.
(Setup, NoteFrame, NoteChildSynced, NoteDesyncChild, HandleFreeze)
(XLGetXdgSurface): Stop counting sync/desync children.

* tests/subsurface_test.c (enum test_kind, test_names): Add
SUBSURFACE_DESYNC_KIND.
(LAST_TEST): Set to SUBSURFACE_DESYNC_KIND.
(test_single_step): Implement SUBSURFACE_DESYNC_KIND.
2022-11-06 03:21:27 +00:00
hujianwei
e5fe4380eb ; * Imakefile: Fix typo. 2022-11-06 00:53:00 +00:00
hujianwei
55cae69aa1 Add some initial wrapping for ports
* Imakefile (EXTRA_DEFINES, DEPEND_DEFINES, ANALYZE, OPTIMIZE):
Make port and compiler specific.
* compositor.h: Update compiler-specific defines.
* fns.c (PortPopcount): New function.
* seat.c (MaskPopCount): Use Popcount macro.
2022-11-05 13:31:32 +00:00
hujianwei
d17262c6ea * port_gnu.h: New file. 2022-11-05 13:29:25 +00:00
hujianwei
6f22495cd1 ; * 12to11.man (OPTIONS): Remove extraneous titled paragraph. 2022-11-05 12:28:13 +00:00
hujianwei
736aef224c Fix problems with test Imakefile
* tests/Imakefile (GENFILES): New variable.
(ScannerTarget): Append to GENFILES.
(depend): Only depend on COMMONSRCS.
(clean): Clean generated files.
2022-11-05 12:13:10 +00:00
hujianwei
892b74ede2 ; * 12to11.c (XLMain): Fix call to XInitThreads. 2022-11-05 12:02:15 +00:00
hujianwei
c26d1c4939 Enable map/unmap optimizations for subsurfaces
* subcompositor.c (ViewMap, ViewUnmap): Union view inferior
bounds whenever possible, instead of garbaging the
subcompositor.
* tests/subsurface_test.c (enum test_kind): New test
`SUBSURFACE_STACKING_1_KIND'.
(test_names): Add new name.
(LAST_TEST): Set to SUBSURFACE_STACKING_1_KIND.
(test_single_step): Implement SUBSURFACE_STACKING_1_KIND.
2022-11-05 10:45:39 +00:00
hujianwei
e712b6b57a Check in new subsurface test dumps
* tests/subsurface_test_18.dump:
* tests/subsurface_test_19.dump: New files.
2022-11-05 10:44:11 +00:00
hujianwei
21aa7494cd Add new buffer scale tests
* 12to11-test.xml (test_manager): <error>: New errors
`scale_lock_exists' and `invalid_scale'.
(test_manager): <get_test_surface>: Reword documentation.
(test_manager): <get_scale_lock>: New request.
(test_scale_lock): New interface.

* compositor.h: Update prototypes.
* output.c (HandleScaleSettingChange): New function.  Ignore
scale changes while scale is locked.
(XLInitRROutputs): Initialize real output scale.
* test.c (DestroyScaleLock, SetScale, GetScaleLock): New
functions.
(test_manager_impl): Add new implementation.
* tests/Imakefile (SYSTEM_LIBRARIES): Add MathLibrary.
(SRCS7, OBJS7): Add scale_test.c/.o.
(PROGRAMS): Add scale_test.
(scale_test): New program target.
* tests/run_tests.sh (standard_tests): Add scale_test.
* tests/svnignore.txt: Add scale_test.
* tests/test_harness.c (exit_with_code): New function.
(open_test_display): Initialize scale.
(report_test_failure): Call it instead of just exit.
(test_set_scale): New function.
(test_complete): Call exit_with_code.
* tests/test_harness.h (struct test_display): New field
`scale_lock'.
2022-11-05 08:18:18 +00:00
hujianwei
fa29286c98 Check in files for buffer scale tests
* tests/buffer_scale_1_1.dump:
* tests/buffer_scale_1_2.dump:
* tests/buffer_scale_1_2_1.dump:
* tests/buffer_scale_1_2_2.dump:
* tests/buffer_scale_2_1.dump:
* tests/buffer_scale_2_2.dump:
* tests/buffer_scale_2_2_1.dump:
* tests/buffer_scale_2_2_2.dump:
* tests/scale.png:
* tests/scale_damage.png:
* tests/scale_test.c: New files.
2022-11-05 08:12:29 +00:00
hujianwei
cde0e6d701 Add viewporter tests with transforms
* tests/viewporter_test.c (enum test_kind, test_names): Add new
test VIEWPORT_SRC_250_50_200_200_DEST_50_75_90CW_KIND.
(LAST_TEST): Set to
VIEWPORT_SRC_250_50_200_200_DEST_50_75_90CW_KIND.
(test_single_step): Implement
VIEWPORT_SRC_250_50_200_200_DEST_50_75_90CW_KIND.
2022-11-05 06:25:41 +00:00
hujianwei
38f398d7dd Check in files for new test
* tests/viewport_src_250_50_200_200_dest_50_75_90cw_1.dump:
* tests/viewport_src_250_50_200_200_dest_50_75_90cw_2.dump: New
files.
2022-11-05 06:24:22 +00:00
hujianwei
ca4d00c38f Update subsurface tests and fix discovered bugs
* subcompositor.c (DoCull): Fix leak of temp region upon
encountering opaque view.
* tests/subsurface_test.c (enum test_kind, test_names): New test
SUBSURFACE_GROW_SHRINK_KIND.
(LAST_TEST): Make it the last test.
(test_single_step): Implement SUBSURFACE_GROW_SHRINK_KIND.
2022-11-05 05:59:05 +00:00
hujianwei
88ac22aa27 Check in files for new subsurface grow/shrink tests
* tests/big.png:
* tests/small.png:
* tests/subsurface_test_15.dump:
* tests/subsurface_test_16.dump:
* tests/subsurface_test_17.dump: New files.
2022-11-05 05:57:25 +00:00
hujianwei
47a650cfd6 Add tests for subsurfaces and fix bug found by them
* subcompositor.c (ViewInsert, ViewInsertAfter)
(ViewInsertBefore): Update bounds for child, not parent view.
* tests/Imakefile (SRCS1, OBJS1): Build imgview first.
(SRCS6, OBJS6): Add subcompositor tests.
(PROGRAMS): Add subsurface_test.
(subsurface_test): New program target.
* tests/run_tests.sh (standard_tests): Add subsurface_test.
* tests/svnignore.txt: Add subsurface_test.
* tests/test_harness.c (swizzle_png_row_premultiply): New
function.
(load_png_image): Premultiply images w/ alpha channel.
* tests/test_harness.h: Include more headers.
2022-11-05 03:44:48 +00:00
hujianwei
b8143cf32b * tests/tiny.png: New file. 2022-11-05 03:41:20 +00:00
hujianwei
f2a504e6eb Check in files for subsurface tests
* tests/cow_transparent.png:
* tests/gradient.png:
* tests/subsurface_1.png:
* tests/subsurface_1_damaged.png:
* tests/subsurface_base.png:
* tests/subsurface_damage.png:
* tests/subsurface_test.c:
* tests/subsurface_test_1.dump:
* tests/subsurface_test_10.dump:
* tests/subsurface_test_11.dump:
* tests/subsurface_test_12.dump:
* tests/subsurface_test_13.dump:
* tests/subsurface_test_14.dump:
* tests/subsurface_test_2.dump:
* tests/subsurface_test_3.dump:
* tests/subsurface_test_4.dump:
* tests/subsurface_test_5.dump:
* tests/subsurface_test_6.dump:
* tests/subsurface_test_7.dump:
* tests/subsurface_test_8.dump:
* tests/subsurface_test_9.dump:
* tests/subsurface_transparency.png: New files.
2022-11-05 03:40:54 +00:00
hujianwei
6b60fcefdf Update xdg-shell implementation
* compositor.h: Update prototypes.
* positioner.c (SetSize, SetAnchorRect, SetAnchor, SetGravity):
Signal specific errors upon invalid input.
(XLPositionerIsReactive): New function.
* xdg-shell.xml: Update from wayland-protocols 1.28.
* xdg_popup.c (struct _XdgPopup): Remove unused next, last
fields.
(DestroyBacking): Adjust accordingly.
(Reposition, XLGetXdgPopup): Check positioner validity.
(XLInitPopups): Remove unused popup list.
* xdg_toplevel.c (SetMaxSize, SetMinSize): Raise
XDG_TOPLEVEL_ERROR_INVALID_SIZE.
* xdg_wm.c (Destroy): Don't allow destroying wm_base with
surfaces.
2022-11-05 01:09:08 +00:00
hujianwei
9faad05a8d Add viewporter shrinking test
* tests/run_tests.sh: Add missed shebang.
* tests/viewporter_test.c (enum test_kind): Add
VIEWPORT_SRC_50_50_200_200_DEST_50_75_KIND.
(test_names): Add name for new test.
(LAST_TEST): Make VIEWPORT_SRC_50_50_200_200_DEST_50_75_KIND.
(test_single_step): Handle
VIEWPORT_SRC_50_50_200_200_DEST_50_75_KIND.
2022-11-04 12:47:38 +00:00
hujianwei
df8f5c7763 Add files for viewporter shrink test
* tests/viewport_src_50_50_200_200_dest_50_75_1.dump:
* tests/viewport_src_50_50_200_200_dest_50_75_2.dump: New files.
2022-11-04 12:46:45 +00:00
hujianwei
1879608d1a Check in new viewporter test files
* tests/imgview.c:
* tests/viewport_dest_200_150_1.dump:
* tests/viewport_dest_200_150_2.dump:
* tests/viewport_src_50_50_200_200_1.dump:
* tests/viewport_src_50_50_200_200_2.dump:
* tests/viewport_src_50_50_200_200_dest_500_500_1.dump:
* tests/viewport_src_50_50_200_200_dest_500_500_2.dump:
* tests/viewporter_test.c:
* tests/viewporter_test.png:
* tests/viewporter_test_1.png: New files.
2022-11-04 12:21:39 +00:00
hujianwei
b5e71e73b6 ; * tests/test_harness.c (struct image_data_header): Add missing pad. 2022-11-04 07:38:59 +00:00
hujianwei
6a0506a169 Add test for buffer transforms
* tests/Imakefile (OBJS3, SRCS3): New program.
(PROGRAMS): Add transform_test.
* tests/README: Document what these tests are.
* tests/damage_test.c (test_names): Fix coding style.
* tests/run_tests.sh (standard_tests): Add `standard_tests'.
* tests/svnignore.txt: Add transform_test.
* tests/test_harness.c (load_image_data): Fix stride validation
when height > width.
* tests/test_harness.h (FALLTHROUGH): New macro.
2022-11-04 07:22:57 +00:00
hujianwei
2875ae8df1 Check in new files for transform tests
* tests/transform_test.c:
* tests/transform_test_180_1.dump:
* tests/transform_test_180_2.dump:
* tests/transform_test_270_1.dump:
* tests/transform_test_270_2.dump:
* tests/transform_test_90_1.dump:
* tests/transform_test_90_2.dump:
* tests/transform_test_flipped_1.dump:
* tests/transform_test_flipped_180_1.dump:
* tests/transform_test_flipped_180_2.dump:
* tests/transform_test_flipped_2.dump:
* tests/transform_test_flipped_270_1.dump:
* tests/transform_test_flipped_270_2.dump:
* tests/transform_test_flipped_90_1.dump:
* tests/transform_test_flipped_90_2.dump: New files.
2022-11-04 07:19:25 +00:00
hujianwei
c8a99a3db7 ; Update some properties 2022-11-04 05:37:52 +00:00
hujianwei
5d033bc93f Add new damage test and unify buffer release code in xdg_surface
* 12to11-test.xml (test_surface): <description>: Document when
frame callbacks are run.
* 12to11.c (HandleCmdline): Accept new arg `printsocket'.
(XLMain): Pass socket to HandleCmdline.
* 12to11.man: Document new `printsocket' option.
* mime0.awk:
* mime1.awk:
* mime2.awk:
* mime3.awk:
* mime4.awk: Fix typos in copyright blurb.
* test.c (NoteBounds): Sync with X server after XResizeWindow.
(Commit): Run frame callbacks after unmap as well.
(GetTestSurface): Make windows override redirect.

* tests/Imakefile (SRCS2, OBJS2): New program.
(PROGRAMS): Add damage_test.
(damage_test): New program.  Depend on SRCS2.
* tests/README: Improve documentation on how to run tests.
* tests/simple_test.c (test_names): New list.
(LAST_TEST): New define.
(verify_single_step): Complete test upon last test being run.
(test_single_step): Submit correct surface damage.
(test_next_step): New function.  Does nothing here.
(handle_wl_callback_done): Run the next test.
(submit_surface_damage): New function.
* tests/svnignore.txt: Add damage_test and Makefile.bak.
* tests/test_harness.c (test_complete): New function.
* tests/test_harness.h: New prototypes.
* xdg_surface.c (struct _XdgRole): Use a buffer release helper.
(struct _ReleaseLaterRecord, DeleteRecord, FreeRecords)
(AddRecordAfter): Delete unused structs and functions.
(RunFrameCallbacksConditionally, BufferIdleCallback)
(ReleaseBacking, ReleaseBuffer, XLGetXdgSurface): Use and free
buffer release helper; run frame callbacks from its callback.
2022-11-04 05:36:10 +00:00
hujianwei
ad7443ebd3 Check in new test related files
* tests/basic_damage.png:
* tests/damage_test.c:
* tests/damage_test_1.dump:
* tests/damage_test_2.dump:
* tests/run_tests.sh: New files.
2022-11-04 05:26:16 +00:00
hujianwei
83a2d26df3 Check in tests
* tests/Imakefile:
* tests/README
* tests/basic_test_card.png:
* tests/blue.png:
* tests/simple_test.c:
* tests/simple_test.dump:
* tests/svnignore.txt:
* tests/test_harness.c:
* tests/test_harness.h: New files.
2022-11-04 02:41:19 +00:00
hujianwei
2230f5e406 Check in changes to core files used for tests
* 12to11.c (XLMain): Initialize tests.
* 12to11.conf (WAYLAND_CLIENT, PNG): New libraries
(BuildTests): New define.
* Imakefile: Add the ability to build tests in a subdirectory.
* compositor.c (HandleResourceDestroy, HandleBind): Remove
unused list.
* compositor.h (enum _RoleType): Add TestSurfaceType.
* run.c (HandleOneXEvent): Handle events for test surfaces.
* xdg_surface.c (FreeRecords): Cancel idle callback if
necessary.
(BufferIdleCallback): Remove extra whitespace.
(XLGetXdgSurface): Fix coding style.
2022-11-04 02:39:50 +00:00
hujianwei
4e9a442856 Check in C and XML files for tests
* 12to11-test.xml:
* buffer_release.c:
* test.c: New files.
2022-11-04 02:25:44 +00:00
hujianwei
0a68122e52 Fix damage unioning upon ViewMove
* subcompositor.c (ViewMove): Union previous damage at right
place.
2022-11-03 04:06:28 +00:00
hujianwei
6ad5901c97 Fix some positioner bugs
* positioner.c (DebugPrint): New macro.
(CalculatePosition, TrySlideX): Add more instrumentation.  Add
defaults when no gravity is specified.
(TrySlideY): Add defaults when no gravity is specified.
(TryFlipX): Fix incorrect inversion of AnchorGravityBottomRight.
(ApplyConstraintAdjustment): Add more instrumentation.
2022-11-02 08:00:28 +00:00
hujianwei
a7a17e02fa Implement damage simplification and some more optimizations for Firefox
* compositor.h (Rectangle): New struct for non-box rectangles.

* subcompositor.c (struct _Subcompositor): New fields
`last_update_max_x' and `last_update_max_y'.
(IsDamageComplicated, SimplifyDamage): Add simple damage
simplifier.
(SubcompositorUpdateBounds, SubcompositorUpdateBoundsForInsert)
(ViewAfterSizeUpdate, ViewAttachBuffer, ViewMove): Avoid
garbaging subcompositor on max_x and max_y changes for Firefox
Nightly.
(SubcompositorComposite): Simplify overcomplex damage.
(SubcompositorUpdate): Garbage subcompositor on max size change.
2022-11-02 06:31:20 +00:00
hujianwei
8eebb04502 Fix rotating transforms on EGL
* egl.c (UpdateBuffer): Fix coding style.
* subcompositor.c (IsPreviouslyTransformed)
(SetPreviouslyTransformed, ClearPreviouslyTransformed): New
macros.
(ViewSetTransform): Mark damage as untrusted until the next time
the buffer is uploaded.
(ApplyBufferDamage, ApplyUntransformedDamage): Upload entire
buffer upon untrusted damage.
2022-11-02 02:46:43 +00:00
hujianwei
168ce048be Implement support for pointer-gestures-unstable-v1
* 12to11.c (XLMain): Initialize pointer gestures.
* 12to11.man (supported): Document that pointer gestures are now
supported.
* Imakefile (SRCS): Add pointer_gestures.c.
(OBJS): Add pointer_gestures.o.
(pointer-gestures-unstable-v1): New scanner target.
* README (supported): Documentation changes.
* compositor.h: Update prototypes.  Export xi2_major and
xi2_minor from seat.c.
* seat.c (struct _SwipeGesture, struct _PinchGesture): New
structures.
(struct _SeatClientInfo, CreateSeatClientInfo): Initialize those
structures in the seat client info.
(EnteredSurface): Clear any gestures if the surface changed.
(SendGesturePinchBegin, SendGesturePinchUpdate)
(SendGesturePinchEnd, DispatchGesturePinch, SendGestureSwipeBegin)
(SendGestureSwipeUpdate, SendGestureSwipeEnd,
DispatchGestureEnd): New functions.
(XLGetGEWindowForSeats, XLSelectStandardEvents)
(XLDispatchGEForSeats): Handle and select for various kinds of
XI events.
(XLInitSeats): Ask for XI 2.4.
(XLSeatGetSwipeGesture, XLSeatGetPinchGesture)
(XLSeatDestroySwipeGesture, XLSeatDestroyPinchGesture): New
functions.
2022-11-01 11:02:36 +00:00
hujianwei
000231fbb2 Check in new files for pointer gestures
* pointer-gestures-unstable-v1.xml:
* pointer_gestures.c: New files.
2022-11-01 10:56:52 +00:00
hujianwei
743d363ad2 Fix race condition between ConfigureNotify and PresentCompleteNotify
* 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.
2022-11-01 01:25:42 +00:00
hujianwei
da212fe729 Fix problems seen with some programs in the wild
* subcompositor.c (ViewAttachBuffer): Correctly determine when
to recompute view bounds.
* subsurface.c (AfterParentCommit): Unskip view first, and
commit pending state second.  Explain why.
* xdg_toplevel.c (Unmap, Map): Add new "initial configure" flag.
(Commit): Use it instead of testing current_buffer.  Explain
why.
(XLGetXdgToplevel): Set that flag by default.
2022-10-30 13:53:10 +00:00
hujianwei
0c3e5a0e7d Fix subsurface PlaceBelow relationship checks
* subsurface.c (PlaceBelow): Fix conditions in check.
2022-10-30 11:38:41 +00:00
hujianwei
3732001e57 ; * picture_renderer.c (MaybeApplyTransform): Check in missed change. 2022-10-30 11:34:02 +00:00
hujianwei
e001d7cf69 Fix and implement transforms in the EGL renderer
* 12to11.c (XLMain): Initialize Xlib threads.
* compositor.h: Update prototype of ApplyInverseTransform.
* egl.c (ComputeTransformMatrix): Handle transforms.
(Composite): Ensure textures if none were generated.
(FinishRender): Take callback and data and return NULL key.
(UpdateBuffer): Handle transforms by uploading everything.
Suboptimal!
(IsBufferOpaque): New function.
(egl_buffer_funcs): Add it.
* picture_renderer.c (MaybeApplyTransform): Add some comments.
* subcompositor.c (TransformBufferDamage): Avoid inverting
damage.
(ViewDamageBuffer): Directly apply untransformed buffer damage.
(ApplyUntransformedDamage): New function.
* transform.c (MatrixRotate): Fix minor row ordering error.
(ApplyInverseTransform): Adjust accordingly.
2022-10-30 09:51:54 +00:00
hujianwei
b8d26761c1 Fix crash during subsurface destruction
* subcompositor.c (ViewUnparent): Don't consider view as
attached if there is no subcompositor.
2022-10-30 02:35:48 +00:00
hujianwei
6f3941866a Apply subcompositor optimizations for Firefox Nightly
* subcompositor.c (struct _View): Fix comment.
(struct _Subcompositor): New field `additional_damage'.
(MakeSubcompositor): Initialize that field.
(SubcompositorUpdateBounds, SubcompositorUpdateBoundsForInsert):
Only garbage subcompositor if bounds really changed.
(SkipSlug): Move definition earlier.
(ViewUnionInferiorBounds, DamageIncludingInferiors): New
functions.
(SubcompositorInsert, SubcompositorInsertBefore)
(SubcompositorInsertAfter, ViewInsert, ViewInsertAfter)
(ViewInsertBefore, ViewUnparent, ViewAfterSizeUpdate)
(ViewAttachBuffer, ViewMove, ViewMoveFractional, ViewUnskip)
(ViewSetScale, ViewSetTransform, ViewSetViewport)
(ViewClearViewport, SubcompositorComposite, SubcompositorRedraw)
(SubcompositorFree): Handle damage in a more detailed fashion;
try to avoid garbaging upon subsurface movement, mapping, or
unmapping.
* wp_viewporter.c (SetSource, SetDestination): Don't set pending
if things didn't actually change.
2022-10-29 11:15:40 +00:00
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
0b5d44537b Allow the user to manually specify format modifiers
* 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.
2022-10-26 06:48:59 +00:00
hujianwei
8e4391f941 Check in new file for generating modifier list
* modifiers.awk: New file.
2022-10-26 06:44:31 +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
hujianwei
65a2e4de5b Check in unrelated fence code
* fence_ring.c: New file.
2022-10-25 10:02:14 +00:00
hujianwei
a63a7ebdd6 Fix frame timing prediction algorithm
* compositor.h (struct _RoleFuncs): Replace subframe with
`subsurface_update'.
* dmabuf.c (ExistingModifier):
* fns.c (RebalanceBusfault): Pacify various compiler warnings.
* frame_clock.c (struct _FrameClock, PostEndFrame)
(XLFrameClockHandleFrameEvent, XLMakeFrameClockForWindow): Fix
presentation logic.  First, store absolute presentation
timestamps.  Secondly, use the frame_delay to adjust timestamps.
* icon_surface.c (Subframe): Delete function.
(SubsurfaceUpdate): New function.
(EndSubframe): Delete function.
(XLGetIconSurface): Change attached functions.
* picture_renderer.c (struct _PictureTarget, RecordBufferActivity)
(HandleActivityEvent, DestroyRenderTarget)
(FillBoxesWithTransparency, Composite, FinishRender)
(picture_render_funcs): Send roundtrip event only once, and
flush upon FinishRender.
* process.c (ProcessPendingDescriptions, RunProcess,
ProcessPoll): Don't block signals where unnecessary.
* seat.c (struct _Seat, CursorFromRole, ReleaseSeat, Subframe)
(EndSubframe, MakeCurrentCursor, HandleBind, MakeSeatForDevicePair)
(StartResizeTracking):
* subsurface.c (Subframe, EndSubframe, Commit, Teardown)
(GetSubsurface):
* surface.c (HandleScaleChanged):
* xdg_surface.c (CheckFrame, Commit, Subframe, SubsurfaceUpdate)
(EndSubframe, XLGetXdgSurface):
* xdg_toplevel.c (Unmap): Adjust for above changes, and fix some
compiler warnings.
2022-10-24 03:45:57 +00:00