Compare commits

...

90 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult b1657d623d miext: rootless: use PostCreateResources screen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new PostCreateScreenResources screen hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 20:00:45 +02:00
Enrico Weigelt, metux IT consult 727ea3c5e0 xfree86: crtc: use PostCreateResources screen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new PostCreateScreenResources screen hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult 1fed267d0e exa: use PostCreateScreenResources hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new PostCreateScreenResources screen hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult f94064d0ac dix: add CreateScreenResources callback mechanism
Right now, extensions that need to be called after the CreateScreenResources
proc had been run, must wrap the screen proc vector directly (all of them
forming kind of daisy chain), and so - when called - temporarily restore the
previous one, call it, wrap again, and if the call was successful finally
doing it's own stuff. (same is done for many other procs)

While that approach is looking nice and elegant on the drawing board, it's
complicated, dangerous like a chainsaw and makes debugging hard, leading to
pretty blurred API borders.

Instead introducing a simple approach for letting extension hook into a
post-CreateScreenResources callback list safely, w/o having to care much
about side effects with the call chain. Extensions now can simply register
their business logic and get called back - w/o ever having to mess with the
ScreenRec's internal structures.

Note that these hooks are executed *AFTER* the original CreateScreenResources()
proc had been called SUCCESSFULLY (returned TRUE), so callees can rely on
the DDX/driver had already done it's job.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult 3cf8ae9bc5 glamor: use PixmapDestroy hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new pixmap destroy notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult b8f5b179db exa: use PixmapDestroy hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new pixmap destroy notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult f16a757147 damage: use PixmapDestroy hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new pixmap destroy notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult 360a71ac39 Xext: xv: use PixmapDestroy hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new pixmap destroy notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult b8c70a2ea5 Xext: shm: use PixmapDestroy hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new pixmap destroy notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult 0460ad3f7b dix: add per-screen pixmap destructor mechanism
Right now, extension specific pixmap destruction procedures are implemented
by wrapping the ScreenRec's DestroyPixmap() proc pointer: the extensions are
storing the original pointer in their private data and putting in their own one.
On each call, their proc restores the original one, calls it, and switches back
again. When multiple extensions doing so, they're forming a kind of daisy chain.
(the same is done for lots of other procs)

While that approach is looking nice and elegant on the drawing board, it's
complicated, dangerous like a chainsaw and makes debugging hard, leading to
pretty blurred API borders.

It's even getting worse: the proc also has to do ref counting, and only destroy
the pixmap if refconter reaching zero - that's all done in the individual screen
drivers. Therefore, all extensions must check for refcnt == 1, in order to know
when to really act.

This commit introduces a simple approach for letting extension hook into the
pixmap destruction safely, w/o having to care much about side effects with
the call chain. Extensions now can simply register their destructor proc
(and an opaque pointer) and get called back - w/o ever having to mess with
the ScreenRec's internal structures.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult ee18ec784e xfree86: shadowfb: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult 2c955864eb xfree86: cursor: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult 35a2a68e3e xfree86: crtc: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

This one doesn't look so trivial at first glance, but I've checked that
other functions called by xf86CrtcCloseScreen() just free'ing up some
memory and removing the CRTCs from some lists - thus a change in
execution order really shouldn't matter at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult c6835ae27b xfree86: exa: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult c20c680b90 xfree86: xvmc: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult 48b06f3e2f xfree86: xv: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult 5d04e1511c xfree86: sbus: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult 78981c35f6 xfree86: fbman: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult a8b8d6abf2 xfree86: cmap: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult ba335b9a2d xfree86: randr: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult 0defaf5fdc xfree86: dga: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult 161da21186 panoramiX: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult 63e606ff61 miext: rootless: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult 03169ebe87 miext: shadow: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult ff3799a5a8 miext: damage: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult 650002cb77 present: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult be7a034b0e xwayland: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult 405848519a mi: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult bd110f8e9e mi: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult 2bd54bb790 randr: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult f315b2b07d glamor: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult feee189a02 exa: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult 0dcb32a11a compext: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:54 +02:00
Enrico Weigelt, metux IT consult 1579fa08d3 dri3: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 2d6e7289b6 render: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 9b99d43f4c xvmc: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult eb24420e4e xv: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 4984f82525 xfixes: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 9e5361a0a5 Xext: shm: use CloseScreen hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new screen close notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 0e5928738f dix: add per-screen close notify hook
Right now, extension specific actions on screen closing implemented by wrapping
the ScreenRec's PositionWindow() proc pointer: the extensions are storing the
original pointer in their private data and putting in their own one. On each
call, their proc restores the original one, calls it, and switches back again.
When multiple extensions doing so, they're forming a kind of daisy chain.
(the same is done for lots of other procs)

While that approach is looking nice and elegant on the drawing board, it's
complicated, dangerous like a chainsaw and makes debugging hard, leading to
pretty blurred API borders.

This commit introduces a simple approach for letting extension hook into the
screen closing path safely, w/o having to care much about side effects with
the call chain. Extensions now can simply register their hook proc (and an
opaque pointer) and get called back - w/o ever having to mess with the
ScreenRec's internal structures. These hooks are called before the original
vector (usually handled by DDX/screen driver directly) is called.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult b730e6e345 rootless: use window position notify hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new window position notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 1607189e3e dbe: use window position notify hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new window position notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult c63b649447 composite: use window position notify hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new window position notify hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 021634b651 dix: add per-screen window position notify hook
Right now, extension specific actions on window positioning are implemented
by wrapping the ScreenRec's PositionWindow() proc pointer: the extensions are
storing the original pointer in their private data and putting in their own one.
On each call, their proc restores the original one, calls it, and switches back
again. When multiple extensions doing so, they're forming a kind of daisy chain.
(the same is done for lots of other procs)

While that approach is looking nice and elegant on the drawing board, it's
complicated, dangerous like a chainsaw and makes debugging hard, leading to
pretty blurred API borders.

This commit introduces a simple approach for letting extension hook into the
window positioning path safely, w/o having to care much about side effects
with the call chain. Extensions now can simply register their hook proc
(and an opaque pointer) and get called back - w/o ever having to mess with
the ScreenRec's internal structures. These hooks are called before the original
vector (usually handled by DDX/screen driver directly) is called.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult cee6167713 xwayland: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 9037dff02d xfree86: dri: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 4a5adb28fc xfree86: xv: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 616c669cbc kdrive: xv: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 2c90b61006 rootless: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult e7637c8d57 composite: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult d2c059e6ac xv: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 0d1f52700e damage: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 1d187175a8 render: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 75d178432e present: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult accf51b538 dbe: use window destructor hook
Wrapping ScreenRec's function pointers is problematic for many reasons,
so use the new window destructor hook instead.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 1df3e0b948 dix: add per-screen window destructor hook
Right now, extension specific window destruction procedures are implemented
by wrapping the ScreenRec's DestroyWindow() proc pointer: the extensions are
storing the original pointer in their private data and putting in their own one.
On each call, their proc restores the original one, calls it, and switches back
again. When multiple extensions doing so, they're forming a kind of daisy chain.
(the same is done for lots of other procs)

While that approach is looking nice and elegant on the drawing board, it's
complicated, dangerous like a chainsaw and makes debugging hard, leading to
pretty blurred API borders.

This commit introduces a simple approach for letting extension hook into the
window destruction safely, w/o having to care much about side effects with
the call chain. Extensions now can simply register their destructor proc
(and an opaque pointer) and get called back - w/o ever having to mess with
the ScreenRec's internal structures.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult e0dec3631f dix: make DeleteCallbackList() non-static and document it
Allow using it by other places outside this file, so we can also support
callback lists in dynamically allocated structures:

Those cases need to explicitly call DeleteCallbackList() before free()ing
the structures - otherwise we're getting heap corruptions, because the
actual deletion can happen asynchronously.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult ce4fb6e76d (!1905) dix: consolidate screen destruction in dixFreeScreen()
Consolidate duplicated screen destruction logic into new function
dixFreeScreen().

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult d15a424ade (!1905) dix: replace FreeDefaultStipple()
It's just a one-liner only called once, so no actual need for it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 4cd8120612 (!1905) dix: let FreeGCperDepth() operate on ScreenPtr and NULL protect it
Instead of retrieving the screen index from ScreenRec and passing this,
so the ScreenRec is looked up again, just pass in the ScreenPtr that
already have anyways.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 1871c1e57c (!1905) dix: NULL-protect FreeGC()
Make it possible to call FreeGC() w/o prior NULL checks.
In case of NULL, BadMatch is returned.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 88cdee6641 (!1936) xwin: fix missing include of mi/mi_priv.h
xwin relies on mi_priv.h being included indirectly, thus depending
on exact include within other header files. This can easily break if
something in other headers slightly changes.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 95638adbd7 (!1937) miext: sync: drop useless CloseScreen wrapping
This wrapped CloseScreen function doesn't do anything actually useful,
so no need to keep it around any longer. It used to do a free() on the
private data (which had been wrong in the first place) but this had
been removed and so the whole function became useless, it had been
forgotten to be swept away.

Fixes: 469d5bf8b7
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 9dec841124 (!1943) xfree86: unexport xf86RandR12CreateScreenResources()
Not used by any drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 5c991e9de5 (!1943) xfree86: unexport xf86RandR12CloseScreen()
Not used by any drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult bbb57ce2fb (!1945) egl: drop unused CreateScreenResources pointer
This field hasn't been actually used, so no need to keep it any longer.

Fixes: 60f14d60f6
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult d7672b3231 (!1946) kdrive: drop obsolete ifndef PHOENIX
The symbol isn't set anywhere, and git history didn't show anything
were it ever had been set, thus no need to keep this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 15734e17f6 (!1947) kdrive: call miCreateScreenResources() drectly
No need for complicated wrapping/unwrapping: it's always just
miCreateResources() anyway - so we can call it directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult cf2bbf6549 (!1947) kdrive: directly calling KdCloseScreen() instead of wrapping
No need to wrap CloseScreen proc vector, we can call KdCloseScreen() from
KdXVCloseScreen() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 0e3825cd6f (!1947) kdrive: directly calling fbCloseScreen instead of wrapping
No need to wrap CloseScreen proc vector, we can call fbCloseScreen() from
KdCloseScreen() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult aecbce1a8d (!1948) xwayland: call miCreateScreenResources() directly
No need for complicated wrapping/unwrapping: it's always just
miCreateResources() anyway - so we can call it directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult bac0f219aa (!1705) xwin: call miCreateScreenResources() directly
No need for complicated wrapping/unwrapping: it's always just
miCreateResources() anyway - so we can call it directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 070b444755 (!1705) xwin: drop wrapping on ScreenRec->ModifyPixmapHeader()
Instead of complicated wrapping, just call fbModifyPixmapHeader() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 4778219331 (!1705) xwin: drop winResizeWindowMultiWindow()
This wrapping function for Screen->ResizeWindow() is does nothing more than
just call the original functions. So no need to keep wrapping it at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 720eb7462d (!1705) xwin: drop wrapping on ScreenRec->MoveWindow()
Instead of complicated wrapping, just call fbMoveWindow() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult e38a527f05 (!1705) xwin: drop wrapping on ScreenRec->RestackWindow()
This proc vector is optional (callers check for non-null) and neither fb nor
mi set it, so we can just assign our function directly. No need for wrapping.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 03059df0e2 (!1705) xwin: drop wrapping on ScreenRec->ReparentWindow()
This proc vector is optional (callers check for non-null) and neither fb nor
mi set it, so we can just assign our function directly. No need for wrapping.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 4d887919fa (!1705) xwin: drop wrapping on ScreenRec->UnrealizeWindow()
Instead of complicated wrapping, just call fbUnrealizeWindow() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 82d98d3a21 (!1705) xwin: drop wrapping on ScreenRec->RealizeWindow()
Instead of complicated wrapping, just call fbRealizeWindow() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 8df79bd787 (!1705) xwin: drop wrapping on ScreenRec->SetShape()
Instead of complicated wrapping, just call fbSetShape() directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 1990485a1c (!1705) xwin: drop winCopyWindowMultiWindow()
This wrapping function for Screen->CopyWindow() is does nothing more than
just call the original functions. So no need to keep wrapping it at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 293c673b55 (!1705) xwin: call winFinishScreenInitFB() directly
Both engines, GDI as well as DirectDraw, using the same screen init finish function,
so no need to keep indirection via per-engine callback pointer.

The winFinishScreenInitFB() can also be made static now.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:53 +02:00
Enrico Weigelt, metux IT consult 7e2e77b9fd (!1705) xwin: glx: drop glxWinUnrealizeWindow()
It does nothing more than just calling the original/wrapped function,
so we don't need that at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:52 +02:00
Enrico Weigelt, metux IT consult aad8b6f910 (!1705) xwin: glx: drop glxWinRealizeWindow()
It does nothing more than just calling the original/wrapped function,
so we don't need that at all.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:52 +02:00
Enrico Weigelt, metux IT consult c3256940a3 (!1705) xwin: drop wrapping on ScreenRec->ChangeWindowAttributes()
Instead of complicated wrapping, just call fbCreateWindow directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:52 +02:00
Enrico Weigelt, metux IT consult ac523d9041 (!1705) xwin: drop wrapping on ScreenRec->CreateWindow()
Instead of complicated wrapping, just call fbCreateWindow directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:52 +02:00
Enrico Weigelt, metux IT consult e44b9020c5 (!1705) xwin: drop wrapping on ScreenRec->PositionWindow()
Instead of complicated wrapping, just call fbPositionWindow directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:52 +02:00
Enrico Weigelt, metux IT consult c2eb26bb9b (!1705) xwin: drop wrapping on ScreenRec->DestroyWindow()
Instead of complicated wrapping, just call fbDestroyWindow directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:52 +02:00
Enrico Weigelt, metux IT consult 5544876d5e (!1949) xfree86: modeset: call miCreateScreenResources() directly
No need for complicated wrapping/unwrapping: it's always just
miCreateResources() anyway - so we can call it directly.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:43:52 +02:00
Enrico Weigelt, metux IT consult fda404fd15 (!1950) xfixes: use embedded private instead of pointer
The private struct is pretty small and it needs to be allocated anyways,
so save an extra allocation by directly embedding it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-02 19:41:49 +02:00
102 changed files with 1088 additions and 1400 deletions

View File

@ -32,6 +32,7 @@ Equipment Corporation.
#include <X11/extensions/panoramiXproto.h>
#include "dix/dix_priv.h"
#include "dix/screen_hooks_priv.h"
#include "misc.h"
#include "cursor.h"
@ -123,7 +124,6 @@ typedef struct {
typedef struct {
CreateGCProcPtr CreateGC;
CloseScreenProcPtr CloseScreen;
} PanoramiXScreenRec, *PanoramiXScreenPtr;
static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr);
@ -148,21 +148,23 @@ static const GCFuncs XineramaGCFuncs = {
pGCPriv->wrapFuncs = (pGC)->funcs;\
(pGC)->funcs = &XineramaGCFuncs;
static Bool
XineramaCloseScreen(ScreenPtr pScreen)
static void XineramaCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unsused)
{
dixScreenUnhookClose(pScreen, XineramaCloseScreen);
PanoramiXScreenPtr pScreenPriv = (PanoramiXScreenPtr)
dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
if (!pScreenPriv)
return;
pScreen->CreateGC = pScreenPriv->CreateGC;
if (pScreen->myNum == 0)
RegionUninit(&PanoramiXScreenRegion);
free(pScreenPriv);
return (*pScreen->CloseScreen) (pScreen);
dixSetPrivate(&pScreen->devPrivates, PanoramiXScreenKey, NULL);
}
static Bool
@ -484,11 +486,10 @@ PanoramiXExtensionInit(void)
return;
}
pScreenPriv->CreateGC = pScreen->CreateGC;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
dixScreenHookClose(pScreen, XineramaCloseScreen);
pScreenPriv->CreateGC = pScreen->CreateGC;
pScreen->CreateGC = XineramaCreateGC;
pScreen->CloseScreen = XineramaCloseScreen;
}
XRC_DRAWABLE = CreateNewResourceClass();

View File

@ -43,6 +43,7 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xfuncproto.h>
#include "dix/dix_priv.h"
#include "dix/screen_hooks_priv.h"
#include "os/auth.h"
#include "os/busfault.h"
#include "os/client_priv.h"
@ -96,9 +97,7 @@ in this Software without prior written authorization from The Open Group.
#endif /* XINERAMA */
typedef struct _ShmScrPrivateRec {
CloseScreenProcPtr CloseScreen;
ShmFuncsPtr shmFuncs;
DestroyPixmapProcPtr destroyPixmap;
} ShmScrPrivateRec;
Bool noMITShmExtension = FALSE;
@ -109,8 +108,6 @@ static void ShmResetProc(ExtensionEntry *extEntry);
static void SShmCompletionEvent(xShmCompletionEvent *from,
xShmCompletionEvent *to);
static Bool ShmDestroyPixmap(PixmapPtr pPixmap);
static unsigned char ShmReqCode;
int ShmCompletionCode;
int BadShmSegCode;
@ -195,15 +192,13 @@ CheckForShmSyscall(void)
#endif
static Bool
ShmCloseScreen(ScreenPtr pScreen)
static void
ShmScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
pScreen->CloseScreen = screen_priv->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL);
free(screen_priv);
return (*pScreen->CloseScreen) (pScreen);
}
static ShmScrPrivateRec *
@ -213,9 +208,8 @@ ShmInitScreenPriv(ScreenPtr pScreen)
if (!screen_priv) {
screen_priv = calloc(1, sizeof(ShmScrPrivateRec));
screen_priv->CloseScreen = pScreen->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
pScreen->CloseScreen = ShmCloseScreen;
dixScreenHookClose(pScreen, ShmScreenClose);
}
return screen_priv;
}
@ -247,28 +241,6 @@ ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs)
ShmInitScreenPriv(pScreen)->shmFuncs = funcs;
}
static Bool
ShmDestroyPixmap(PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
void *shmdesc = NULL;
Bool ret = TRUE;
if (pPixmap->refcnt == 1)
shmdesc = dixLookupPrivate(&pPixmap->devPrivates, shmPixmapPrivateKey);
pScreen->DestroyPixmap = screen_priv->destroyPixmap;
if (pScreen->DestroyPixmap)
ret = pScreen->DestroyPixmap(pPixmap);
screen_priv->destroyPixmap = pScreen->DestroyPixmap;
pScreen->DestroyPixmap = ShmDestroyPixmap;
if (shmdesc)
ShmDetachSegment(shmdesc, 0);
return ret;
}
void
ShmRegisterFbFuncs(ScreenPtr pScreen)
@ -437,6 +409,9 @@ ShmDetachSegment(void *value, /* must conform to DeleteType */
ShmDescPtr shmdesc = (ShmDescPtr) value;
ShmDescPtr *prev;
if (!shmdesc)
return Success;
if (--shmdesc->refcnt)
return TRUE;
#if SHM_FD_PASSING
@ -1514,6 +1489,14 @@ SProcShmDispatch(ClientPtr client)
}
}
static void ShmPixmapDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
{
ShmDetachSegment(
dixLookupPrivate(&pPixmap->devPrivates, shmPixmapPrivateKey),
0);
dixSetPrivate(&pPixmap->devPrivates, shmPixmapPrivateKey, NULL);
}
void
ShmExtensionInit(void)
{
@ -1542,13 +1525,8 @@ ShmExtensionInit(void)
sharedPixmaps = xFalse;
}
if (sharedPixmaps)
for (i = 0; i < screenInfo.numScreens; i++) {
ShmScrPrivateRec *screen_priv =
ShmGetScreenPriv(screenInfo.screens[i]);
screen_priv->destroyPixmap =
screenInfo.screens[i]->DestroyPixmap;
screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap;
}
for (i = 0; i < screenInfo.numScreens; i++)
dixScreenHookPixmapDestroy(screenInfo.screens[i], ShmPixmapDestroy);
}
ShmSegType = CreateNewResourceType(ShmDetachSegment, "ShmSeg");
if (ShmSegType &&

View File

@ -173,9 +173,6 @@ typedef struct {
int version, revision;
int nAdaptors;
XvAdaptorPtr pAdaptors;
DestroyWindowProcPtr DestroyWindow;
DestroyPixmapProcPtr DestroyPixmap;
CloseScreenProcPtr CloseScreen;
} XvScreenRec, *XvScreenPtr;
extern _X_EXPORT int XvScreenInit(ScreenPtr);

View File

@ -81,6 +81,7 @@ SOFTWARE.
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "dix/screen_hooks_priv.h"
#include "Xext/xvdix_priv.h"
#include "misc.h"
@ -141,9 +142,7 @@ static void WriteSwappedVideoNotifyEvent(xvEvent *, xvEvent *);
static void WriteSwappedPortNotifyEvent(xvEvent *, xvEvent *);
static Bool CreateResourceTypes(void);
static Bool XvCloseScreen(ScreenPtr);
static Bool XvDestroyPixmap(PixmapPtr);
static Bool XvDestroyWindow(WindowPtr);
static void XvScreenClose(CallbackListPtr *pcbl, ScreenPtr, void *arg);
static void XvResetProc(ExtensionEntry *);
static int XvdiDestroyGrab(void *, XID);
static int XvdiDestroyEncoding(void *, XID);
@ -152,6 +151,7 @@ static int XvdiDestroyPortNotify(void *, XID);
static int XvdiDestroyVideoNotifyList(void *, XID);
static int XvdiDestroyPort(void *, XID);
static int XvdiSendVideoNotify(XvPortPtr, DrawablePtr, int);
static void XvStopAdaptors(DrawablePtr pDrawable);
/*
** XvExtensionInit
@ -257,6 +257,16 @@ CreateResourceTypes(void)
}
static void XvWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
{
XvStopAdaptors(&pWin->drawable);
}
static void XvPixmapDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
{
XvStopAdaptors(&pPixmap->drawable);
}
int
XvScreenInit(ScreenPtr pScreen)
{
@ -290,34 +300,26 @@ XvScreenInit(ScreenPtr pScreen)
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, pxvs);
pxvs->DestroyPixmap = pScreen->DestroyPixmap;
pxvs->DestroyWindow = pScreen->DestroyWindow;
pxvs->CloseScreen = pScreen->CloseScreen;
pScreen->DestroyPixmap = XvDestroyPixmap;
pScreen->DestroyWindow = XvDestroyWindow;
pScreen->CloseScreen = XvCloseScreen;
dixScreenHookWindowDestroy(pScreen, XvWindowDestroy);
dixScreenHookClose(pScreen, XvScreenClose);
dixScreenHookPixmapDestroy(pScreen, XvPixmapDestroy);
return Success;
}
static Bool
XvCloseScreen(ScreenPtr pScreen)
static void XvScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
XvScreenPtr pxvs;
pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
pScreen->DestroyPixmap = pxvs->DestroyPixmap;
pScreen->DestroyWindow = pxvs->DestroyWindow;
pScreen->CloseScreen = pxvs->CloseScreen;
dixScreenUnhookWindowDestroy(pScreen, XvWindowDestroy);
dixScreenUnhookClose(pScreen, XvScreenClose);
dixScreenUnhookPixmapDestroy(pScreen, XvPixmapDestroy);
free(pxvs);
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
return (*pScreen->CloseScreen) (pScreen);
}
static void
@ -367,40 +369,6 @@ XvStopAdaptors(DrawablePtr pDrawable)
}
}
static Bool
XvDestroyPixmap(PixmapPtr pPix)
{
ScreenPtr pScreen = pPix->drawable.pScreen;
Bool status = TRUE;
if (pPix->refcnt == 1)
XvStopAdaptors(&pPix->drawable);
SCREEN_PROLOGUE(pScreen, DestroyPixmap);
if (pScreen->DestroyPixmap)
status = pScreen->DestroyPixmap(pPix);
SCREEN_EPILOGUE(pScreen, DestroyPixmap, XvDestroyPixmap);
return status;
}
static Bool
XvDestroyWindow(WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
Bool status;
XvStopAdaptors(&pWin->drawable);
SCREEN_PROLOGUE(pScreen, DestroyWindow);
status = (*pScreen->DestroyWindow) (pWin);
SCREEN_EPILOGUE(pScreen, DestroyWindow, XvDestroyWindow);
return status;
}
static int
XvdiDestroyPort(void *pPort, XID id)
{

View File

@ -5,6 +5,7 @@
#include <X11/X.h>
#include <X11/Xproto.h>
#include "dix/screen_hooks_priv.h"
#include "Xext/xvdix_priv.h"
#include "misc.h"
@ -48,7 +49,6 @@ static RESTYPE XvMCRTSubpicture;
typedef struct {
int num_adaptors;
XvMCAdaptorPtr adaptors;
CloseScreenProcPtr CloseScreen;
char clientDriverName[DR_CLIENT_DRIVER_NAME_SIZE];
char busID[DR_BUSID_SIZE];
int major;
@ -733,16 +733,12 @@ XvMCExtensionInit(void)
extEntry->errorBase + XvMCBadSubpicture);
}
static Bool
XvMCCloseScreen(ScreenPtr pScreen)
static void XvMCScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
XvMCScreenPtr pScreenPriv = XVMC_GET_PRIVATE(pScreen);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
free(pScreenPriv);
return (*pScreen->CloseScreen) (pScreen);
dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, NULL);
dixScreenUnhookClose(pScreen, XvMCScreenClose);
}
int
@ -758,8 +754,7 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, pScreenPriv);
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = XvMCCloseScreen;
dixScreenHookClose(pScreen, XvMCScreenClose);
pScreenPriv->num_adaptors = num;
pScreenPriv->adaptors = pAdapt;

View File

@ -44,6 +44,7 @@
#include <dix-config.h>
#include "dix/dix_priv.h"
#include "dix/screen_hooks_priv.h"
#include "os/osdep.h"
#include "compint.h"
@ -55,16 +56,13 @@ DevPrivateKeyRec CompScreenPrivateKeyRec;
DevPrivateKeyRec CompWindowPrivateKeyRec;
DevPrivateKeyRec CompSubwindowsPrivateKeyRec;
static Bool
compCloseScreen(ScreenPtr pScreen)
static void compCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
CompScreenPtr cs = GetCompScreen(pScreen);
Bool ret;
free(cs->alternateVisuals);
free(cs->implicitRedirectExceptions);
pScreen->CloseScreen = cs->CloseScreen;
pScreen->InstallColormap = cs->InstallColormap;
pScreen->ChangeWindowAttributes = cs->ChangeWindowAttributes;
pScreen->ReparentWindow = cs->ReparentWindow;
@ -76,17 +74,16 @@ compCloseScreen(ScreenPtr pScreen)
pScreen->ClipNotify = cs->ClipNotify;
pScreen->UnrealizeWindow = cs->UnrealizeWindow;
pScreen->RealizeWindow = cs->RealizeWindow;
pScreen->DestroyWindow = cs->DestroyWindow;
pScreen->CreateWindow = cs->CreateWindow;
pScreen->CopyWindow = cs->CopyWindow;
pScreen->PositionWindow = cs->PositionWindow;
pScreen->SourceValidate = cs->SourceValidate;
dixScreenUnhookClose(pScreen, compCloseScreen);
dixScreenUnhookWindowDestroy(pScreen, compWindowDestroy);
dixScreenUnhookWindowPosition(pScreen, compWindowPosition);
free(cs);
dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL);
ret = (*pScreen->CloseScreen) (pScreen);
return ret;
}
static void
@ -368,8 +365,9 @@ compScreenInit(ScreenPtr pScreen)
if (!disableBackingStore)
pScreen->backingStoreSupport = WhenMapped;
cs->PositionWindow = pScreen->PositionWindow;
pScreen->PositionWindow = compPositionWindow;
dixScreenHookClose(pScreen, compCloseScreen);
dixScreenHookWindowDestroy(pScreen, compWindowDestroy);
dixScreenHookWindowPosition(pScreen, compWindowPosition);
cs->CopyWindow = pScreen->CopyWindow;
pScreen->CopyWindow = compCopyWindow;
@ -377,9 +375,6 @@ compScreenInit(ScreenPtr pScreen)
cs->CreateWindow = pScreen->CreateWindow;
pScreen->CreateWindow = compCreateWindow;
cs->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = compDestroyWindow;
cs->RealizeWindow = pScreen->RealizeWindow;
pScreen->RealizeWindow = compRealizeWindow;
@ -410,9 +405,6 @@ compScreenInit(ScreenPtr pScreen)
cs->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
pScreen->ChangeWindowAttributes = compChangeWindowAttributes;
cs->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = compCloseScreen;
cs->SourceValidate = pScreen->SourceValidate;
pScreen->SourceValidate = compSourceValidate;

View File

@ -48,6 +48,8 @@
#ifndef _COMPINT_H_
#define _COMPINT_H_
#include "dix/screen_hooks_priv.h"
#include "misc.h"
#include "scrnintstr.h"
#include "os.h"
@ -125,10 +127,8 @@ typedef struct _CompImplicitRedirectException {
} CompImplicitRedirectException;
typedef struct _CompScreen {
PositionWindowProcPtr PositionWindow;
CopyWindowProcPtr CopyWindow;
CreateWindowProcPtr CreateWindow;
DestroyWindowProcPtr DestroyWindow;
RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow;
ClipNotifyProcPtr ClipNotify;
@ -158,7 +158,6 @@ typedef struct _CompScreen {
Bool pendingScreenUpdate;
CloseScreenProcPtr CloseScreen;
int numAlternateVisuals;
VisualID *alternateVisuals;
int numImplicitRedirectExceptions;
@ -280,8 +279,9 @@ void
Bool
compCheckRedirect(WindowPtr pWin);
Bool
compPositionWindow(WindowPtr pWin, int x, int y);
void compWindowPosition(CallbackListPtr *pcbl,
ScreenPtr pScreen,
XorgScreenWindowPositionParamRec *param);
Bool
compRealizeWindow(WindowPtr pWin);
@ -309,8 +309,7 @@ void
Bool
compCreateWindow(WindowPtr pWin);
Bool
compDestroyWindow(WindowPtr pWin);
void compWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin);
void
compSetRedirectBorderClip(WindowPtr pWin, RegionPtr pRegion);

View File

@ -224,14 +224,9 @@ updateOverlayWindow(ScreenPtr pScreen)
return Success;
}
Bool
compPositionWindow(WindowPtr pWin, int x, int y)
void compWindowPosition(CallbackListPtr *pcbl, ScreenPtr pScreen, XorgScreenWindowPositionParamRec *param)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
CompScreenPtr cs = GetCompScreen(pScreen);
Bool ret = TRUE;
pScreen->PositionWindow = cs->PositionWindow;
WindowPtr pWin = param->window;
/*
* "Shouldn't need this as all possible places should be wrapped
*
@ -255,14 +250,8 @@ compPositionWindow(WindowPtr pWin, int x, int y)
}
}
if (!(*pScreen->PositionWindow) (pWin, x, y))
ret = FALSE;
cs->PositionWindow = pScreen->PositionWindow;
pScreen->PositionWindow = compPositionWindow;
compCheckTree(pWin->drawable.pScreen);
if (updateOverlayWindow(pScreen) != Success)
ret = FALSE;
return ret;
updateOverlayWindow(pScreen);
}
Bool
@ -596,16 +585,12 @@ compCreateWindow(WindowPtr pWin)
return ret;
}
Bool
compDestroyWindow(WindowPtr pWin)
void compWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
CompScreenPtr cs = GetCompScreen(pScreen);
CompWindowPtr cw;
CompSubwindowsPtr csw;
Bool ret;
pScreen->DestroyWindow = cs->DestroyWindow;
while ((cw = GetCompWindow(pWin)))
FreeResource(cw->clients->id, X11_RESTYPE_NONE);
while ((csw = GetCompSubwindows(pWin)))
@ -617,16 +602,12 @@ compDestroyWindow(WindowPtr pWin)
compSetParentPixmap(pWin);
dixDestroyPixmap(pPixmap, 0);
}
ret = (*pScreen->DestroyWindow) (pWin);
cs->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = compDestroyWindow;
/* Did we just destroy the overlay window? */
if (pWin == cs->pOverlayWin)
cs->pOverlayWin = NULL;
/* compCheckTree (pWin->drawable.pScreen); can't check -- tree isn't good*/
return ret;
}
void

100
dbe/dbe.c
View File

@ -40,6 +40,7 @@
#include <X11/Xproto.h>
#include "dix/dix_priv.h"
#include "dix/screen_hooks_priv.h"
#include "scrnintstr.h"
#include "extnsionst.h"
@ -81,12 +82,6 @@ DbeStubScreen(DbeScreenPrivPtr pDbeScreenPriv, int *nStubbedScreens)
/* Stub DIX. */
pDbeScreenPriv->SetupBackgroundPainter = NULL;
/* Do not unwrap PositionWindow nor DestroyWindow. If the DDX
* initialization function failed, we assume that it did not wrap
* PositionWindow. Also, DestroyWindow is only wrapped if the DDX
* initialization function succeeded.
*/
/* Stub DDX. */
pDbeScreenPriv->GetVisualInfo = NULL;
pDbeScreenPriv->AllocBackBufferName = NULL;
@ -1201,7 +1196,9 @@ DbeWindowPrivDelete(void *pDbeWinPriv, XID id)
return Success;
} /* DbeWindowPrivDelete() */
static void miDbeWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin);
/******************************************************************************
*
* DBE DIX Procedure: DbeResetProc
@ -1225,94 +1222,39 @@ DbeResetProc(ExtensionEntry * extEntry)
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
if (pDbeScreenPriv) {
/* Unwrap DestroyWindow, which was wrapped in DbeExtensionInit(). */
pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow;
pScreen->PositionWindow = pDbeScreenPriv->PositionWindow;
dixScreenUnhookWindowDestroy(pScreen, miDbeWindowDestroy);
dixScreenUnhookWindowPosition(pScreen, miDbeWindowPosition);
free(pDbeScreenPriv);
}
}
} /* DbeResetProc() */
/******************************************************************************
*
* DBE DIX Procedure: DbeDestroyWindow
*
* Description:
*
* This is the wrapper for pScreen->DestroyWindow.
* This function frees buffer resources for a window before it is
* destroyed.
*
*****************************************************************************/
}
static Bool
DbeDestroyWindow(WindowPtr pWin)
/**
* @brief window destroy callback
*
* Called by DIX when window is being destroyed.
*
*/
static void miDbeWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
{
DbeScreenPrivPtr pDbeScreenPriv;
DbeWindowPrivPtr pDbeWindowPriv;
ScreenPtr pScreen;
Bool ret;
/*
**************************************************************************
** 1. Unwrap the member routine.
**************************************************************************
*/
pScreen = pWin->drawable.pScreen;
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow;
/*
**************************************************************************
** 2. Do any work necessary before the member routine is called.
**
** Call the window priv delete function for all buffer IDs associated
** with this window.
**************************************************************************
*/
if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) {
while (pDbeWindowPriv) {
DbeWindowPrivPtr pDbeWindowPriv;
while ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) {
/* *DbeWinPrivDelete() will free the window private and set it to
* NULL if there are no more buffer IDs associated with this
* window.
*/
FreeResource(pDbeWindowPriv->IDs[0], X11_RESTYPE_NONE);
pDbeWindowPriv = DBE_WINDOW_PRIV(pWin);
}
}
}
/*
**************************************************************************
** 3. Call the member routine, saving its result if necessary.
**************************************************************************
*/
ret = (*pScreen->DestroyWindow) (pWin);
/*
**************************************************************************
** 4. Rewrap the member routine, restoring the wrapper value first in case
** the wrapper (or something that it wrapped) change this value.
**************************************************************************
*/
pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = DbeDestroyWindow;
/*
**************************************************************************
** 5. Do any work necessary after the member routine has been called.
**
** In this case we do not need to do anything.
**************************************************************************
*/
return ret;
} /* DbeDestroyWindow() */
/******************************************************************************
*
* DBE DIX Procedure: DbeExtensionInit
@ -1395,12 +1337,10 @@ DbeExtensionInit(void)
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
if (ddxInitSuccess) {
/* Wrap DestroyWindow. The DDX initialization function
* already wrapped PositionWindow for us.
/* Hook in our window destructor. The DDX initialization function
* already added WindowPosition hook for us.
*/
pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = DbeDestroyWindow;
dixScreenHookWindowDestroy(pScreen, miDbeWindowDestroy);
}
else {
/* DDX initialization failed. Stub the screen. */

View File

@ -169,13 +169,6 @@ typedef struct _DbeWindowPrivRec {
*/
typedef struct _DbeScreenPrivRec {
/* Wrapped functions
* It is the responsibility of the DDX layer to wrap PositionWindow().
* DbeExtensionInit wraps DestroyWindow().
*/
PositionWindowProcPtr PositionWindow;
DestroyWindowProcPtr DestroyWindow;
/* Per-screen DIX routines */
Bool (*SetupBackgroundPainter) (WindowPtr /*pWin */ ,
GCPtr /*pGC */

View File

@ -375,14 +375,13 @@ miDbeSwapBuffers(ClientPtr client, int *pNumWindows, DbeSwapInfoPtr swapInfo)
* the resources associated with a DBE buffer ID. There are 5 ways that
* miDbeWinPrivDelete() can be called by FreeResource(). They are:
*
* - A DBE window is destroyed, in which case the DbeDestroyWindow()
* wrapper is invoked. The wrapper calls FreeResource() for all DBE
* buffer IDs.
* - A DBE window is destroyed, in which case the DbeWindowDestroy()
* callback is invoked. It calls FreeResource() for all DBE buffer IDs.
*
* - miDbeAllocBackBufferName() calls FreeResource() to clean up resources
* after a buffer allocation failure.
*
* - The PositionWindow wrapper, miDbePositionWindow(), calls
* - The WindowPosition hook, miDbeWindowPosition(), calls
* FreeResource() when it fails to create buffers of the new size.
* FreeResource() is called for all DBE buffer IDs.
*
@ -432,22 +431,20 @@ miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId)
if (pDbeWindowPriv->pBackBuffer)
dixDestroyPixmap(pDbeWindowPriv->pBackBuffer, 0);
} /* miDbeWinPrivDelete() */
/******************************************************************************
*
* DBE MI Procedure: miDbePositionWindow
* DBE MI Procedure: miDbeWindowPosition
*
* Description:
*
* This function was cloned from miMbxPositionWindow() in mimultibuf.c.
* This function was cloned from miMbxWindowPosition() in mimultibuf.c.
* This function resizes the buffer when the window is resized.
*
*****************************************************************************/
static Bool
miDbePositionWindow(WindowPtr pWin, int x, int y)
void miDbeWindowPosition(CallbackListPtr *pcbl, ScreenPtr pScreen, XorgScreenWindowPositionParamRec *param)
{
ScreenPtr pScreen;
DbeScreenPrivPtr pDbeScreenPriv;
DbeWindowPrivPtr pDbeWindowPriv;
int width, height;
@ -460,43 +457,9 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
Bool clear;
GCPtr pGC;
xRectangle clearRect;
Bool ret;
/*
**************************************************************************
** 1. Unwrap the member routine.
**************************************************************************
*/
pScreen = pWin->drawable.pScreen;
WindowPtr pWin = param->window;
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
pScreen->PositionWindow = pDbeScreenPriv->PositionWindow;
/*
**************************************************************************
** 2. Do any work necessary before the member routine is called.
**
** In this case we do not need to do anything.
**************************************************************************
*/
/*
**************************************************************************
** 3. Call the member routine, saving its result if necessary.
**************************************************************************
*/
ret = (*pScreen->PositionWindow) (pWin, x, y);
/*
**************************************************************************
** 4. Rewrap the member routine, restoring the wrapper value first in case
** the wrapper (or something that it wrapped) change this value.
**************************************************************************
*/
pDbeScreenPriv->PositionWindow = pScreen->PositionWindow;
pScreen->PositionWindow = miDbePositionWindow;
/*
**************************************************************************
@ -504,14 +467,12 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
**************************************************************************
*/
if (!(pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) {
return ret;
}
if (!(pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)))
return;
if (pDbeWindowPriv->width == pWin->drawable.width &&
pDbeWindowPriv->height == pWin->drawable.height) {
return ret;
}
pDbeWindowPriv->height == pWin->drawable.height)
return;
width = pWin->drawable.width;
height = pWin->drawable.height;
@ -595,7 +556,7 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
}
FreeScratchGC(pGC);
return FALSE;
return;
}
else {
@ -645,11 +606,8 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
FreeScratchGC(pGC);
}
}
return ret;
} /* miDbePositionWindow() */
/******************************************************************************
*
* DBE MI Procedure: miDbeInit
@ -663,9 +621,7 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
Bool
miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv)
{
/* Wrap functions. */
pDbeScreenPriv->PositionWindow = pScreen->PositionWindow;
pScreen->PositionWindow = miDbePositionWindow;
dixScreenHookWindowPosition(pScreen, miDbeWindowPosition);
/* Initialize the per-screen DBE function pointers. */
pDbeScreenPriv->GetVisualInfo = miDbeGetVisualInfo;

View File

@ -36,7 +36,8 @@
#ifndef MIDBE_H
#define MIDBE_H
#include "privates.h"
#include "dix/screen_hooks_priv.h"
#include "include/privates.h"
/* EXTERNS */
@ -53,4 +54,6 @@ extern DevPrivateKeyRec dbeWindowPrivKeyRec;
extern RESTYPE dbeDrawableResType;
extern RESTYPE dbeWindowPrivResType;
void miDbeWindowPosition(CallbackListPtr *pcbl, ScreenPtr pScreen, XorgScreenWindowPositionParamRec *param);
#endif /* MIDBE_H */

View File

@ -10,4 +10,15 @@
void InitCallbackManager(void);
void DeleteCallbackManager(void);
/*
* @brief delete a callback list
*
* Calling this is necessary if a CallbackListPtr is used inside a dynamically
* allocated structure, before it is freed. If it's not done, memory corruption
* or segfault can happen at a much later point (eg. next server incarnation)
*
* @param pcbl pointer to the list head (CallbackListPtr)
*/
void DeleteCallbackList(CallbackListPtr *pcbl);
#endif /* _XSERVER_CALLBACK_PRIV_H */

View File

@ -1462,6 +1462,8 @@ int
dixDestroyPixmap(void *value, XID pid)
{
PixmapPtr pPixmap = (PixmapPtr) value;
if (pPixmap && pPixmap->refcnt == 1)
dixScreenRaisePixmapDestroy(pPixmap);
if (pPixmap && pPixmap->drawable.pScreen && pPixmap->drawable.pScreen->DestroyPixmap)
return pPixmap->drawable.pScreen->DestroyPixmap(pPixmap);
return TRUE;

View File

@ -255,4 +255,71 @@ extern Bool enableBackingStore;
/* in generated BuiltInAtoms.c */
void MakePredeclaredAtoms(void);
void dixFreeScreen(ScreenPtr pScreen);
/*
* @brief call screen's window destructors
* @see dixScreenHookWindowDestroy
* @param pWin the window thats being destroyed
* @result the ScreenRec's DestroyWindow() return value
*
* Call the pluggable window destructors that extensions might have registered on
* the screen, and finally call ScreenRec's DestroyWindow proc.
*
* Should only be called by DIX itself.
*/
int dixScreenRaiseWindowDestroy(WindowPtr pWin);
/*
* @brief call screen's window position notification hooks
* @see dixScreenHookWindowPosition
* @param pWin the window to notify on
*
* Call the pluggable window position hooks that extensions might have registered on
* the screen, and finally call ScreenRec's PositionWindow proc.
*
* Should only be called by DIX itself.
*/
void dixScreenRaiseWindowPosition(WindowPtr pWin, uint32_t x, uint32_t y);
/*
* @brief call screen's close hooks
* @see dixScreenHookClose
* @param pScreen the screen being closed
*
* Call the pluggable screen close hooks that extensions might have registered on
* the screen, and finally call ScreenRec's CloseScreen proc.
*
* Should only be called by DIX itself.
*/
void dixScreenRaiseClose(ScreenPtr pScreen);
/*
* @brief call screen's PixmapDestroy hook
* @see dixScreenHookPixmapDestroy
* @param pPixmap the pixmap being destroyed
*
* Call the pluggable pixmap destroy pixmap hooks that extensions might have
* registered on the screen.
* Note that it's *only* called, when the pixmap is really being destroyed
* (instead of just unref'ed)
*
* Should only be called by DIX itself, by dixDestroyPixmap()
* It must be called *before* the ScreenRec->DestroyPixmap() is called, any
* only if the reference counter reaches 1.
*/
void dixScreenRaisePixmapDestroy(PixmapPtr pPixmap);
/*
* @brief call screen's CreateScreenResources chain
* @see dixScreenHookPostCreateResources
* @param pScreen the screen to run on
*
* Call the screen's CreateScreenResources() proc, and if it returns TRUE,
* run the installed hooks afterwards.
*
* Should only be called by DIX itself.
*/
Bool dixScreenRaiseCreateResources(ScreenPtr pScreen);
#endif /* _XSERVER_DIX_PRIV_H */

View File

@ -695,8 +695,6 @@ _DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, void *data)
return FALSE;
}
static void DeleteCallbackList(CallbackListPtr *pcbl);
void
_CallCallbacks(CallbackListPtr *pcbl, void *call_data)
{
@ -747,25 +745,26 @@ _CallCallbacks(CallbackListPtr *pcbl, void *call_data)
}
}
static void
_DeleteCallbackList(CallbackListPtr *pcbl)
void DeleteCallbackList(CallbackListPtr *pcbl)
{
if (!pcbl || !*pcbl)
return;
CallbackListPtr cbl = *pcbl;
CallbackPtr cbr, nextcbr;
int i;
if (cbl->inCallback) {
cbl->deleted = TRUE;
return;
}
for (i = 0; i < numCallbackListsToCleanup; i++) {
for (int i = 0; i < numCallbackListsToCleanup; i++) {
if (listsToCleanup[i] == pcbl) {
listsToCleanup[i] = NULL;
break;
}
}
CallbackPtr cbr, nextcbr;
for (cbr = cbl->list; cbr != NULL; cbr = nextcbr) {
nextcbr = cbr->next;
free(cbr);
@ -829,13 +828,6 @@ DeleteCallback(CallbackListPtr *pcbl, CallbackProcPtr callback, void *data)
return _DeleteCallback(pcbl, callback, data);
}
static void DeleteCallbackList(CallbackListPtr *pcbl)
{
if (!pcbl || !*pcbl)
return;
_DeleteCallbackList(pcbl);
}
void
DeleteCallbackManager(void)
{

View File

@ -768,6 +768,8 @@ int
FreeGC(void *value, XID gid)
{
GCPtr pGC = (GCPtr) value;
if (!pGC)
return BadMatch;
CloseFont(pGC->font, (Font) 0);
if (pGC->funcs)
@ -819,13 +821,14 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth)
}
void
FreeGCperDepth(int screenNum)
FreeGCperDepth(ScreenPtr pScreen)
{
int i;
ScreenPtr pScreen;
GCPtr *ppGC;
pScreen = screenInfo.screens[screenNum];
if (!pScreen)
return;
ppGC = pScreen->GCperDepth;
for (i = 0; i <= pScreen->numDepths; i++) {
@ -900,13 +903,6 @@ CreateDefaultStipple(int screenNum)
return TRUE;
}
void
FreeDefaultStipple(int screenNum)
{
ScreenPtr pScreen = screenInfo.screens[screenNum];
dixDestroyPixmap(pScreen->defaultStipple, 0);
}
int
SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash)
{

View File

@ -22,14 +22,12 @@ int CopyGC(GCPtr pgcSrc, GCPtr pgcDst, BITS32 mask);
int FreeGC(void *pGC, XID gid);
void FreeGCperDepth(int screenNum);
void FreeGCperDepth(ScreenPtr pScreen);
Bool CreateGCperDepth(int screenNum);
Bool CreateDefaultStipple(int screenNum);
void FreeDefaultStipple(int screenNum);
int SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash);
int VerifyRectOrder(int nrects, xRectangle *prects, int ordering);

View File

@ -207,8 +207,7 @@ dix_main(int argc, char *argv[], char *envp[])
ScreenPtr pScreen = screenInfo.gpuscreens[i];
if (!PixmapScreenInit(pScreen))
FatalError("failed to create screen pixmap properties");
if (pScreen->CreateScreenResources &&
!(*pScreen->CreateScreenResources) (pScreen))
if (!dixScreenRaiseCreateResources(pScreen))
FatalError("failed to create screen resources");
}
@ -217,8 +216,7 @@ dix_main(int argc, char *argv[], char *envp[])
if (!PixmapScreenInit(pScreen))
FatalError("failed to create screen pixmap properties");
if (pScreen->CreateScreenResources &&
!(*pScreen->CreateScreenResources) (pScreen))
if (!dixScreenRaiseCreateResources(pScreen))
FatalError("failed to create screen resources");
if (!CreateGCperDepth(i))
FatalError("failed to create scratch GCs");
@ -318,23 +316,16 @@ dix_main(int argc, char *argv[], char *envp[])
CloseDownEvents();
for (i = screenInfo.numGPUScreens - 1; i >= 0; i--) {
ScreenPtr pScreen = screenInfo.gpuscreens[i];
dixFreeScreenSpecificPrivates(pScreen);
(*pScreen->CloseScreen) (pScreen);
dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
free(pScreen);
dixFreeScreen(screenInfo.gpuscreens[i]);
screenInfo.numGPUScreens = i;
}
memset(&screenInfo.numGPUScreens, 0, sizeof(screenInfo.numGPUScreens));
for (i = screenInfo.numScreens - 1; i >= 0; i--) {
FreeGCperDepth(i);
FreeDefaultStipple(i);
dixFreeScreenSpecificPrivates(screenInfo.screens[i]);
(*screenInfo.screens[i]->CloseScreen) (screenInfo.screens[i]);
dixFreePrivates(screenInfo.screens[i]->devPrivates, PRIVATE_SCREEN);
free(screenInfo.screens[i]);
dixFreeScreen(screenInfo.screens[i]);
screenInfo.numScreens = i;
}
memset(&screenInfo.screens, 0, sizeof(screenInfo.numGPUScreens));
ReleaseClientIds(serverClient);
dixFreePrivates(serverClient->devPrivates, PRIVATE_CLIENT);

View File

@ -27,7 +27,9 @@ srcs_dix = [
'region.c',
'registry.c',
'resource.c',
'screen_hooks.c',
'selection.c',
'screen.c',
'swaprep.c',
'swapreq.c',
'tables.c',

28
dix/screen.c Normal file
View File

@ -0,0 +1,28 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*/
#include <dix-config.h>
#include "dix/callback_priv.h"
#include "dix/dix_priv.h"
#include "dix/gc_priv.h"
#include "include/screenint.h"
#include "include/scrnintstr.h"
void dixFreeScreen(ScreenPtr pScreen)
{
if (!pScreen)
return;
FreeGCperDepth(pScreen);
dixDestroyPixmap(pScreen->defaultStipple, 0);
dixFreeScreenSpecificPrivates(pScreen);
dixScreenRaiseClose(pScreen);
dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
DeleteCallbackList(&pScreen->hookWindowDestroy);
DeleteCallbackList(&pScreen->hookWindowPosition);
DeleteCallbackList(&pScreen->hookClose);
DeleteCallbackList(&pScreen->hookPixmapDestroy);
free(pScreen);
}

99
dix/screen_hooks.c Normal file
View File

@ -0,0 +1,99 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*/
#include <dix-config.h>
#include <X11/Xdefs.h>
#include "dix/dix_priv.h"
#include "dix/screen_hooks_priv.h"
#include "include/dix.h"
#include "include/os.h"
#include "include/scrnintstr.h"
#include "include/windowstr.h"
#define DECLARE_HOOK_PROC(NAME, FIELD, TYPE) \
void dixScreenHook##NAME(ScreenPtr pScreen, TYPE func) \
{ \
AddCallback(&pScreen->FIELD, (CallbackProcPtr)func, pScreen); \
} \
\
void dixScreenUnhook##NAME(ScreenPtr pScreen, TYPE func) \
{ \
DeleteCallback(&pScreen->FIELD, (CallbackProcPtr)func, pScreen); \
}
DECLARE_HOOK_PROC(WindowDestroy, hookWindowDestroy, XorgScreenWindowDestroyProcPtr);
DECLARE_HOOK_PROC(WindowPosition, hookWindowPosition, XorgScreenWindowPositionProcPtr);
DECLARE_HOOK_PROC(Close, hookClose, XorgScreenCloseProcPtr);
DECLARE_HOOK_PROC(PixmapDestroy, hookPixmapDestroy, XorgScreenPixmapDestroyProcPtr);
DECLARE_HOOK_PROC(PostCreateResources, hookPostCreateResources,
XorgScreenPostCreateResourcesProcPtr);
int dixScreenRaiseWindowDestroy(WindowPtr pWin)
{
if (!pWin)
return Success;
ScreenPtr pScreen = pWin->drawable.pScreen;
CallCallbacks(&pScreen->hookWindowDestroy, pWin);
return (pScreen->DestroyWindow ? pScreen->DestroyWindow(pWin) : Success);
}
void dixScreenRaiseWindowPosition(WindowPtr pWin, uint32_t x, uint32_t y)
{
if (!pWin)
return;
ScreenPtr pScreen = pWin->drawable.pScreen;
XorgScreenWindowPositionParamRec param = {
.window = pWin,
.x = x,
.y = y,
};
CallCallbacks(&pScreen->hookWindowPosition, &param);
if (pScreen->PositionWindow)
pScreen->PositionWindow(pWin, x, y);
}
void dixScreenRaiseClose(ScreenPtr pScreen) {
if (!pScreen)
return;
CallCallbacks(&pScreen->hookClose, NULL);
if (pScreen->CloseScreen)
pScreen->CloseScreen(pScreen);
}
void dixScreenRaisePixmapDestroy(PixmapPtr pPixmap)
{
if (!pPixmap)
return;
ScreenPtr pScreen = pPixmap->drawable.pScreen;
CallCallbacks(&pScreen->hookPixmapDestroy, pPixmap);
/* we must not call the original ScreenRec->DestroyPixmap() here */
}
Bool dixScreenRaiseCreateResources(ScreenPtr pScreen)
{
if (!pScreen)
return FALSE;
if (pScreen->CreateScreenResources) {
if (!pScreen->CreateScreenResources(pScreen))
return FALSE;
}
Bool ret = TRUE;
CallCallbacks(&pScreen->hookPostCreateResources, &ret);
return ret;
}

221
dix/screen_hooks_priv.h Normal file
View File

@ -0,0 +1,221 @@
/* SPDX-License-Identifier: MIT OR X11
*
* Copyright © 2024 Enrico Weigelt, metux IT consult <info@metux.net>
*
* @brief exported API entry points for hooking into screen operations
*
* These hooks are replacing the old, complicated approach of wrapping
* ScreenRec's proc vectors. Unlike the wrapping, these hooks are designed
* to be safe against changes in setup/teardown order and are called
* independently of the ScreenProc call vectors. It is guaranteed that the
* objects to operate on already/still exist (eg. destructors are callled
* before the object is actually destroyed, while post-create hooks are
* called after the object is created)
*
* Main consumers are extensions that need to associate extra data or
* doing other things additional to the original operation. In some cases
* they might even be used in drivers (in order to split device specific
* from generic logic)
*/
#ifndef XORG_DIX_SCREEN_HOOKS_H
#define XORG_DIX_SCREEN_HOOKS_H
#include <X11/Xdefs.h>
#include <X11/Xfuncproto.h>
#include "include/callback.h" /* CallbackListPtr */
#include "include/pixmap.h" /* PixmapPtr */
#include "include/screenint.h" /* ScreenPtr */
#include "include/window.h" /* WindowPtr */
/* prototype of a window destructor */
typedef void (*XorgScreenWindowDestroyProcPtr)(CallbackListPtr *pcbl,
ScreenPtr pScreen,
WindowPtr pWindow);
/**
* @brief register a window on the given screen
*
* @param pScreen pointer to the screen to register the destructor into
* @param func pointer to the window destructor function
* @param arg opaque pointer passed to the destructor
*
* Window destructors are the replacement for fragile and complicated wrapping of
* pScreen->DestroyWindow(): extensions can safely register there custom destructors
* here, without ever caring about anybody else.
+
* The destructors are run right before pScreen->DestroyWindow() - when the window
* is already removed from hierarchy (thus cannot receive any events anymore) and
* most of it's data already destroyed - and supposed to do necessary per-extension
* cleanup duties. Their execution order is *unspecified*.
*
* Screen drivers (DDX'es, xf86 video drivers, ...) shall not use these, but still
* set the pScreen->DestroyWindow pointer - and these should be the *only* ones
* ever setting it.
*
* When registration fails, the server aborts.
*
**/
void dixScreenHookWindowDestroy(ScreenPtr pScreen,
XorgScreenWindowDestroyProcPtr func);
/**
* @brief unregister a window destructor on the given screen
*
* @param pScreen pointer to the screen to unregister the destructor from
* @param func pointer to the window destructor function
* @param arg opaque pointer passed to the destructor
*
* @see dixScreenHookWindowDestroy
*
* Unregister a window destructor hook registered via @ref dixScreenHookWindowDestroy
**/
void dixScreenUnhookWindowDestroy(ScreenPtr pScreen,
XorgScreenWindowDestroyProcPtr func);
typedef struct {
WindowPtr window;
int32_t x;
int32_t y;
} XorgScreenWindowPositionParamRec;
/* prototype of a window move notification handler */
typedef void (*XorgScreenWindowPositionProcPtr)(CallbackListPtr *pcbl,
ScreenPtr pScreen,
XorgScreenWindowPositionParamRec *param);
/**
* @brief register a position notify hook on the given screen
*
* @param pScreen pointer to the screen to register the notify hook into
* @param func pointer to the window hook function
* @param arg opaque pointer passed to the hook
*
* When registration fails, the server aborts.
*
**/
void dixScreenHookWindowPosition(ScreenPtr pScreen,
XorgScreenWindowPositionProcPtr func);
/**
* @brief unregister a window position notify hook on the given screen
*
* @param pScreen pointer to the screen to unregister the hook from
* @param func pointer to the hook function
* @param arg opaque pointer passed to the destructor
*
* @see dixScreenHookWindowPosition
*
* Unregister a window position notify hook registered via @ref dixScreenHookWindowPosition
**/
void dixScreenUnhookWindowPosition(ScreenPtr pScreen,
XorgScreenWindowPositionProcPtr func);
/* prototype of screen close notification handler */
typedef void (*XorgScreenCloseProcPtr)(CallbackListPtr *pcbl,
ScreenPtr pScreen,
void *unused);
/**
* @brief register a screen close notify hook on the given screen
*
* @param pScreen pointer to the screen to register the notify hook into
* @param func pointer to the hook function
*
* When registration fails, the server aborts.
*
* NOTE: only exported for libglamoregl, not supposed to be used by drivers.
**/
_X_EXPORT
void dixScreenHookClose(ScreenPtr pScreen,
XorgScreenCloseProcPtr func);
/**
* @brief unregister a screen close notify hook on the given screen
*
* @param pScreen pointer to the screen to unregister the hook from
* @param func pointer to the hook function
* @param arg opaque pointer passed to the destructor
*
* @see dixScreenHookClose
*
* Unregister a screen close notify hook registered via @ref dixScreenHookClose
*
* NOTE: only exported for libglamoregl, not supposed to be used by drivers.
**/
_X_EXPORT
void dixScreenUnhookClose(ScreenPtr pScreen,
XorgScreenCloseProcPtr func);
/* prototype of pixmap destroy notification handler */
typedef void (*XorgScreenPixmapDestroyProcPtr)(CallbackListPtr *pcbl,
ScreenPtr pScreen,
PixmapPtr pPixmap);
/**
* @brief register a pixmap destroy hook on the given screen
*
* @param pScreen pointer to the screen to register the notify hook into
* @param func pointer to the hook function
* @param arg opaque pointer passed to the hook
*
* When registration fails, the server aborts.
* This hook is called only when the pixmap is really to be destroyed,
* (unlike ScreenRec->DestroyPixmap())
*
* NOTE: only exported for libglamoregl, not supposed to be used by drivers.
**/
_X_EXPORT
void dixScreenHookPixmapDestroy(ScreenPtr pScreen,
XorgScreenPixmapDestroyProcPtr func);
/**
* @brief unregister a pixmap destroy notify hook on the given screen
*
* @param pScreen pointer to the screen to unregister the hook from
* @param func pointer to the hook function
* @param arg opaque pointer passed to the destructor
*
* @see dixScreenHookClose
*
* Unregister a screen close notify hook registered via @ref dixScreenHookPixmapDestroy
*
* NOTE: only exported for libglamoregl, not supposed to be used by drivers.
**/
_X_EXPORT
void dixScreenUnhookPixmapDestroy(ScreenPtr pScreen,
XorgScreenPixmapDestroyProcPtr func);
/* prototype of screen close notification handler */
typedef void (*XorgScreenPostCreateResourcesProcPtr)(CallbackListPtr *pcbl,
ScreenPtr pScreen,
Bool *ret);
/**
* @brief register post-CreateScreenResources hook on the given screen
*
* @param pScreen pointer to the screen to register the notify hook into
* @param func pointer to the hook function
* @param arg opaque pointer passed to the hook
*
* This hook is called when CreateScreenResources() had been called
* and returned TRUE.
**/
_X_EXPORT
void dixScreenHookPostCreateResources(ScreenPtr pScreen,
XorgScreenPostCreateResourcesProcPtr func);
/**
* @brief unregister a post-CreateScreenResources hook on the given screen
*
* @param pScreen pointer to the screen to unregister the hook from
* @param func pointer to the hook function
* @param arg opaque pointer passed to the destructor
*
* @see dixScreenHookPostCreateResources
**/
_X_EXPORT
void dixScreenUnhookPostCreateResources(ScreenPtr pScreen,
XorgScreenPostCreateResourcesProcPtr func);
#endif /* DIX_SCREEN_HOOKS_H */

View File

@ -670,7 +670,8 @@ InitRootWindow(WindowPtr pWin)
if (!(*pScreen->CreateWindow) (pWin))
return; /* XXX */
(*pScreen->PositionWindow) (pWin, 0, 0);
dixScreenRaiseWindowPosition(pWin, 0, 0);
pWin->cursorIsNone = FALSE;
pWin->optional->cursor = RefCursor(rootCursor);
@ -928,7 +929,7 @@ CreateWindow(Window wid, WindowPtr pParent, int x, int y, unsigned w,
return NullWindow;
}
/* We SHOULD check for an error value here XXX */
(*pScreen->PositionWindow) (pWin, pWin->drawable.x, pWin->drawable.y);
dixScreenRaiseWindowPosition(pWin, pWin->drawable.x, pWin->drawable.y);
if (!(vmask & CWEventMask))
RecalculateDeliverableEvents(pWin);
@ -998,8 +999,6 @@ DisposeWindowOptional(WindowPtr pWin)
static void
FreeWindowResources(WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
DeleteWindowFromAnySaveSet(pWin);
DeleteWindowFromAnySelections(pWin);
DeleteWindowFromAnyEvents(pWin, TRUE);
@ -1019,8 +1018,9 @@ FreeWindowResources(WindowPtr pWin)
dixDestroyPixmap(pWin->background.pixmap, 0);
DeleteAllWindowProperties(pWin);
/* We SHOULD check for an error value here XXX */
(*pScreen->DestroyWindow) (pWin);
dixScreenRaiseWindowDestroy(pWin);
DisposeWindowOptional(pWin);
}
@ -1849,12 +1849,9 @@ GravityTranslate(int x, int y, int oldx, int oldy,
void
ResizeChildrenWinSize(WindowPtr pWin, int dx, int dy, int dw, int dh)
{
ScreenPtr pScreen;
WindowPtr pSib, pChild;
Bool resized = (dw || dh);
pScreen = pWin->drawable.pScreen;
for (pSib = pWin->firstChild; pSib; pSib = pSib->nextSib) {
if (resized && (pSib->winGravity > NorthWestGravity)) {
int cwsx, cwsy;
@ -1879,7 +1876,8 @@ ResizeChildrenWinSize(WindowPtr pWin, int dx, int dy, int dw, int dh)
pSib->drawable.y = pWin->drawable.y + pSib->origin.y;
SetWinSize(pSib);
SetBorderSize(pSib);
(*pScreen->PositionWindow) (pSib, pSib->drawable.x, pSib->drawable.y);
dixScreenRaiseWindowPosition(pSib, pSib->drawable.x, pSib->drawable.y);
if ((pChild = pSib->firstChild)) {
while (1) {
@ -1889,9 +1887,9 @@ ResizeChildrenWinSize(WindowPtr pWin, int dx, int dy, int dw, int dh)
pChild->origin.y;
SetWinSize(pChild);
SetBorderSize(pChild);
(*pScreen->PositionWindow) (pChild,
pChild->drawable.x,
pChild->drawable.y);
dixScreenRaiseWindowPosition(pChild,
pChild->drawable.x,
pChild->drawable.y);
if (pChild->firstChild) {
pChild = pChild->firstChild;
continue;
@ -2585,7 +2583,8 @@ ReparentWindow(WindowPtr pWin, WindowPtr pParent,
if (pScreen->ReparentWindow)
(*pScreen->ReparentWindow) (pWin, pPriorParent);
(*pScreen->PositionWindow) (pWin, pWin->drawable.x, pWin->drawable.y);
dixScreenRaiseWindowPosition(pWin, pWin->drawable.x, pWin->drawable.y);
ResizeChildrenWinSize(pWin, 0, 0, 0, 0);
CheckWindowOptionalNeed(pWin);

View File

@ -19,6 +19,9 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <dix-config.h>
#include "dix/screen_hooks_priv.h"
#include "dri3_priv.h"
#include "extinit_priv.h"
@ -29,15 +32,11 @@ DevPrivateKeyRec dri3_screen_private_key;
static int dri3_screen_generation;
static Bool
dri3_close_screen(ScreenPtr screen)
static void dri3_screen_close(CallbackListPtr *pcbl, ScreenPtr screen, void *unused)
{
dri3_screen_priv_ptr screen_priv = dri3_screen_priv(screen);
unwrap(screen_priv, screen, CloseScreen);
dixScreenUnhookClose(screen, dri3_screen_close);
free(screen_priv);
return (*screen->CloseScreen) (screen);
}
Bool
@ -53,7 +52,7 @@ dri3_screen_init(ScreenPtr screen, const dri3_screen_info_rec *info)
if (!screen_priv)
return FALSE;
wrap(screen_priv, screen, CloseScreen, dri3_close_screen);
dixScreenHookClose(screen, dri3_screen_close);
screen_priv->info = info;

View File

@ -42,9 +42,7 @@ typedef struct dri3_dmabuf_format {
} dri3_dmabuf_format_rec, *dri3_dmabuf_format_ptr;
typedef struct dri3_screen_priv {
CloseScreenProcPtr CloseScreen;
ConfigNotifyProcPtr ConfigNotify;
DestroyWindowProcPtr DestroyWindow;
Bool formats_cached;
CARD32 num_formats;

View File

@ -32,6 +32,8 @@
#include <stdlib.h>
#include "dix/screen_hooks_priv.h"
#include "exa_priv.h"
#include "exa.h"
@ -654,32 +656,18 @@ exaBitmapToRegion(PixmapPtr pPix)
return ret;
}
static Bool
exaCreateScreenResources(ScreenPtr pScreen)
static void exaCreateScreenResources(CallbackListPtr *pcbl, ScreenPtr pScreen, Bool *ret)
{
ExaScreenPriv(pScreen);
PixmapPtr pScreenPixmap;
Bool b;
swap(pExaScr, pScreen, CreateScreenResources);
b = pScreen->CreateScreenResources(pScreen);
swap(pExaScr, pScreen, CreateScreenResources);
if (!b)
return FALSE;
pScreenPixmap = pScreen->GetScreenPixmap(pScreen);
PixmapPtr pScreenPixmap = pScreen->GetScreenPixmap(pScreen);
if (pScreenPixmap) {
ExaPixmapPriv(pScreenPixmap);
exaSetAccelBlock(pExaScr, pExaPixmap,
pScreenPixmap->drawable.width,
pScreenPixmap->drawable.height,
pScreenPixmap->drawable.bitsPerPixel);
}
return TRUE;
}
static void
@ -734,12 +722,19 @@ ExaWakeupHandler(ScreenPtr pScreen, int result)
* exaCloseScreen() unwraps its wrapped screen functions and tears down EXA's
* screen private, before calling down to the next CloseSccreen.
*/
static Bool
exaCloseScreen(ScreenPtr pScreen)
static void exaCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
ExaScreenPriv(pScreen);
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
dixScreenUnhookClose(pScreen, exaCloseScreen);
dixScreenUnhookPostCreateResources(pScreen, exaCreateScreenResources);
/* doesn't matter which one actually was registered */
dixScreenUnhookPixmapDestroy(pScreen, exaPixmapDestroy_classic);
dixScreenUnhookPixmapDestroy(pScreen, exaPixmapDestroy_driver);
dixScreenUnhookPixmapDestroy(pScreen, exaPixmapDestroy_mixed);
if (ps->Glyphs == exaGlyphs)
exaGlyphsFini(pScreen);
@ -748,19 +743,15 @@ exaCloseScreen(ScreenPtr pScreen)
if (pScreen->WakeupHandler == ExaWakeupHandler)
unwrap(pExaScr, pScreen, WakeupHandler);
unwrap(pExaScr, pScreen, CreateGC);
unwrap(pExaScr, pScreen, CloseScreen);
unwrap(pExaScr, pScreen, GetImage);
unwrap(pExaScr, pScreen, GetSpans);
if (pExaScr->SavedCreatePixmap)
unwrap(pExaScr, pScreen, CreatePixmap);
if (pExaScr->SavedDestroyPixmap)
unwrap(pExaScr, pScreen, DestroyPixmap);
if (pExaScr->SavedModifyPixmapHeader)
unwrap(pExaScr, pScreen, ModifyPixmapHeader);
unwrap(pExaScr, pScreen, CopyWindow);
unwrap(pExaScr, pScreen, ChangeWindowAttributes);
unwrap(pExaScr, pScreen, BitmapToRegion);
unwrap(pExaScr, pScreen, CreateScreenResources);
if (pExaScr->SavedSharePixmapBacking)
unwrap(pExaScr, pScreen, SharePixmapBacking);
if (pExaScr->SavedSetSharedPixmapBacking)
@ -773,8 +764,6 @@ exaCloseScreen(ScreenPtr pScreen)
unwrap(pExaScr, ps, AddTraps);
free(pExaScr);
return (*pScreen->CloseScreen) (pScreen);
}
/**
@ -914,13 +903,13 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo)
!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS))
wrap(pExaScr, pScreen, WakeupHandler, ExaWakeupHandler);
wrap(pExaScr, pScreen, CreateGC, exaCreateGC);
wrap(pExaScr, pScreen, CloseScreen, exaCloseScreen);
dixScreenHookClose(pScreen, exaCloseScreen);
dixScreenHookPostCreateResources(pScreen, exaCreateScreenResources);
wrap(pExaScr, pScreen, GetImage, exaGetImage);
wrap(pExaScr, pScreen, GetSpans, ExaCheckGetSpans);
wrap(pExaScr, pScreen, CopyWindow, exaCopyWindow);
wrap(pExaScr, pScreen, ChangeWindowAttributes, exaChangeWindowAttributes);
wrap(pExaScr, pScreen, BitmapToRegion, exaBitmapToRegion);
wrap(pExaScr, pScreen, CreateScreenResources, exaCreateScreenResources);
if (ps) {
wrap(pExaScr, ps, Composite, exaComposite);
@ -955,8 +944,9 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo)
}
if (pExaScr->info->flags & EXA_HANDLES_PIXMAPS) {
if (pExaScr->info->flags & EXA_MIXED_PIXMAPS) {
dixScreenHookPixmapDestroy(pScreen, exaPixmapDestroy_mixed);
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_mixed);
wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_mixed);
wrap(pExaScr, pScreen, ModifyPixmapHeader,
exaModifyPixmapHeader_mixed);
wrap(pExaScr, pScreen, SharePixmapBacking, exaSharePixmapBacking_mixed);
@ -969,8 +959,9 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo)
pExaScr->prepare_access_reg = exaPrepareAccessReg_mixed;
}
else {
dixScreenHookPixmapDestroy(pScreen, exaPixmapDestroy_driver);
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_driver);
wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_driver);
wrap(pExaScr, pScreen, ModifyPixmapHeader,
exaModifyPixmapHeader_driver);
pExaScr->do_migration = NULL;
@ -981,8 +972,9 @@ exaDriverInit(ScreenPtr pScreen, ExaDriverPtr pScreenInfo)
}
}
else {
dixScreenHookPixmapDestroy(pScreen, exaPixmapDestroy_classic);
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap_classic);
wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap_classic);
wrap(pExaScr, pScreen, ModifyPixmapHeader,
exaModifyPixmapHeader_classic);
pExaScr->do_migration = exaDoMigration_classic;

View File

@ -206,42 +206,26 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height,
return ret;
}
Bool
exaDestroyPixmap_classic(PixmapPtr pPixmap)
void exaPixmapDestroy_classic(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ExaPixmapPriv(pPixmap);
if (!pExaPixmap) // we're called on an error path
return;
ExaScreenPriv(pScreen);
Bool ret = TRUE;
exaDestroyPixmap(pPixmap);
if (pPixmap->refcnt == 1) {
ExaPixmapPriv(pPixmap);
if (!pExaPixmap) // we're called on an error path
goto out;
exaDestroyPixmap(pPixmap);
if (pExaPixmap->area) {
DBG_PIXMAP(("-- 0x%p (0x%x) (%dx%d)\n",
(void *) pPixmap->drawable.id,
ExaGetPixmapPriv(pPixmap)->area->offset,
pPixmap->drawable.width, pPixmap->drawable.height));
/* Free the offscreen area */
exaOffscreenFree(pPixmap->drawable.pScreen, pExaPixmap->area);
pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
pPixmap->devKind = pExaPixmap->sys_pitch;
}
RegionUninit(&pExaPixmap->validSys);
RegionUninit(&pExaPixmap->validFB);
if (pExaPixmap->area) {
DBG_PIXMAP(("-- 0x%p (0x%x) (%dx%d)\n",
(void *) pPixmap->drawable.id,
ExaGetPixmapPriv(pPixmap)->area->offset,
pPixmap->drawable.width, pPixmap->drawable.height));
/* Free the offscreen area */
exaOffscreenFree(pPixmap->drawable.pScreen, pExaPixmap->area);
pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
pPixmap->devKind = pExaPixmap->sys_pitch;
}
out:
// restore original (screen driver's) DestroyPixmap() handler and call it
swap(pExaScr, pScreen, DestroyPixmap);
dixDestroyPixmap(pPixmap, 0);
swap(pExaScr, pScreen, DestroyPixmap);
return ret;
RegionUninit(&pExaPixmap->validSys);
RegionUninit(&pExaPixmap->validFB);
}
Bool

View File

@ -185,33 +185,19 @@ exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height,
return ret;
}
Bool
exaDestroyPixmap_driver(PixmapPtr pPixmap)
void exaPixmapDestroy_driver(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ExaScreenPriv(pScreen);
Bool ret = TRUE;
if (pPixmap->refcnt == 1) {
ExaPixmapPriv(pPixmap);
if (!pExaPixmap) // we're called on an error path
goto out;
ExaPixmapPriv(pPixmap);
if (!pExaPixmap) // we're called on an error path
return;
exaDestroyPixmap(pPixmap);
exaDestroyPixmap(pPixmap);
if (pExaPixmap->driverPriv)
pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
pExaPixmap->driverPriv = NULL;
}
out:
// restore original (screen driver's) DestroyPixmap() handler and call it
swap(pExaScr, pScreen, DestroyPixmap);
dixDestroyPixmap(pPixmap, 0);
swap(pExaScr, pScreen, DestroyPixmap);
return ret;
if (pExaPixmap->driverPriv)
pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
pExaPixmap->driverPriv = NULL;
}
Bool

View File

@ -239,42 +239,28 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
return ret;
}
Bool
exaDestroyPixmap_mixed(PixmapPtr pPixmap)
void exaPixmapDestroy_mixed(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ExaScreenPriv(pScreen);
Bool ret = TRUE;
if (pPixmap->refcnt == 1) {
ExaPixmapPriv(pPixmap);
if (!pExaPixmap)
goto out; // we're called on an error path
ExaPixmapPriv(pPixmap);
if (!pExaPixmap) // we're called on an error path
return;
exaDestroyPixmap(pPixmap);
exaDestroyPixmap(pPixmap);
if (pExaScr->deferred_mixed_pixmap == pPixmap)
pExaScr->deferred_mixed_pixmap = NULL;
if (pExaScr->deferred_mixed_pixmap == pPixmap)
pExaScr->deferred_mixed_pixmap = NULL;
if (pExaPixmap->driverPriv)
pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
pExaPixmap->driverPriv = NULL;
if (pExaPixmap->driverPriv)
pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
pExaPixmap->driverPriv = NULL;
if (pExaPixmap->pDamage) {
free(pExaPixmap->sys_ptr);
pExaPixmap->sys_ptr = NULL;
pExaPixmap->pDamage = NULL;
}
if (pExaPixmap->pDamage) {
free(pExaPixmap->sys_ptr);
pExaPixmap->sys_ptr = NULL;
pExaPixmap->pDamage = NULL;
}
out:
// restore original (screen driver's) DestroyPixmap() handler and call it
swap(pExaScr, pScreen, DestroyPixmap);
dixDestroyPixmap(pPixmap, 0);
swap(pExaScr, pScreen, DestroyPixmap);
return ret;
}
Bool

View File

@ -152,15 +152,12 @@ typedef struct {
ScreenBlockHandlerProcPtr SavedBlockHandler;
ScreenWakeupHandlerProcPtr SavedWakeupHandler;
CreateGCProcPtr SavedCreateGC;
CloseScreenProcPtr SavedCloseScreen;
GetImageProcPtr SavedGetImage;
GetSpansProcPtr SavedGetSpans;
CreatePixmapProcPtr SavedCreatePixmap;
DestroyPixmapProcPtr SavedDestroyPixmap;
CopyWindowProcPtr SavedCopyWindow;
ChangeWindowAttributesProcPtr SavedChangeWindowAttributes;
BitmapToRegionProcPtr SavedBitmapToRegion;
CreateScreenResourcesProcPtr SavedCreateScreenResources;
ModifyPixmapHeaderProcPtr SavedModifyPixmapHeader;
SharePixmapBackingProcPtr SavedSharePixmapBacking;
SetSharedPixmapBackingProcPtr SavedSetSharedPixmapBacking;
@ -590,8 +587,7 @@ exaModifyPixmapHeader_classic(PixmapPtr pPixmap, int width, int height,
int depth, int bitsPerPixel, int devKind,
void *pPixData);
Bool
exaDestroyPixmap_classic(PixmapPtr pPixmap);
void exaPixmapDestroy_classic(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap);
Bool
exaPixmapHasGpuCopy_classic(PixmapPtr pPixmap);
@ -608,8 +604,7 @@ exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height,
int depth, int bitsPerPixel, int devKind,
void *pPixData);
Bool
exaDestroyPixmap_driver(PixmapPtr pPixmap);
void exaPixmapDestroy_driver(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap);
Bool
exaPixmapHasGpuCopy_driver(PixmapPtr pPixmap);
@ -625,8 +620,7 @@ Bool
exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
int bitsPerPixel, int devKind, void *pPixData);
Bool
exaDestroyPixmap_mixed(PixmapPtr pPixmap);
void exaPixmapDestroy_mixed(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap);
Bool
exaPixmapHasGpuCopy_mixed(PixmapPtr pPixmap);

View File

@ -30,10 +30,13 @@
* This file covers the initialization and teardown of glamor, and has various
* functions not responsible for performing rendering.
*/
#include <dix-config.h>
#include <stdlib.h>
#include <unistd.h>
#include "dix/screen_hooks_priv.h"
#include "glamor_priv.h"
#include "mipict.h"
@ -604,6 +607,22 @@ glamor_setup_formats(ScreenPtr screen)
glamor_priv->cbcr_format.texture_only = FALSE;
}
static void glamor_pixmap_destroy(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
{
glamor_pixmap_destroy_fbo(pPixmap);
}
/* This function is used to free the glamor private screen's
* resources. If the DDX driver is not set GLAMOR_USE_SCREEN,
* then, DDX need to call this function at proper stage, if
* it is the xorg DDX driver,then it should be called at free
* screen stage not the close screen stage. The reason is after
* call to this function, the xorg DDX may need to destroy the
* screen pixmap which must be a glamor pixmap and requires
* the internal data structure still exist at that time.
* Otherwise, the glamor internal structure will not be freed.*/
static void glamor_close_screen(CallbackListPtr *pcbl, ScreenPtr screen, void *unused);
/** Set up glamor for an already-configured GL context. */
Bool
glamor_init(ScreenPtr screen, unsigned int flags)
@ -628,7 +647,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
LogMessage(X_WARNING,
"glamor%d: Failed to allocate screen private\n",
screen->myNum);
goto free_glamor_private;
goto fail;
}
glamor_set_screen_private(screen, glamor_priv);
@ -638,7 +657,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
LogMessage(X_WARNING,
"glamor%d: Failed to allocate pixmap private\n",
screen->myNum);
goto free_glamor_private;
goto fail;
}
if (!dixRegisterPrivateKey(&glamor_gc_private_key, PRIVATE_GC,
@ -646,15 +665,9 @@ glamor_init(ScreenPtr screen, unsigned int flags)
LogMessage(X_WARNING,
"glamor%d: Failed to allocate gc private\n",
screen->myNum);
goto free_glamor_private;
goto fail;
}
glamor_priv->saved_procs.close_screen = screen->CloseScreen;
screen->CloseScreen = glamor_close_screen;
glamor_priv->saved_procs.destroy_pixmap = screen->DestroyPixmap;
screen->DestroyPixmap = glamor_destroy_pixmap;
/* If we are using egl screen, call egl screen init to
* register correct close screen function. */
if (flags & GLAMOR_USE_EGL_SCREEN) {
@ -874,14 +887,12 @@ glamor_init(ScreenPtr screen, unsigned int flags)
glamor_priv->screen = screen;
dixScreenHookClose(screen, glamor_close_screen);
dixScreenHookPixmapDestroy(screen, glamor_pixmap_destroy);
return TRUE;
fail:
/* Restore default CloseScreen and DestroyPixmap handlers */
screen->CloseScreen = glamor_priv->saved_procs.close_screen;
screen->DestroyPixmap = glamor_priv->saved_procs.destroy_pixmap;
free_glamor_private:
fail:
free(glamor_priv);
glamor_set_screen_private(screen, NULL);
return FALSE;
@ -900,8 +911,7 @@ glamor_release_screen_priv(ScreenPtr screen)
glamor_set_screen_private(screen, NULL);
}
Bool
glamor_close_screen(ScreenPtr screen)
static void glamor_close_screen(CallbackListPtr *pcbl, ScreenPtr screen, void *unused)
{
glamor_screen_private *glamor_priv;
PixmapPtr screen_pixmap;
@ -911,11 +921,12 @@ glamor_close_screen(ScreenPtr screen)
glamor_sync_close(screen);
glamor_composite_glyphs_fini(screen);
glamor_set_glvnd_vendor(screen, NULL);
screen->CloseScreen = glamor_priv->saved_procs.close_screen;
dixScreenUnhookClose(screen, glamor_close_screen);
dixScreenUnhookPixmapDestroy(screen, glamor_pixmap_destroy);
screen->CreateGC = glamor_priv->saved_procs.create_gc;
screen->CreatePixmap = glamor_priv->saved_procs.create_pixmap;
screen->DestroyPixmap = glamor_priv->saved_procs.destroy_pixmap;
screen->GetSpans = glamor_priv->saved_procs.get_spans;
screen->ChangeWindowAttributes =
glamor_priv->saved_procs.change_window_attributes;
@ -933,8 +944,6 @@ glamor_close_screen(ScreenPtr screen)
glamor_pixmap_destroy_fbo(screen_pixmap);
glamor_release_screen_priv(screen);
return screen->CloseScreen(screen);
}
void

View File

@ -106,7 +106,6 @@ extern _X_EXPORT void glamor_fini(ScreenPtr screen);
* screen pixmap which must be a glamor pixmap and requires
* the internal data structure still exist at that time.
* Otherwise, the glamor internal structure will not be freed.*/
extern _X_EXPORT Bool glamor_close_screen(ScreenPtr screen);
extern _X_EXPORT uint32_t glamor_get_pixmap_texture(PixmapPtr pixmap);

View File

@ -42,6 +42,8 @@
#include <gbm.h>
#include <drm_fourcc.h>
#include "dix/screen_hooks_priv.h"
#include "glamor_egl.h"
#include "glamor.h"
@ -54,15 +56,11 @@ struct glamor_egl_screen_private {
EGLContext context;
char *device_path;
CreateScreenResourcesProcPtr CreateScreenResources;
CloseScreenProcPtr CloseScreen;
int fd;
struct gbm_device *gbm;
int dmabuf_capable;
Bool force_vendor; /* if GLVND vendor is forced from options */
CloseScreenProcPtr saved_close_screen;
DestroyPixmapProcPtr saved_destroy_pixmap;
xf86FreeScreenProc *saved_free_screen;
};
@ -756,31 +754,18 @@ glamor_egl_get_driver_name(ScreenPtr screen)
return NULL;
}
static Bool
glamor_egl_destroy_pixmap(PixmapPtr pixmap)
static void glamor_egl_pixmap_destroy(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pixmap)
{
ScreenPtr screen = pixmap->drawable.pScreen;
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
struct glamor_egl_screen_private *glamor_egl =
glamor_egl_get_screen_private(scrn);
Bool ret = TRUE;
if (pixmap->refcnt == 1) {
struct glamor_pixmap_private *pixmap_priv =
glamor_get_pixmap_private(pixmap);
struct glamor_pixmap_private *pixmap_priv =
glamor_get_pixmap_private(pixmap);
if (pixmap_priv->image)
eglDestroyImageKHR(glamor_egl->display, pixmap_priv->image);
}
screen->DestroyPixmap = glamor_egl->saved_destroy_pixmap;
if (screen->DestroyPixmap)
ret = screen->DestroyPixmap(pixmap);
glamor_egl->saved_destroy_pixmap = screen->DestroyPixmap;
screen->DestroyPixmap = glamor_egl_destroy_pixmap;
return ret;
if (pixmap_priv->image)
eglDestroyImageKHR(glamor_egl->display, pixmap_priv->image);
}
void
@ -806,8 +791,7 @@ glamor_egl_exchange_buffers(PixmapPtr front, PixmapPtr back)
glamor_set_pixmap_type(back, GLAMOR_TEXTURE_DRM);
}
static Bool
glamor_egl_close_screen(ScreenPtr screen)
static void glamor_egl_close_screen(CallbackListPtr *pcbl, ScreenPtr screen, void *unused)
{
ScrnInfoPtr scrn;
struct glamor_egl_screen_private *glamor_egl;
@ -822,9 +806,8 @@ glamor_egl_close_screen(ScreenPtr screen)
eglDestroyImageKHR(glamor_egl->display, pixmap_priv->image);
pixmap_priv->image = NULL;
screen->CloseScreen = glamor_egl->saved_close_screen;
return screen->CloseScreen(screen);
dixScreenUnhookClose(screen, glamor_egl_close_screen);
dixScreenUnhookPixmapDestroy(screen, glamor_egl_pixmap_destroy);
}
#ifdef DRI3
@ -904,11 +887,8 @@ glamor_egl_screen_init(ScreenPtr screen, struct glamor_context *glamor_ctx)
#endif
const char *gbm_backend_name;
glamor_egl->saved_close_screen = screen->CloseScreen;
screen->CloseScreen = glamor_egl_close_screen;
glamor_egl->saved_destroy_pixmap = screen->DestroyPixmap;
screen->DestroyPixmap = glamor_egl_destroy_pixmap;
dixScreenHookClose(screen, glamor_egl_close_screen);
dixScreenHookPixmapDestroy(screen, glamor_egl_pixmap_destroy);
glamor_ctx->ctx = glamor_egl->context;
glamor_ctx->display = glamor_egl->display;

View File

@ -206,10 +206,8 @@ struct glamor_format {
};
struct glamor_saved_procs {
CloseScreenProcPtr close_screen;
CreateGCProcPtr create_gc;
CreatePixmapProcPtr create_pixmap;
DestroyPixmapProcPtr destroy_pixmap;
GetSpansProcPtr get_spans;
GetImageProcPtr get_image;
CompositeProcPtr composite;

View File

@ -30,6 +30,8 @@
#include <dix-config.h>
#include "dix/screen_hooks_priv.h"
#include <GL/glxtokens.h>
#include <string.h>
#include <windowstr.h>
@ -157,16 +159,11 @@ static const char GLServerExtensions[] =
"GL_SGIX_shadow_ambient "
"GL_SUN_slice_accum ";
static Bool
glxCloseScreen(ScreenPtr pScreen)
static void glxCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
__GLXscreen *pGlxScreen = glxGetScreen(pScreen);
pScreen->CloseScreen = pGlxScreen->CloseScreen;
dixScreenUnhookClose(pScreen, glxCloseScreen);
pGlxScreen->destroy(pGlxScreen);
return pScreen->CloseScreen(pScreen);
}
__GLXscreen *
@ -327,8 +324,7 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen)
pGlxScreen->GLextensions = strdup(GLServerExtensions);
pGlxScreen->GLXextensions = NULL;
pGlxScreen->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = glxCloseScreen;
dixScreenHookClose(pScreen, glxCloseScreen);
i = 0;
for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next) {

View File

@ -149,8 +149,6 @@ struct __GLXscreen {
char *GLXextensions;
char *glvnd;
unsigned char glx_enable_bits[__GLX_EXT_BYTES];
Bool (*CloseScreen) (ScreenPtr pScreen);
};
void __glXScreenInit(__GLXscreen * screen, ScreenPtr pScreen);

View File

@ -27,6 +27,7 @@
#include "os/cmdline.h"
#include "os/ddx_priv.h"
#include "mi/mi_priv.h"
#include "os/osdep.h"
#include "kdrive.h"
@ -539,38 +540,28 @@ KdCreateScreenResources(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
KdCardInfo *card = pScreenPriv->card;
Bool ret;
pScreen->CreateScreenResources = pScreenPriv->CreateScreenResources;
if (pScreen->CreateScreenResources)
ret = (*pScreen->CreateScreenResources) (pScreen);
else
ret = -1;
pScreenPriv->CreateScreenResources = pScreen->CreateScreenResources;
pScreen->CreateScreenResources = KdCreateScreenResources;
if (ret && card->cfuncs->createRes)
ret = (*card->cfuncs->createRes) (pScreen);
return ret;
if (!miCreateScreenResources(pScreen))
return FALSE;
if (card->cfuncs->createRes)
return card->cfuncs->createRes(pScreen);
return TRUE;
}
static Bool
KdCloseScreen(ScreenPtr pScreen)
Bool KdCloseScreen(ScreenPtr pScreen)
{
KdScreenPriv(pScreen);
KdScreenInfo *screen = pScreenPriv->screen;
KdCardInfo *card = pScreenPriv->card;
Bool ret;
if (card->cfuncs->closeScreen)
(*card->cfuncs->closeScreen)(pScreen);
pScreenPriv->closed = TRUE;
pScreen->CloseScreen = pScreenPriv->CloseScreen;
if (pScreen->CloseScreen)
ret = (*pScreen->CloseScreen) (pScreen);
else
ret = TRUE;
Bool ret = fbCloseScreen(pScreen);
if (screen->mynum == card->selected)
KdDisableScreen(pScreen);
@ -611,7 +602,6 @@ KdSaveScreen(ScreenPtr pScreen, int on)
static Bool
KdCreateWindow(WindowPtr pWin)
{
#ifndef PHOENIX
if (!pWin->parent) {
KdScreenPriv(pWin->drawable.pScreen);
@ -620,7 +610,6 @@ KdCreateWindow(WindowPtr pWin)
RegionBreak(&pWin->clipList);
}
}
#endif
return fbCreateWindow(pWin);
}
@ -789,15 +778,7 @@ KdScreenInit(ScreenPtr pScreen, int argc, char **argv)
if (!(*card->cfuncs->finishInitScreen) (pScreen))
return FALSE;
/*
* Wrap CloseScreen, the order now is:
* KdCloseScreen
* fbCloseScreen
*/
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = KdCloseScreen;
pScreenPriv->CreateScreenResources = pScreen->CreateScreenResources;
pScreen->CreateScreenResources = KdCreateScreenResources;
if (screen->softCursor ||

View File

@ -141,9 +141,6 @@ typedef struct {
ColormapPtr pInstalledmap; /* current colormap */
xColorItem systemPalette[KD_MAX_PSEUDO_SIZE]; /* saved windows colors */
CreateScreenResourcesProcPtr CreateScreenResources;
CloseScreenProcPtr CloseScreen;
} KdPrivScreenRec, *KdPrivScreenPtr;
typedef enum _kdPointerState {
@ -435,4 +432,6 @@ void
void
InitCard(char *name);
Bool KdCloseScreen(ScreenPtr pScreen);
#endif /* _KDRIVE_H_ */

View File

@ -40,6 +40,7 @@ of the copyright holder.
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "dix/screen_hooks_priv.h"
#include "Xext/xvdix_priv.h"
#include "kdrive.h"
@ -82,9 +83,10 @@ static int KdXVPutImage(DrawablePtr, XvPortPtr, GCPtr,
static int KdXVQueryImageAttributes(XvPortPtr, XvImagePtr,
CARD16 *, CARD16 *, int *, int *);
static void KdXVWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin);
/* ScreenRec fields */
static Bool KdXVDestroyWindow(WindowPtr pWin);
static void KdXVWindowExposures(WindowPtr pWin, RegionPtr r1);
static void KdXVClipNotify(WindowPtr pWin, int dx, int dy);
static Bool KdXVCloseScreen(ScreenPtr);
@ -139,16 +141,16 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
if (!ScreenPriv)
return FALSE;
ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
dixScreenHookWindowDestroy(pScreen, KdXVWindowDestroy);
ScreenPriv->WindowExposures = pScreen->WindowExposures;
ScreenPriv->ClipNotify = pScreen->ClipNotify;
ScreenPriv->CloseScreen = pScreen->CloseScreen;
/* fprintf(stderr,"XV: Wrapping screen funcs\n"); */
pScreen->DestroyWindow = KdXVDestroyWindow;
pScreen->WindowExposures = KdXVWindowExposures;
pScreen->ClipNotify = KdXVClipNotify;
/* it will call KdCloseScreen() as it's the last act */
pScreen->CloseScreen = KdXVCloseScreen;
if (!KdXVInitAdaptors(pScreen, adaptors, num))
@ -755,13 +757,10 @@ KdXVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
/**** ScreenRec fields ****/
static Bool
KdXVDestroyWindow(WindowPtr pWin)
static void
KdXVWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
KdXVScreenPtr ScreenPriv = GET_KDXV_SCREEN(pScreen);
KdXVWindowPtr tmp, WinPriv = GET_KDXV_WINDOW(pWin);
int ret;
while (WinPriv) {
XvPortRecPrivatePtr pPriv = WinPriv->PortRec;
@ -779,12 +778,6 @@ KdXVDestroyWindow(WindowPtr pWin)
}
dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, NULL);
pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
ret = (*pScreen->DestroyWindow) (pWin);
pScreen->DestroyWindow = KdXVDestroyWindow;
return ret;
}
static void
@ -919,12 +912,8 @@ KdXVCloseScreen(ScreenPtr pScreen)
if (!ScreenPriv)
return TRUE;
pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
pScreen->WindowExposures = ScreenPriv->WindowExposures;
pScreen->ClipNotify = ScreenPriv->ClipNotify;
pScreen->CloseScreen = ScreenPriv->CloseScreen;
/* fprintf(stderr,"XV: Unwrapping screen funcs\n"); */
for (c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) {
KdXVFreeAdaptor(pa);
@ -933,7 +922,7 @@ KdXVCloseScreen(ScreenPtr pScreen)
free(pxvs->pAdaptors);
free(ScreenPriv);
return pScreen->CloseScreen(pScreen);
return KdCloseScreen(pScreen);
}
/**** XvAdaptorRec fields ****/

View File

@ -151,10 +151,8 @@ Bool
/*** These are DDX layer privates ***/
typedef struct {
DestroyWindowProcPtr DestroyWindow;
ClipNotifyProcPtr ClipNotify;
WindowExposuresProcPtr WindowExposures;
CloseScreenProcPtr CloseScreen;
} KdXVScreenRec, *KdXVScreenPtr;
typedef struct {

View File

@ -50,6 +50,7 @@
#include "dix/dix_priv.h"
#include "dix/eventconvert.h"
#include "dix/exevents_priv.h"
#include "dix/screen_hooks_priv.h"
#include "mi/mi_priv.h"
#include "xf86.h"
@ -84,7 +85,7 @@ static DevPrivateKeyRec DGAScreenKeyRec;
#define DGAScreenKeyRegistered dixPrivateKeyRegistered(&DGAScreenKeyRec)
static Bool DGACloseScreen(ScreenPtr pScreen);
static void DGACloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused);
static void DGADestroyColormap(ColormapPtr pmap);
static void DGAInstallColormap(ColormapPtr pmap);
static void DGAUninstallColormap(ColormapPtr pmap);
@ -111,7 +112,6 @@ typedef struct {
ScrnInfoPtr pScrn;
int numModes;
DGAModePtr modes;
CloseScreenProcPtr CloseScreen;
DestroyColormapProcPtr DestroyColormap;
InstallColormapProcPtr InstallColormap;
UninstallColormapProcPtr UninstallColormap;
@ -149,8 +149,7 @@ DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes, int num)
if (!(pScreenPriv = (DGAScreenPtr) malloc(sizeof(DGAScreenRec))))
return FALSE;
dixSetPrivate(&pScreen->devPrivates, &DGAScreenKeyRec, pScreenPriv);
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = DGACloseScreen;
dixScreenHookClose(pScreen, DGACloseScreen);
pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
pScreen->DestroyColormap = DGADestroyColormap;
pScreenPriv->InstallColormap = pScreen->InstallColormap;
@ -264,23 +263,24 @@ FreeMarkedVisuals(ScreenPtr pScreen)
}
}
static Bool
DGACloseScreen(ScreenPtr pScreen)
static void DGACloseScreen(CallbackListPtr *pcbl,
ScreenPtr pScreen, void *unused)
{
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
if (!pScreenPriv)
return;
mieqSetHandler(ET_DGAEvent, NULL);
pScreenPriv->pScrn->SetDGAMode(pScreenPriv->pScrn, 0, NULL);
FreeMarkedVisuals(pScreen);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
dixScreenUnhookClose(pScreen, DGACloseScreen);
pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
pScreen->InstallColormap = pScreenPriv->InstallColormap;
pScreen->UninstallColormap = pScreenPriv->UninstallColormap;
free(pScreenPriv);
return ((*pScreen->CloseScreen) (pScreen));
dixSetPrivate(&pScreen->devPrivates, &DGAScreenKeyRec, NULL);
}
static void

View File

@ -28,6 +28,7 @@
#include <X11/X.h>
#include "dix/input_priv.h"
#include "dix/screen_hooks_priv.h"
#include "os.h"
#include "globals.h"
@ -40,7 +41,6 @@
#include "inputstr.h"
typedef struct _xf86RandRInfo {
CloseScreenProcPtr CloseScreen;
int virtualX;
int virtualY;
int mmWidth;
@ -340,19 +340,22 @@ xf86RandRSetConfig(ScreenPtr pScreen,
/*
* Reset size back to original
*/
static Bool
xf86RandRCloseScreen(ScreenPtr pScreen)
static void xf86RandRCloseScreen(CallbackListPtr *pcbl,
ScreenPtr pScreen, void *unused)
{
ScrnInfoPtr scrp = xf86ScreenToScrn(pScreen);
if (!scrp)
return;
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
scrp->virtualX = pScreen->width = randrp->virtualX;
scrp->virtualY = pScreen->height = randrp->virtualY;
scrp->currentMode = scrp->modes;
pScreen->CloseScreen = randrp->CloseScreen;
dixScreenUnhookClose(pScreen, xf86RandRCloseScreen);
free(randrp);
dixSetPrivate(&pScreen->devPrivates, xf86RandRKey, NULL);
return (*pScreen->CloseScreen) (pScreen);
}
Rotation
@ -437,8 +440,7 @@ xf86RandRInit(ScreenPtr pScreen)
randrp->mmWidth = pScreen->mmWidth;
randrp->mmHeight = pScreen->mmHeight;
randrp->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xf86RandRCloseScreen;
dixScreenHookClose(pScreen, xf86RandRCloseScreen);
randrp->rotation = RR_Rotate_0;

View File

@ -36,6 +36,7 @@
#include "misc.h"
#include "dix/colormap_priv.h"
#include "dix/screen_hooks_priv.h"
#include "mi/mi_priv.h"
#include "misc.h"
@ -74,7 +75,6 @@ typedef struct _CMapLink {
} CMapLink, *CMapLinkPtr;
typedef struct {
CloseScreenProcPtr CloseScreen;
CreateColormapProcPtr CreateColormap;
DestroyColormapProcPtr DestroyColormap;
InstallColormapProcPtr InstallColormap;
@ -110,7 +110,7 @@ static DevPrivateKeyRec CMapColormapKeyRec;
static void CMapInstallColormap(ColormapPtr);
static void CMapStoreColors(ColormapPtr, int, xColorItem *);
static Bool CMapCloseScreen(ScreenPtr);
static void CMapCloseScreen(CallbackListPtr*, ScreenPtr, void*);
static Bool CMapCreateColormap(ColormapPtr);
static void CMapDestroyColormap(ColormapPtr);
@ -127,7 +127,6 @@ static Bool CMapAllocateColormapPrivate(ColormapPtr);
static void CMapRefreshColors(ColormapPtr, int, int *);
static void CMapSetOverscan(ColormapPtr, int, int *);
static void CMapReinstallMap(ColormapPtr);
static void CMapUnwrapScreen(ScreenPtr pScreen);
Bool
xf86ColormapAllocatePrivates(ScrnInfoPtr pScrn)
@ -175,13 +174,12 @@ xf86HandleColormaps(ScreenPtr pScreen,
}
dixSetPrivate(&pScreen->devPrivates, &CMapScreenKeyRec, pScreenPriv);
dixScreenHookClose(pScreen, CMapCloseScreen);
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreenPriv->CreateColormap = pScreen->CreateColormap;
pScreenPriv->DestroyColormap = pScreen->DestroyColormap;
pScreenPriv->InstallColormap = pScreen->InstallColormap;
pScreenPriv->StoreColors = pScreen->StoreColors;
pScreen->CloseScreen = CMapCloseScreen;
pScreen->CreateColormap = CMapCreateColormap;
pScreen->DestroyColormap = CMapDestroyColormap;
pScreen->InstallColormap = CMapInstallColormap;
@ -220,7 +218,7 @@ xf86HandleColormaps(ScreenPtr pScreen,
X11_RESTYPE_COLORMAP, serverClient, DixInstallAccess);
if (!CMapAllocateColormapPrivate(pDefMap)) {
CMapUnwrapScreen(pScreen);
CMapCloseScreen(NULL, pScreen, NULL);
return FALSE;
}
@ -228,7 +226,7 @@ xf86HandleColormaps(ScreenPtr pScreen,
pScrn->LoadPalette = xf86RandR12LoadPalette;
if (!xf86RandR12InitGamma(pScrn, elements)) {
CMapUnwrapScreen(pScreen);
CMapCloseScreen(NULL, pScreen, NULL);
return FALSE;
}
}
@ -241,14 +239,6 @@ xf86HandleColormaps(ScreenPtr pScreen,
/**** Screen functions ****/
static Bool
CMapCloseScreen(ScreenPtr pScreen)
{
CMapUnwrapScreen(pScreen);
return (*pScreen->CloseScreen) (pScreen);
}
static Bool
CMapColormapUseMax(VisualPtr pVisual, CMapScreenPtr pScreenPriv)
{
@ -827,14 +817,17 @@ CMapSetOverscan(ColormapPtr pmap, int defs, int *indices)
}
}
static void
CMapUnwrapScreen(ScreenPtr pScreen)
static void CMapCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
CMapScreenPtr pScreenPriv =
(CMapScreenPtr) dixLookupPrivate(&pScreen->devPrivates, CMapScreenKey);
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
if (!pScrn)
return;
dixScreenUnhookClose(pScreen, CMapCloseScreen);
pScreen->CreateColormap = pScreenPriv->CreateColormap;
pScreen->DestroyColormap = pScreenPriv->DestroyColormap;
pScreen->InstallColormap = pScreenPriv->InstallColormap;
@ -848,6 +841,7 @@ CMapUnwrapScreen(ScreenPtr pScreen)
free(pScreenPriv->gamma);
free(pScreenPriv->PreAllocIndices);
free(pScreenPriv);
dixSetPrivate(&pScreen->devPrivates, &CMapScreenKeyRec, NULL);
}
static void

View File

@ -25,15 +25,14 @@
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include "dix/screen_hooks_priv.h"
#include "misc.h"
#include "xf86.h"
#include <X11/X.h>
#include "scrnintstr.h"
#include "regionstr.h"
#include "xf86fbman.h"
@ -288,7 +287,6 @@ typedef struct {
FBLinkPtr UsedAreas;
int NumUsedAreas;
FBLinearLinkPtr LinearAreas;
CloseScreenProcPtr CloseScreen;
int NumCallbacks;
FreeBoxCallbackProcPtr *FreeBoxesUpdateCallback;
DevUnion *devPrivates;
@ -1148,15 +1146,18 @@ static FBManagerFuncs xf86FBManFuncs = {
localPurgeUnlockedOffscreenAreas
};
static Bool
xf86FBCloseScreen(ScreenPtr pScreen)
static void xf86FBCloseScreen(CallbackListPtr *pcbl,
ScreenPtr pScreen, void *unused)
{
FBLinkPtr pLink, tmp;
FBLinearLinkPtr pLinearLink, tmp2;
FBManagerPtr offman = (FBManagerPtr) dixLookupPrivate(&pScreen->devPrivates,
xf86FBScreenKey);
pScreen->CloseScreen = offman->CloseScreen;
dixScreenUnhookClose(pScreen, xf86FBCloseScreen);
if (!offman)
return;
pLink = offman->UsedAreas;
while (pLink) {
@ -1179,8 +1180,6 @@ xf86FBCloseScreen(ScreenPtr pScreen)
free(offman->devPrivates);
free(offman);
dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, NULL);
return (*pScreen->CloseScreen) (pScreen);
}
Bool
@ -1325,9 +1324,7 @@ xf86InitFBManagerRegion(ScreenPtr pScreen, RegionPtr FullRegion)
return FALSE;
dixSetPrivate(&pScreen->devPrivates, xf86FBScreenKey, offman);
offman->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xf86FBCloseScreen;
dixScreenHookClose(pScreen, xf86FBCloseScreen);
offman->InitialBoxes = RegionCreate(NULL, 1);
offman->FreeBoxes = RegionCreate(NULL, 1);

View File

@ -724,8 +724,7 @@ xf86platformAddDevice(const char *driver_name, int index)
PixmapScreenInit(xf86GPUScreens[i]->pScreen);
if (xf86GPUScreens[i]->pScreen->CreateScreenResources &&
!(*xf86GPUScreens[i]->pScreen->CreateScreenResources) (xf86GPUScreens[i]->pScreen)) {
if (dixScreenRaiseCreateResources(xf86GPUScreens[i]->pScreen)) {
RemoveGPUScreen(xf86GPUScreens[i]->pScreen);
xf86DeleteScreen(xf86GPUScreens[i]);
xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL);
@ -778,7 +777,7 @@ xf86platformRemoveDevice(int index)
scrnum = xf86GPUScreens[i]->confScreen->screennum;
xf86GPUScreens[i]->pScreen->CloseScreen(xf86GPUScreens[i]->pScreen);
dixScreenRaiseClose(xf86GPUScreens[i]->pScreen);
RemoveGPUScreen(xf86GPUScreens[i]->pScreen);
xf86DeleteScreen(xf86GPUScreens[i]);

View File

@ -624,7 +624,6 @@ static DevPrivateKeyRec sbusPaletteKeyRec;
typedef struct _sbusCmap {
sbusDevicePtr psdp;
CloseScreenProcPtr CloseScreen;
Bool origCmapValid;
unsigned char origRed[16];
unsigned char origGreen[16];
@ -668,13 +667,18 @@ xf86SbusCmapLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
free(data);
}
static Bool
xf86SbusCmapCloseScreen(ScreenPtr pScreen)
static void xf86SbusCmapCloseScreen(CallbackListPtr *pcbl,
ScreenPtr pScreen, void *unused)
{
sbusCmapPtr cmap;
struct fbcmap fbcmap;
dixScreenUnhook(pScreen, xf86SbusCmapCloseScreen);
cmap = SBUSCMAPPTR(pScreen);
if (!cmap)
return;
if (cmap->origCmapValid) {
fbcmap.index = 0;
fbcmap.count = 16;
@ -683,9 +687,8 @@ xf86SbusCmapCloseScreen(ScreenPtr pScreen)
fbcmap.blue = cmap->origBlue;
ioctl(cmap->psdp->fd, FBIOPUTCMAP, &fbcmap);
}
pScreen->CloseScreen = cmap->CloseScreen;
free(cmap);
return (*pScreen->CloseScreen) (pScreen);
dixSetPrivate(&pScreen->devPrivates, sbusPaletteKey, NULL);
}
Bool
@ -722,8 +725,7 @@ xf86SbusHandleColormaps(ScreenPtr pScreen, sbusDevicePtr psdp)
data[1] = 255;
}
ioctl(psdp->fd, FBIOPUTCMAP, &fbcmap);
cmap->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xf86SbusCmapCloseScreen;
dixScreenHookClose(pScreen, xf86SbusCmapCloseScreen);
return xf86HandleColormaps(pScreen, 256, 8,
xf86SbusCmapLoadPalette, NULL, 0);
}

View File

@ -37,6 +37,7 @@
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvproto.h>
#include "dix/screen_hooks_priv.h"
#include "Xext/xvdix_priv.h"
#include "misc.h"
@ -81,14 +82,15 @@ static int xf86XVPutImage(DrawablePtr, XvPortPtr, GCPtr,
static int xf86XVQueryImageAttributes(XvPortPtr, XvImagePtr,
CARD16 *, CARD16 *, int *, int *);
static void xf86XVWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin);
/* ScreenRec fields */
static Bool xf86XVDestroyWindow(WindowPtr pWin);
static void xf86XVWindowExposures(WindowPtr pWin, RegionPtr r1);
static void xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin,
VTKind kind);
static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy);
static Bool xf86XVCloseScreen(ScreenPtr);
static void xf86XVCloseScreen(CallbackListPtr *, ScreenPtr, void *);
#define PostValidateTreeUndefined ((PostValidateTreeProcPtr)-1)
@ -253,20 +255,18 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
pScrn = xf86ScreenToScrn(pScreen);
ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
dixScreenHookClose(pScreen, xf86XVCloseScreen);
ScreenPriv->WindowExposures = pScreen->WindowExposures;
ScreenPriv->PostValidateTree = PostValidateTreeUndefined;
ScreenPriv->ClipNotify = pScreen->ClipNotify;
ScreenPriv->CloseScreen = pScreen->CloseScreen;
ScreenPriv->EnterVT = pScrn->EnterVT;
ScreenPriv->LeaveVT = pScrn->LeaveVT;
ScreenPriv->AdjustFrame = pScrn->AdjustFrame;
ScreenPriv->ModeSet = pScrn->ModeSet;
pScreen->DestroyWindow = xf86XVDestroyWindow;
pScreen->WindowExposures = xf86XVWindowExposures;
pScreen->ClipNotify = xf86XVClipNotify;
pScreen->CloseScreen = xf86XVCloseScreen;
pScrn->EnterVT = xf86XVEnterVT;
pScrn->LeaveVT = xf86XVLeaveVT;
if (pScrn->AdjustFrame)
@ -991,13 +991,10 @@ xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn, Bool onlyChanged)
/**** ScreenRec fields ****/
static Bool
xf86XVDestroyWindow(WindowPtr pWin)
static void
xf86XVWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
XF86XVWindowPtr tmp, WinPriv = GET_XF86XV_WINDOW(pWin);
int ret;
while (WinPriv) {
XvPortRecPrivatePtr pPriv = WinPriv->PortRec;
@ -1015,12 +1012,6 @@ xf86XVDestroyWindow(WindowPtr pWin)
}
dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, NULL);
pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
ret = (*pScreen->DestroyWindow) (pWin);
pScreen->DestroyWindow = xf86XVDestroyWindow;
return ret;
}
static void
@ -1136,8 +1127,8 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
/**** Required XvScreenRec fields ****/
static Bool
xf86XVCloseScreen(ScreenPtr pScreen)
static void xf86XVCloseScreen(CallbackListPtr *pcbl,
ScreenPtr pScreen, void *unused)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
@ -1146,12 +1137,13 @@ xf86XVCloseScreen(ScreenPtr pScreen)
int c;
if (!ScreenPriv)
return TRUE;
return;
dixScreenUnhookWindowDestroy(pScreen, xf86XVWindowDestroy);
dixScreenUnhookClose(pScreen, xf86XVCloseScreen);
pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
pScreen->WindowExposures = ScreenPriv->WindowExposures;
pScreen->ClipNotify = ScreenPriv->ClipNotify;
pScreen->CloseScreen = ScreenPriv->CloseScreen;
pScrn->EnterVT = ScreenPriv->EnterVT;
pScrn->LeaveVT = ScreenPriv->LeaveVT;
@ -1164,8 +1156,7 @@ xf86XVCloseScreen(ScreenPtr pScreen)
free(pxvs->pAdaptors);
free(ScreenPriv);
return pScreen->CloseScreen(pScreen);
dixSetPrivate(&pScreen->devPrivates, &XF86XVScreenPrivateKey, NULL);
}
/**** ScrnInfoRec fields ****/

View File

@ -36,6 +36,9 @@
#include <X11/X.h>
#include <X11/Xproto.h>
#include "dix/screen_hooks_priv.h"
#include "scrnintstr.h"
#include "resource.h"
#include "dixstruct.h"
@ -44,7 +47,6 @@
#include "xf86xvmc.h"
typedef struct {
CloseScreenProcPtr CloseScreen;
int num_adaptors;
XF86MCAdaptorPtr *adaptors;
XvMCAdaptorPtr dixinfo;
@ -129,17 +131,18 @@ xf86XvMCDestroySubpicture(XvMCSubpicturePtr pSubpicture)
pSubpicture);
}
static Bool
xf86XvMCCloseScreen(ScreenPtr pScreen)
static void xf86XvMCCloseScreen(CallbackListPtr *pcbl,
ScreenPtr pScreen, void *unused)
{
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pScreen);
dixScreenUnhookClose(pScreen, xf86XvMCCloseScreen);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pScreen);
if (!pScreenPriv)
return;
free(pScreenPriv->dixinfo);
free(pScreenPriv);
return (*pScreen->CloseScreen) (pScreen);
dixSetPrivate(&pScreen->devPrivates, XF86XvMCScreenKey, NULL);
}
Bool
@ -169,9 +172,7 @@ xf86XvMCScreenInit(ScreenPtr pScreen,
}
dixSetPrivate(&pScreen->devPrivates, XF86XvMCScreenKey, pScreenPriv);
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xf86XvMCCloseScreen;
dixScreenHookClose(pScreen, xf86XvMCCloseScreen);
pScreenPriv->num_adaptors = num_adaptors;
pScreenPriv->adaptors = adaptors;

View File

@ -1,4 +1,3 @@
/*
* Copyright (c) 2003 by The XFree86 Project, Inc.
*
@ -37,7 +36,6 @@
extern _X_EXPORT DevPrivateKey XF86XvScreenKey;
typedef struct {
DestroyWindowProcPtr DestroyWindow;
ClipNotifyProcPtr ClipNotify;
WindowExposuresProcPtr WindowExposures;
PostValidateTreeProcPtr PostValidateTree;
@ -45,7 +43,6 @@ typedef struct {
Bool (*EnterVT) (ScrnInfoPtr);
void (*LeaveVT) (ScrnInfoPtr);
xf86ModeSetProc *ModeSet;
CloseScreenProcPtr CloseScreen;
} XF86XVScreenRec, *XF86XVScreenPtr;
typedef struct {

View File

@ -48,6 +48,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <X11/Xproto.h>
#include "dix/dix_priv.h"
#include "dix/screen_hooks_priv.h"
#include "xf86.h"
#include "xf86drm.h"
@ -634,7 +635,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD)
return TRUE;
}
static Bool DRIDestroyWindow(WindowPtr pWin);
static void DRIWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin);
Bool
DRIFinishScreenInit(ScreenPtr pScreen)
@ -648,8 +649,7 @@ DRIFinishScreenInit(ScreenPtr pScreen)
pScreen->WindowExposures = pDRIInfo->wrap.WindowExposures;
}
pDRIPriv->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = DRIDestroyWindow;
dixScreenHookWindowDestroy(pScreen, DRIWindowDestroy);
pDRIPriv->xf86_crtc_notify = xf86_wrap_crtc_notify(pScreen,
dri_crtc_notify);
@ -696,11 +696,8 @@ DRICloseScreen(ScreenPtr pScreen)
pScreen->WindowExposures = pDRIPriv->wrap.WindowExposures;
pDRIPriv->wrap.WindowExposures = NULL;
}
if (pDRIPriv->DestroyWindow) {
pScreen->DestroyWindow = pDRIPriv->DestroyWindow;
pDRIPriv->DestroyWindow = NULL;
}
dixScreenUnhookWindowDestroy(pScreen, DRIWindowDestroy);
xf86_unwrap_crtc_notify(pScreen, pDRIPriv->xf86_crtc_notify);
if (pDRIInfo->wrap.CopyWindow) {
@ -1922,29 +1919,9 @@ DRITreeTraversal(WindowPtr pWin, void *data)
return WT_WALKCHILDREN;
}
static Bool
DRIDestroyWindow(WindowPtr pWin)
static void DRIWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
Bool retval = TRUE;
DRIDrawablePrivDestroy(pWin);
/* call lower wrapped functions */
if (pDRIPriv->DestroyWindow) {
/* unwrap */
pScreen->DestroyWindow = pDRIPriv->DestroyWindow;
/* call lower layers */
retval = (*pScreen->DestroyWindow) (pWin);
/* rewrap */
pDRIPriv->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = DRIDestroyWindow;
}
return retval;
}
void

View File

@ -90,7 +90,6 @@ typedef struct _DRIScreenPrivRec {
DrawablePtr fullscreen; /* pointer to fullscreen drawable */
drm_clip_rect_t fullscreen_rect; /* fake rect for fullscreen mode */
DRIWrappedFuncsRec wrap;
DestroyWindowProcPtr DestroyWindow;
DrawablePtr DRIDrawables[SAREA_MAX_DRAWABLES];
DRIContextPrivPtr dummyCtxPriv; /* Pointer to dummy context */
Bool createDummyCtx;

View File

@ -42,6 +42,7 @@
#include "config/hotplug_priv.h"
#include "dix/dix_priv.h"
#include "mi/mi_priv.h"
#include "xf86.h"
#include "xf86Priv.h"
@ -1744,18 +1745,15 @@ msStopFlippingPixmapTracking(DrawablePtr src,
}
static Bool
CreateScreenResources(ScreenPtr pScreen)
modsetCreateScreenResources(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
modesettingPtr ms = modesettingPTR(pScrn);
PixmapPtr rootPixmap;
Bool ret;
void *pixels = NULL;
int err;
pScreen->CreateScreenResources = ms->createScreenResources;
ret = pScreen->CreateScreenResources(pScreen);
pScreen->CreateScreenResources = CreateScreenResources;
Bool ret = miCreateScreenResources(pScreen);
if (!drmmode_set_desired_modes(pScrn, &ms->drmmode, pScrn->is_gpu, FALSE))
return FALSE;
@ -2057,8 +2055,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
return FALSE;
}
ms->createScreenResources = pScreen->CreateScreenResources;
pScreen->CreateScreenResources = CreateScreenResources;
pScreen->CreateScreenResources = modsetCreateScreenResources;
xf86SetBlackWhitePixels(pScreen);
@ -2325,7 +2322,6 @@ CloseScreen(ScreenPtr pScreen)
LeaveVT(pScrn);
}
pScreen->CreateScreenResources = ms->createScreenResources;
pScreen->BlockHandler = ms->BlockHandler;
pScrn->vtSema = FALSE;

View File

@ -108,7 +108,6 @@ typedef struct _modesettingRec {
CreateWindowProcPtr CreateWindow;
unsigned int SaveGeneration;
CreateScreenResourcesProcPtr createScreenResources;
ScreenBlockHandlerProcPtr BlockHandler;
miPointerSpriteFuncPtr SpriteFuncs;
void *driver;

View File

@ -31,13 +31,14 @@
#include <string.h>
#include "dix/screen_hooks_priv.h"
#include "exa_priv.h"
#include "xf86str.h"
#include "xf86.h"
typedef struct _ExaXorgScreenPrivRec {
CloseScreenProcPtr SavedCloseScreen;
xf86EnableDisableFBAccessProc *SavedEnableDisableFBAccess;
OptionInfoPtr options;
} ExaXorgScreenPrivRec, *ExaXorgScreenPrivPtr;
@ -69,21 +70,22 @@ static const OptionInfoRec EXAOptions[] = {
OPTV_NONE, {0}, FALSE}
};
static Bool
exaXorgCloseScreen(ScreenPtr pScreen)
static void exaXorgCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
ExaXorgScreenPrivPtr pScreenPriv = (ExaXorgScreenPrivPtr)
dixLookupPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey);
pScreen->CloseScreen = pScreenPriv->SavedCloseScreen;
dixScreenUnhookClose(pScreen, exaXorgCloseScreen);
if (!pScrn)
return;
pScrn->EnableDisableFBAccess = pScreenPriv->SavedEnableDisableFBAccess;
free(pScreenPriv->options);
free(pScreenPriv);
return pScreen->CloseScreen(pScreen);
dixSetPrivate(&pScreen->devPrivates, exaXorgScreenPrivateKey, NULL);
}
static void
@ -176,9 +178,7 @@ exaDDXDriverInit(ScreenPtr pScreen)
pScreenPriv->SavedEnableDisableFBAccess = pScrn->EnableDisableFBAccess;
pScrn->EnableDisableFBAccess = exaXorgEnableDisableFBAccess;
pScreenPriv->SavedCloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = exaXorgCloseScreen;
dixScreenHookClose(pScreen, exaXorgCloseScreen);
}
static XF86ModuleVersionInfo exaVersRec = {

View File

@ -29,12 +29,14 @@
#include <string.h>
#include <stdio.h>
#include "dix/screen_hooks_priv.h"
#include "xf86.h"
#include "xf86DDC_priv.h"
#include "xf86Crtc.h"
#include "xf86Modes.h"
#include "xf86Priv.h"
#include "xf86RandR12.h"
#include "xf86RandR12_priv.h"
#include "X11/extensions/render.h"
#include "X11/extensions/dpmsconst.h"
#include "X11/Xatom.h"
@ -743,31 +745,23 @@ xf86OutputDestroy(xf86OutputPtr output)
}
/*
* Called during CreateScreenResources to hook up RandR
* installed by xf86CrtcScreenInit() and called by during CreateScreenResources
*/
static Bool
xf86CrtcCreateScreenResources(ScreenPtr screen)
static void xf86CrtcCreateScreenResources(CallbackListPtr *pcbl,
ScreenPtr pScreen, Bool *ret)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
screen->CreateScreenResources = config->CreateScreenResources;
if (!(*screen->CreateScreenResources) (screen))
return FALSE;
if (!xf86RandR12CreateScreenResources(screen))
return FALSE;
return TRUE;
xf86RandR12CreateScreenResources(pScreen);
}
/*
* Clean up config on server reset
*/
static Bool
xf86CrtcCloseScreen(ScreenPtr screen)
static void xf86CrtcCloseScreen(CallbackListPtr *pcbl,
ScreenPtr screen, void *unused)
{
dixScreenUnhookClose(screen, xf86CrtcCloseScreen);
dixScreenUnhookPostCreateResources(screen, xf86CrtcCreateScreenResources);
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
int o, c;
@ -788,20 +782,15 @@ xf86CrtcCloseScreen(ScreenPtr screen)
crtc->randr_crtc = NULL;
}
screen->CloseScreen = config->CloseScreen;
xf86RotateCloseScreen(screen);
xf86RandR12CloseScreen(screen);
screen->CloseScreen(screen);
/* detach any providers */
if (config->randr_provider) {
RRProviderDestroy(config->randr_provider);
config->randr_provider = NULL;
}
return TRUE;
}
/*
@ -839,12 +828,8 @@ xf86CrtcScreenInit(ScreenPtr screen)
xf86RandR12SetTransformSupport(screen, FALSE);
}
/* Wrap CreateScreenResources so we can initialize the RandR code */
config->CreateScreenResources = screen->CreateScreenResources;
screen->CreateScreenResources = xf86CrtcCreateScreenResources;
config->CloseScreen = screen->CloseScreen;
screen->CloseScreen = xf86CrtcCloseScreen;
dixScreenHookClose(screen, xf86CrtcCloseScreen);
dixScreenHookPostCreateResources(screen, xf86CrtcCreateScreenResources);
/* This might still be marked wrapped from a previous generation */
config->BlockHandler = NULL;

View File

@ -799,8 +799,6 @@ typedef struct _xf86CrtcConfig {
CreateScreenResourcesProcPtr CreateScreenResources;
CloseScreenProcPtr CloseScreen;
/* Cursor information */
xf86CursorInfoPtr cursor_info;
CursorPtr cursor;

View File

@ -25,9 +25,7 @@
#include <randrstr.h>
#include <X11/extensions/render.h>
extern _X_EXPORT Bool xf86RandR12CreateScreenResources(ScreenPtr pScreen);
extern _X_EXPORT Bool xf86RandR12Init(ScreenPtr pScreen);
extern _X_EXPORT void xf86RandR12CloseScreen(ScreenPtr pScreen);
extern _X_EXPORT void xf86RandR12SetRotations(ScreenPtr pScreen,
Rotation rotation);
extern _X_EXPORT void xf86RandR12SetTransformSupport(ScreenPtr pScreen,

View File

@ -5,6 +5,7 @@
#ifndef _XSERVER_XF86RANDR12_PRIV_H_
#define _XSERVER_XF86RANDR12_PRIV_H_
#include <X11/Xdefs.h>
#include <X11/extensions/render.h>
#include "randrstr.h"
@ -15,4 +16,7 @@ void xf86RandR12LoadPalette(ScrnInfoPtr pScrn, int numColors,
VisualPtr pVisual);
Bool xf86RandR12InitGamma(ScrnInfoPtr pScrn, unsigned gammaSize);
void xf86RandR12CloseScreen(ScreenPtr pScreen);
Bool xf86RandR12CreateScreenResources(ScreenPtr pScreen);
#endif /* _XSERVER_XF86RANDR12_PRIV_H_ */

View File

@ -4,6 +4,7 @@
#endif
#include "dix/cursor_priv.h"
#include "dix/screen_hooks_priv.h"
#include "mi/mipointer_priv.h"
#include "xf86.h"
@ -46,7 +47,7 @@ static miPointerSpriteFuncRec xf86CursorSpriteFuncs = {
static void xf86CursorInstallColormap(ColormapPtr);
static void xf86CursorRecolorCursor(DeviceIntPtr pDev, ScreenPtr, CursorPtr,
Bool);
static Bool xf86CursorCloseScreen(ScreenPtr);
static void xf86CursorCloseScreen(CallbackListPtr *, ScreenPtr, void *);
static void xf86CursorQueryBestSize(int, unsigned short *, unsigned short *,
ScreenPtr);
@ -85,8 +86,7 @@ xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr)
ScreenPriv->PalettedCursor = FALSE;
ScreenPriv->pInstalledMap = NULL;
ScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xf86CursorCloseScreen;
dixScreenHookClose(pScreen, xf86CursorCloseScreen);
ScreenPriv->QueryBestSize = pScreen->QueryBestSize;
pScreen->QueryBestSize = xf86CursorQueryBestSize;
ScreenPriv->RecolorCursor = pScreen->RecolorCursor;
@ -124,10 +124,15 @@ xf86InitCursor(ScreenPtr pScreen, xf86CursorInfoPtr infoPtr)
/***** Screen functions *****/
static Bool
xf86CursorCloseScreen(ScreenPtr pScreen)
static void xf86CursorCloseScreen(CallbackListPtr *pcbl,
ScreenPtr pScreen, void *unused)
{
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
if (!pScrn)
return;
dixScreenUnhookClose(pScreen, xf86CursorCloseScreen);
miPointerScreenPtr PointPriv =
(miPointerScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
miPointerScreenKey);
@ -141,7 +146,6 @@ xf86CursorCloseScreen(ScreenPtr pScreen)
if (ScreenPriv->CurrentCursor)
FreeCursor(ScreenPriv->CurrentCursor, None);
pScreen->CloseScreen = ScreenPriv->CloseScreen;
pScreen->QueryBestSize = ScreenPriv->QueryBestSize;
pScreen->RecolorCursor = ScreenPriv->RecolorCursor;
if (ScreenPriv->InstallColormap)
@ -155,8 +159,7 @@ xf86CursorCloseScreen(ScreenPtr pScreen)
free(ScreenPriv->transparentData);
free(ScreenPriv);
return (*pScreen->CloseScreen) (pScreen);
dixSetPrivate(&pScreen->devPrivates, xf86CursorScreenKey, NULL);
}
static void

View File

@ -5,37 +5,36 @@
Written by Mark Vojkovich (mvojkovi@ucsd.edu)
Pre-fb-write callbacks and RENDER support - Nolan Leake (nolan@vmware.com)
*/
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include <X11/fonts/font.h>
#include <X11/fonts/fontstruct.h>
#include "dix/screen_hooks_priv.h"
#include "misc.h"
#include "pixmapstr.h"
#include "input.h"
#include <X11/fonts/font.h>
#include "mi.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "gcstruct.h"
#include "dixfontstr.h"
#include <X11/fonts/fontstruct.h>
#include "xf86.h"
#include "xf86str.h"
#include "shadowfb.h"
#include "picturestr.h"
static Bool ShadowCloseScreen(ScreenPtr pScreen);
static void ShadowCloseScreen(CallbackListPtr *, ScreenPtr pScreen, void *unused);
static Bool ShadowCreateRootWindow(WindowPtr pWin);
typedef struct {
ScrnInfoPtr pScrn;
RefreshAreaFuncPtr preRefresh;
RefreshAreaFuncPtr postRefresh;
CloseScreenProcPtr CloseScreen;
CreateWindowProcPtr CreateWindow;
} ShadowScreenRec, *ShadowScreenPtr;
@ -70,10 +69,9 @@ ShadowFBInit2(ScreenPtr pScreen,
pPriv->preRefresh = preRefreshArea;
pPriv->postRefresh = postRefreshArea;
pPriv->CloseScreen = pScreen->CloseScreen;
pPriv->CreateWindow = pScreen->CreateWindow;
dixScreenHookClose(pScreen, ShadowCloseScreen);
pScreen->CloseScreen = ShadowCloseScreen;
pPriv->CreateWindow = pScreen->CreateWindow;
pScreen->CreateWindow = ShadowCreateRootWindow;
return TRUE;
@ -158,14 +156,14 @@ ShadowCreateRootWindow(WindowPtr pWin)
return ret;
}
static Bool
ShadowCloseScreen(ScreenPtr pScreen)
static void ShadowCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
ShadowScreenPtr pPriv = shadowfbGetScreenPrivate(pScreen);
dixScreenUnhookClose(pScreen, ShadowCloseScreen);
pScreen->CloseScreen = pPriv->CloseScreen;
ShadowScreenPtr pPriv = shadowfbGetScreenPrivate(pScreen);
if (!pPriv)
return;
free(pPriv);
return (*pScreen->CloseScreen) (pScreen);
dixSetPrivate(&pScreen->devPrivates, &ShadowScreenKeyRec, NULL);
}

View File

@ -34,6 +34,7 @@
#include <X11/extensions/Xv.h>
#include "dix/screen_hooks_priv.h"
#include "Xext/xvdix_priv.h"
#include "glamor_priv.h"
@ -50,8 +51,6 @@ static DevPrivateKeyRec xwlXvScreenPrivateKeyRec;
typedef struct {
XvAdaptorPtr glxv_adaptor; /* We have only one adaptor, glamor Xv */
glamor_port_private *port_privates;
CloseScreenProcPtr CloseScreen;
} xwlXvScreenRec, *xwlXvScreenPtr;
typedef struct {
@ -374,23 +373,24 @@ failed:
return FALSE;
}
static Bool
xwl_glamor_xv_close_screen(ScreenPtr pScreen)
static void xwl_glamor_xv_close_screen(CallbackListPtr *pcbl,
ScreenPtr pScreen, void *unused)
{
xwlXvScreenPtr xwlXvScreen;
dixScreenUnhookClose(pScreen, xwl_glamor_xv_close_screen);
xwlXvScreenPtr xwlXvScreen;
xwlXvScreen = dixLookupPrivate(&(pScreen)->devPrivates,
xwlXvScreenPrivateKey);
if (!xwlXvScreen)
return;
if (xwlXvScreen->glxv_adaptor) {
XvFreeAdaptor(xwlXvScreen->glxv_adaptor);
free(xwlXvScreen->glxv_adaptor);
}
free(xwlXvScreen->port_privates);
pScreen->CloseScreen = xwlXvScreen->CloseScreen;
return pScreen->CloseScreen(pScreen);
dixSetPrivate(&(pScreen)->devPrivates, xwlXvScreenPrivateKey, NULL);
}
Bool
@ -407,8 +407,8 @@ xwl_glamor_xv_init(ScreenPtr pScreen)
xwlXvScreen->port_privates = NULL;
xwlXvScreen->glxv_adaptor = NULL;
xwlXvScreen->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xwl_glamor_xv_close_screen;
dixScreenHookClose(pScreen, xwl_glamor_xv_close_screen);
glamor_xv_core_init(pScreen);

View File

@ -40,6 +40,8 @@
#include "linux-dmabuf-unstable-v1-client-protocol.h"
#include "linux-drm-syncobj-v1-client-protocol.h"
#include "mi/mi_priv.h"
#include "xwayland-dmabuf.h"
#include "xwayland-glamor.h"
#include "xwayland-glamor-gbm.h"
@ -141,15 +143,9 @@ static Bool
xwl_glamor_create_screen_resources(ScreenPtr screen)
{
struct xwl_screen *xwl_screen = xwl_screen_get(screen);
int ret;
screen->CreateScreenResources = xwl_screen->CreateScreenResources;
ret = (*screen->CreateScreenResources) (screen);
xwl_screen->CreateScreenResources = screen->CreateScreenResources;
screen->CreateScreenResources = xwl_glamor_create_screen_resources;
if (!ret)
return ret;
if (!miCreateScreenResources(screen))
return FALSE;
if (xwl_screen->rootless) {
screen->devPrivate =
@ -254,7 +250,6 @@ xwl_glamor_init(struct xwl_screen *xwl_screen)
return FALSE;
}
xwl_screen->CreateScreenResources = screen->CreateScreenResources;
screen->CreateScreenResources = xwl_glamor_create_screen_resources;
#ifdef XV

View File

@ -39,6 +39,7 @@
#include "dix/input_priv.h"
#include "dix/property_priv.h"
#include "dix/screen_hooks_priv.h"
#include "os/client_priv.h"
#include "os/osdep.h"
#include "os/xserver_poll.h"
@ -234,8 +235,8 @@ xwl_root_window_finalized_callback(CallbackListPtr *pcbl,
DeleteCallback(&RootWindowFinalizeCallback, xwl_root_window_finalized_callback, screen);
}
Bool
xwl_close_screen(ScreenPtr screen)
static void xwl_close_screen(CallbackListPtr *pcbl,
ScreenPtr screen, void *unused)
{
struct xwl_screen *xwl_screen = xwl_screen_get(screen);
struct xwl_output *xwl_output, *next_xwl_output;
@ -244,6 +245,7 @@ xwl_close_screen(ScreenPtr screen)
#ifdef XWL_HAS_GLAMOR
xwl_dmabuf_feedback_destroy(&xwl_screen->default_feedback);
#endif
dixScreenUnhookClose(screen, xwl_close_screen);
DeleteCallback(&PropertyStateCallback, xwl_property_callback, screen);
XaceDeleteCallback(XACE_PROPERTY_ACCESS, xwl_access_property_callback, screen);
@ -274,11 +276,7 @@ xwl_close_screen(ScreenPtr screen)
wl_display_disconnect(xwl_screen->display);
screen->CloseScreen = xwl_screen->CloseScreen;
free(xwl_screen);
return screen->CloseScreen(screen);
}
static struct xwl_seat *
@ -1123,7 +1121,6 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
xwl_screen->present = xwl_present_init(pScreen);
if (!xwl_screen->glamor) {
xwl_screen->CreateScreenResources = pScreen->CreateScreenResources;
pScreen->CreateScreenResources = xwl_shm_create_screen_resources;
pScreen->CreatePixmap = xwl_shm_create_pixmap;
pScreen->DestroyPixmap = xwl_shm_destroy_pixmap;
@ -1135,11 +1132,8 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
xwl_screen->UnrealizeWindow = pScreen->UnrealizeWindow;
pScreen->UnrealizeWindow = xwl_unrealize_window;
xwl_screen->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = xwl_destroy_window;
xwl_screen->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = xwl_close_screen;
dixScreenHookWindowDestroy(pScreen, xwl_window_destroy);
dixScreenHookClose(pScreen, xwl_close_screen);
xwl_screen->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
pScreen->ChangeWindowAttributes = xwl_change_window_attributes;

View File

@ -69,12 +69,10 @@ struct xwl_screen {
int hidpi;
ClipNotifyProcPtr ClipNotify;
CreateScreenResourcesProcPtr CreateScreenResources;
CloseScreenProcPtr CloseScreen;
ConfigNotifyProcPtr ConfigNotify;
RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow;
DestroyWindowProcPtr DestroyWindow;
XYToWindowProcPtr XYToWindow;
SetWindowPixmapProcPtr SetWindowPixmap;
ChangeWindowAttributesProcPtr ChangeWindowAttributes;
@ -171,7 +169,6 @@ struct xwl_output *xwl_screen_get_fixed_or_first_output(struct xwl_screen *xwl_s
int xwl_screen_get_width(struct xwl_screen *xwl_screen);
int xwl_screen_get_height(struct xwl_screen *xwl_screen);
Bool xwl_close_screen(ScreenPtr screen);
Bool xwl_screen_init(ScreenPtr pScreen, int argc, char **argv);
void xwl_sync_events (struct xwl_screen *xwl_screen);
void xwl_screen_roundtrip (struct xwl_screen *xwl_screen);

View File

@ -36,6 +36,7 @@
#include <string.h>
#include <stdlib.h>
#include "mi/mi_priv.h"
#include "os/osdep.h"
#include "fb.h"
@ -351,15 +352,9 @@ Bool
xwl_shm_create_screen_resources(ScreenPtr screen)
{
struct xwl_screen *xwl_screen = xwl_screen_get(screen);
int ret;
screen->CreateScreenResources = xwl_screen->CreateScreenResources;
ret = (*screen->CreateScreenResources) (screen);
xwl_screen->CreateScreenResources = screen->CreateScreenResources;
screen->CreateScreenResources = xwl_shm_create_screen_resources;
if (!ret)
return ret;
if (!miCreateScreenResources(screen))
return FALSE;
if (xwl_screen->rootless)
screen->devPrivate =

View File

@ -1939,31 +1939,17 @@ xwl_window_create_frame_callback(struct xwl_window *xwl_window)
xwl_present_for_each_frame_callback(xwl_window, xwl_present_reset_timer);
}
Bool
xwl_destroy_window(WindowPtr window)
void
xwl_window_destroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr window)
{
ScreenPtr screen = window->drawable.pScreen;
struct xwl_screen *xwl_screen = xwl_screen_get(screen);
struct xwl_screen *xwl_screen = xwl_screen_get(pScreen);
struct xwl_window *xwl_window = xwl_window_get(window);
Bool ret;
if (xwl_screen->present)
xwl_present_cleanup(window);
if (xwl_window)
xwl_window_dispose(xwl_window);
screen->DestroyWindow = xwl_screen->DestroyWindow;
if (screen->DestroyWindow)
ret = screen->DestroyWindow (window);
else
ret = TRUE;
xwl_screen->DestroyWindow = screen->DestroyWindow;
screen->DestroyWindow = xwl_destroy_window;
return ret;
}
static Bool

View File

@ -146,7 +146,7 @@ void xwl_move_window(WindowPtr window,
int x, int y,
WindowPtr next_sib,
VTKind kind);
Bool xwl_destroy_window(WindowPtr window);
void xwl_window_destroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr window);
void xwl_window_post_damage(struct xwl_window *xwl_window);
void xwl_window_create_frame_callback(struct xwl_window *xwl_window);
void xwl_window_surface_do_destroy(struct xwl_wl_surface *xwl_wl_surface);

View File

@ -373,8 +373,6 @@ static __GLXdrawable *glxWinCreateDrawable(ClientPtr client,
int type,
XID glxDrawId, __GLXconfig * conf);
static Bool glxWinRealizeWindow(WindowPtr pWin);
static Bool glxWinUnrealizeWindow(WindowPtr pWin);
static void glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
RegionPtr prgnSrc);
static Bool glxWinSetPixelFormat(HDC hdc, int bppOverride, int drawableTypeOverride,
@ -704,11 +702,7 @@ glxWinScreenProbe(ScreenPtr pScreen)
// dump out fbConfigs now fbConfigIds and visualIDs have been assigned
fbConfigsDump(screen->base.numFBConfigs, screen->base.fbconfigs, &rejects);
/* Wrap RealizeWindow, UnrealizeWindow and CopyWindow on this screen */
screen->RealizeWindow = pScreen->RealizeWindow;
pScreen->RealizeWindow = glxWinRealizeWindow;
screen->UnrealizeWindow = pScreen->UnrealizeWindow;
pScreen->UnrealizeWindow = glxWinUnrealizeWindow;
/* Wrap CopyWindow on this screen */
screen->CopyWindow = pScreen->CopyWindow;
pScreen->CopyWindow = glxWinCopyWindow;
@ -730,23 +724,6 @@ glxWinScreenProbe(ScreenPtr pScreen)
* Window functions
*/
static Bool
glxWinRealizeWindow(WindowPtr pWin)
{
Bool result;
ScreenPtr pScreen = pWin->drawable.pScreen;
glxWinScreen *screenPriv = (glxWinScreen *) glxGetScreen(pScreen);
GLWIN_DEBUG_MSG("glxWinRealizeWindow");
/* Allow the window to be created (RootlessRealizeWindow is inside our wrap) */
pScreen->RealizeWindow = screenPriv->RealizeWindow;
result = pScreen->RealizeWindow(pWin);
pScreen->RealizeWindow = glxWinRealizeWindow;
return result;
}
static void
glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
@ -778,22 +755,6 @@ glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
pScreen->CopyWindow = glxWinCopyWindow;
}
static Bool
glxWinUnrealizeWindow(WindowPtr pWin)
{
Bool result;
ScreenPtr pScreen = pWin->drawable.pScreen;
glxWinScreen *screenPriv = (glxWinScreen *) glxGetScreen(pScreen);
GLWIN_DEBUG_MSG("glxWinUnrealizeWindow");
pScreen->UnrealizeWindow = screenPriv->UnrealizeWindow;
result = pScreen->UnrealizeWindow(pWin);
pScreen->UnrealizeWindow = glxWinUnrealizeWindow;
return result;
}
/* ---------------------------------------------------------------------- */
/*
* Drawable functions

View File

@ -72,8 +72,6 @@ struct __GLXWinScreen {
Bool has_WGL_ARB_framebuffer_sRGB;
/* wrapped screen functions */
RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow;
CopyWindowProcPtr CopyWindow;
};

View File

@ -291,8 +291,6 @@ typedef Bool (*winCreatePrimarySurfaceProcPtr) (ScreenPtr);
typedef Bool (*winReleasePrimarySurfaceProcPtr) (ScreenPtr);
typedef Bool (*winCreateScreenResourcesProc) (ScreenPtr);
/*
* Pixmap privates
*/
@ -485,7 +483,6 @@ typedef struct _winPrivScreenRec {
winInitVisualsProcPtr pwinInitVisuals;
winAdjustVideoModeProcPtr pwinAdjustVideoMode;
winCreateBoundingWindowProcPtr pwinCreateBoundingWindow;
winFinishScreenInitProcPtr pwinFinishScreenInit;
winBltExposedRegionsProcPtr pwinBltExposedRegions;
winBltExposedWindowRegionProcPtr pwinBltExposedWindowRegion;
winActivateAppProcPtr pwinActivateApp;
@ -497,26 +494,12 @@ typedef struct _winPrivScreenRec {
winDestroyColormapProcPtr pwinDestroyColormap;
winCreatePrimarySurfaceProcPtr pwinCreatePrimarySurface;
winReleasePrimarySurfaceProcPtr pwinReleasePrimarySurface;
winCreateScreenResourcesProc pwinCreateScreenResources;
/* Window Procedures for Rootless mode */
CreateWindowProcPtr CreateWindow;
DestroyWindowProcPtr DestroyWindow;
PositionWindowProcPtr PositionWindow;
ChangeWindowAttributesProcPtr ChangeWindowAttributes;
RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow;
ValidateTreeProcPtr ValidateTree;
PostValidateTreeProcPtr PostValidateTree;
CopyWindowProcPtr CopyWindow;
ClearToBackgroundProcPtr ClearToBackground;
ClipNotifyProcPtr ClipNotify;
RestackWindowProcPtr RestackWindow;
ReparentWindowProcPtr ReparentWindow;
ResizeWindowProcPtr ResizeWindow;
MoveWindowProcPtr MoveWindow;
SetShapeProcPtr SetShape;
ModifyPixmapHeaderProcPtr ModifyPixmapHeader;
winCursorRec cursor;
@ -831,9 +814,6 @@ void
Bool
winScreenInit(ScreenPtr pScreen, int argc, char **argv);
Bool
winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv);
/*
* winshadddnl.c
*/
@ -925,19 +905,9 @@ void
winReorderWindowsMultiWindow(void);
void
winResizeWindowMultiWindow(WindowPtr pWin, int x, int y, unsigned int w,
unsigned int h, WindowPtr pSib);
void
winMoveWindowMultiWindow(WindowPtr pWin, int x, int y,
WindowPtr pSib, VTKind kind);
void
winCopyWindowMultiWindow(WindowPtr pWin, DDXPointRec oldpt,
RegionPtr oldRegion);
PixmapPtr
winCreatePixmapMultiwindow(ScreenPtr pScreen, int width, int height, int depth,
unsigned usage_hint);

View File

@ -33,6 +33,8 @@
#include <xwin-config.h>
#endif
#include "mi/mi_priv.h"
#include "win.h"
/*
@ -50,9 +52,7 @@ winSetShapeMultiWindow(WindowPtr pWin, int kind)
ErrorF("winSetShapeMultiWindow - pWin: %p kind: %i\n", pWin, kind);
#endif
WIN_UNWRAP(SetShape);
(*pScreen->SetShape) (pWin, kind);
WIN_WRAP(SetShape, winSetShapeMultiWindow);
miSetShape(pWin, kind);
/* Update the Windows window's shape */
winReshapeMultiWindow(pWin);

View File

@ -36,6 +36,8 @@
#include <xwin-config.h>
#endif
#include "mi/mi_priv.h"
#include "win.h"
#include "dixevents.h"
#include "winmultiwindowclass.h"
@ -99,19 +101,13 @@ winInitMultiWindowClass(void)
Bool
winCreateWindowMultiWindow(WindowPtr pWin)
{
Bool fResult = TRUE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winWindowPriv(pWin);
winScreenPriv(pScreen);
#if ENABLE_DEBUG
winTrace("winCreateWindowMultiWindow - pWin: %p\n", pWin);
#endif
WIN_UNWRAP(CreateWindow);
fResult = (*pScreen->CreateWindow) (pWin);
WIN_WRAP(CreateWindow, winCreateWindowMultiWindow);
Bool fResult = fbCreateWindow(pWin);
/* Initialize some privates values */
pWinPriv->hRgn = NULL;
@ -132,19 +128,13 @@ winCreateWindowMultiWindow(WindowPtr pWin)
Bool
winDestroyWindowMultiWindow(WindowPtr pWin)
{
Bool fResult = TRUE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winWindowPriv(pWin);
winScreenPriv(pScreen);
#if ENABLE_DEBUG
ErrorF("winDestroyWindowMultiWindow - pWin: %p\n", pWin);
#endif
WIN_UNWRAP(DestroyWindow);
fResult = (*pScreen->DestroyWindow) (pWin);
WIN_WRAP(DestroyWindow, winDestroyWindowMultiWindow);
Bool fResult = fbDestroyWindow(pWin);
/* Flag that the window has been destroyed */
pWinPriv->fXKilled = TRUE;
@ -166,12 +156,9 @@ winDestroyWindowMultiWindow(WindowPtr pWin)
Bool
winPositionWindowMultiWindow(WindowPtr pWin, int x, int y)
{
Bool fResult = TRUE;
int iX, iY, iWidth, iHeight;
ScreenPtr pScreen = pWin->drawable.pScreen;
winWindowPriv(pWin);
winScreenPriv(pScreen);
HWND hWnd = pWinPriv->hWnd;
RECT rcNew;
@ -188,9 +175,7 @@ winPositionWindowMultiWindow(WindowPtr pWin, int x, int y)
winTrace("winPositionWindowMultiWindow - pWin: %p\n", pWin);
#endif
WIN_UNWRAP(PositionWindow);
fResult = (*pScreen->PositionWindow) (pWin, x, y);
WIN_WRAP(PositionWindow, winPositionWindowMultiWindow);
Bool fResult = fbPositionWindow(pWin, x, y);
#if ENABLE_DEBUG
ErrorF("winPositionWindowMultiWindow: (x, y) = (%d, %d)\n", x, y);
@ -282,18 +267,11 @@ winPositionWindowMultiWindow(WindowPtr pWin, int x, int y)
Bool
winChangeWindowAttributesMultiWindow(WindowPtr pWin, unsigned long mask)
{
Bool fResult = TRUE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if ENABLE_DEBUG
ErrorF("winChangeWindowAttributesMultiWindow - pWin: %p\n", pWin);
#endif
WIN_UNWRAP(ChangeWindowAttributes);
fResult = (*pScreen->ChangeWindowAttributes) (pWin, mask);
WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesMultiWindow);
Bool fResult = fbChangeWindowAttributes(pWin, mask);
/*
* NOTE: We do not currently need to do anything here.
@ -310,19 +288,13 @@ winChangeWindowAttributesMultiWindow(WindowPtr pWin, unsigned long mask)
Bool
winUnmapWindowMultiWindow(WindowPtr pWin)
{
Bool fResult = TRUE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winWindowPriv(pWin);
winScreenPriv(pScreen);
#if ENABLE_DEBUG
ErrorF("winUnmapWindowMultiWindow - pWin: %p\n", pWin);
#endif
WIN_UNWRAP(UnrealizeWindow);
fResult = (*pScreen->UnrealizeWindow) (pWin);
WIN_WRAP(UnrealizeWindow, winUnmapWindowMultiWindow);
Bool fResult = fbUnrealizeWindow(pWin);
/* Flag that the window has been killed */
pWinPriv->fXKilled = TRUE;
@ -341,19 +313,13 @@ winUnmapWindowMultiWindow(WindowPtr pWin)
Bool
winMapWindowMultiWindow(WindowPtr pWin)
{
Bool fResult = TRUE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winWindowPriv(pWin);
winScreenPriv(pScreen);
#if ENABLE_DEBUG
ErrorF("winMapWindowMultiWindow - pWin: %p\n", pWin);
#endif
WIN_UNWRAP(RealizeWindow);
fResult = (*pScreen->RealizeWindow) (pWin);
WIN_WRAP(RealizeWindow, winMapWindowMultiWindow);
Bool fResult = fbRealizeWindow(pWin);
/* Flag that this window has not been destroyed */
pWinPriv->fXKilled = FALSE;
@ -375,21 +341,12 @@ winMapWindowMultiWindow(WindowPtr pWin)
void
winReparentWindowMultiWindow(WindowPtr pWin, WindowPtr pPriorParent)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
winDebug
("winReparentMultiWindow - pWin:%p XID:0x%x, reparent from pWin:%p XID:0x%x to pWin:%p XID:0x%x\n",
pWin, (unsigned int)pWin->drawable.id,
pPriorParent, (unsigned int)pPriorParent->drawable.id,
pWin->parent, (unsigned int)pWin->parent->drawable.id);
WIN_UNWRAP(ReparentWindow);
if (pScreen->ReparentWindow)
(*pScreen->ReparentWindow) (pWin, pPriorParent);
WIN_WRAP(ReparentWindow, winReparentWindowMultiWindow);
/* Update the Windows window associated with this X window */
winUpdateWindowsWindow(pWin);
}
@ -407,19 +364,11 @@ winRestackWindowMultiWindow(WindowPtr pWin, WindowPtr pOldNextSib)
HWND hInsertAfter;
HWND hWnd = NULL;
#endif
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if ENABLE_DEBUG || ENABLE_DEBUG
winTrace("winRestackMultiWindow - %p\n", pWin);
#endif
WIN_UNWRAP(RestackWindow);
if (pScreen->RestackWindow)
(*pScreen->RestackWindow) (pWin, pOldNextSib);
WIN_WRAP(RestackWindow, winRestackWindowMultiWindow);
#if 1
/*
* Calling winReorderWindowsMultiWindow here means our window manager
@ -799,24 +748,6 @@ winReorderWindowsMultiWindow(void)
fRestacking = FALSE;
}
/*
* CopyWindow - See Porting Layer Definition - p. 39
*/
void
winCopyWindowMultiWindow(WindowPtr pWin, DDXPointRec oldpt, RegionPtr oldRegion)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if ENABLE_DEBUG
ErrorF("CopyWindowMultiWindow\n");
#endif
WIN_UNWRAP(CopyWindow);
(*pScreen->CopyWindow) (pWin, oldpt, oldRegion);
WIN_WRAP(CopyWindow, winCopyWindowMultiWindow);
}
/*
* MoveWindow - See Porting Layer Definition - p. 42
*/
@ -824,36 +755,11 @@ void
winMoveWindowMultiWindow(WindowPtr pWin, int x, int y,
WindowPtr pSib, VTKind kind)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if ENABLE_DEBUG
ErrorF("MoveWindowMultiWindow to (%d, %d)\n", x, y);
#endif
WIN_UNWRAP(MoveWindow);
(*pScreen->MoveWindow) (pWin, x, y, pSib, kind);
WIN_WRAP(MoveWindow, winMoveWindowMultiWindow);
}
/*
* ResizeWindow - See Porting Layer Definition - p. 42
*/
void
winResizeWindowMultiWindow(WindowPtr pWin, int x, int y, unsigned int w,
unsigned int h, WindowPtr pSib)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if ENABLE_DEBUG
ErrorF("ResizeWindowMultiWindow to (%d, %d) - %dx%d\n", x, y, w, h);
#endif
WIN_UNWRAP(ResizeWindow);
(*pScreen->ResizeWindow) (pWin, x, y, w, h, pSib);
WIN_WRAP(ResizeWindow, winResizeWindowMultiWindow);
miMoveWindow(pWin, x, y, pSib, kind);
}
/*
@ -1153,7 +1059,6 @@ winModifyPixmapHeaderMultiwindow(PixmapPtr pPixmap,
{
int i;
winPrivPixmapPtr pPixmapPriv = winGetPixmapPriv(pPixmap);
Bool fResult;
/* reinitialize everything */
pPixmap->drawable.depth = depth;
@ -1204,13 +1109,5 @@ winModifyPixmapHeaderMultiwindow(PixmapPtr pPixmap,
winDebug("winModifyPixmapHeaderMultiwindow: falling back\n");
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
winScreenPriv(pScreen);
WIN_UNWRAP(ModifyPixmapHeader);
fResult = (*pScreen->ModifyPixmapHeader) (pPixmap, width, height, depth, bitsPerPixel, devKind, pPixData);
WIN_WRAP(ModifyPixmapHeader, winModifyPixmapHeaderMultiwindow);
}
return fResult;
return miModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel, devKind, pPixData);
}

View File

@ -35,9 +35,14 @@
#ifdef HAVE_XWIN_CONFIG_H
#include <xwin-config.h>
#endif
#include "mi/mi_priv.h"
#include "win.h"
#include "winmsg.h"
static Bool winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv);
/*
* Determine what type of screen we are initializing
* and call the appropriate procedure to initialize
@ -165,9 +170,8 @@ winScreenInit(ScreenPtr pScreen, int argc, char **argv)
/* Clear the visuals list */
miClearVisualTypes();
/* Call the engine dependent screen initialization procedure */
if (!((*pScreenPriv->pwinFinishScreenInit) (pScreen->myNum, pScreen, argc, argv))) {
ErrorF("winScreenInit - winFinishScreenInit () failed\n");
if (!winFinishScreenInitFB(pScreen->myNum, pScreen, argc, argv)) {
ErrorF("%s(): winFinishScreenInitFB () failed\n", __FUNCTION__);
/* call the engine dependent screen close procedure to clean up from a failure */
pScreenPriv->pwinCloseScreen(pScreen);
@ -205,9 +209,8 @@ static Bool
winCreateScreenResources(ScreenPtr pScreen)
{
winScreenPriv(pScreen);
Bool result;
result = pScreenPriv->pwinCreateScreenResources(pScreen);
Bool result = miCreateScreenResources(pScreen);
/* Now the screen bitmap has been wrapped in a pixmap,
add that to the Shadow framebuffer */
@ -221,7 +224,7 @@ winCreateScreenResources(ScreenPtr pScreen)
}
/* See Porting Layer Definition - p. 20 */
Bool
static Bool
winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv)
{
winScreenPriv(pScreen);
@ -361,7 +364,6 @@ winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv)
/* Wrap CreateScreenResources so we can add the screen pixmap
to the Shadow framebuffer after it's been created */
pScreenPriv->pwinCreateScreenResources = pScreen->CreateScreenResources;
pScreen->CreateScreenResources = winCreateScreenResources;
}
@ -376,15 +378,6 @@ winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv)
pScreenPriv->a = NULL; \
}
/* Save a pointer to each lower-level window procedure */
WRAP(CreateWindow);
WRAP(DestroyWindow);
WRAP(RealizeWindow);
WRAP(UnrealizeWindow);
WRAP(PositionWindow);
WRAP(ChangeWindowAttributes);
WRAP(SetShape);
/* Assign rootless window procedures to be top level procedures */
pScreen->CreateWindow = winCreateWindowRootless;
pScreen->DestroyWindow = winDestroyWindowRootless;
@ -409,21 +402,6 @@ winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv)
pScreenPriv->a = NULL; \
}
/* Save a pointer to each lower-level window procedure */
WRAP(CreateWindow);
WRAP(DestroyWindow);
WRAP(RealizeWindow);
WRAP(UnrealizeWindow);
WRAP(PositionWindow);
WRAP(ChangeWindowAttributes);
WRAP(ReparentWindow);
WRAP(RestackWindow);
WRAP(ResizeWindow);
WRAP(MoveWindow);
WRAP(CopyWindow);
WRAP(SetShape);
WRAP(ModifyPixmapHeader);
/* Assign multi-window window procedures to be top level procedures */
pScreen->CreateWindow = winCreateWindowMultiWindow;
pScreen->DestroyWindow = winDestroyWindowMultiWindow;
@ -433,9 +411,7 @@ winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv)
pScreen->UnrealizeWindow = winUnmapWindowMultiWindow;
pScreen->ReparentWindow = winReparentWindowMultiWindow;
pScreen->RestackWindow = winRestackWindowMultiWindow;
pScreen->ResizeWindow = winResizeWindowMultiWindow;
pScreen->MoveWindow = winMoveWindowMultiWindow;
pScreen->CopyWindow = winCopyWindowMultiWindow;
pScreen->SetShape = winSetShapeMultiWindow;
if (pScreenInfo->fCompositeWM) {

View File

@ -1193,7 +1193,6 @@ winSetEngineFunctionsShadowDDNL(ScreenPtr pScreen)
winCreateBoundingWindowFullScreen;
else
pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDDNL;
pScreenPriv->pwinBltExposedWindowRegion = NULL;
pScreenPriv->pwinActivateApp = winActivateAppShadowDDNL;

View File

@ -1265,7 +1265,6 @@ winSetEngineFunctionsShadowGDI(ScreenPtr pScreen)
winCreateBoundingWindowFullScreen;
else
pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed;
pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB;
pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowGDI;
pScreenPriv->pwinBltExposedWindowRegion = winBltExposedWindowRegionShadowGDI;
pScreenPriv->pwinActivateApp = winActivateAppShadowGDI;

View File

@ -32,8 +32,13 @@
#ifdef HAVE_XWIN_CONFIG_H
#include <xwin-config.h>
#endif
#include "mi/mi_priv.h"
#include "win.h"
#include "mi/mi_priv.h"
/*
* Prototypes for local functions
*/
@ -56,18 +61,14 @@ Bool
winCreateWindowRootless(WindowPtr pWin)
{
Bool fResult = FALSE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winWindowPriv(pWin);
winScreenPriv(pScreen);
#if ENABLE_DEBUG
winTrace("winCreateWindowRootless (%p)\n", pWin);
#endif
WIN_UNWRAP(CreateWindow);
fResult = (*pScreen->CreateWindow) (pWin);
WIN_WRAP(CreateWindow, winCreateWindowRootless);
fResult = fbCreateWindow(pWin);
pWinPriv->hRgn = NULL;
@ -80,19 +81,13 @@ winCreateWindowRootless(WindowPtr pWin)
Bool
winDestroyWindowRootless(WindowPtr pWin)
{
Bool fResult = FALSE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winWindowPriv(pWin);
winScreenPriv(pScreen);
#if ENABLE_DEBUG
winTrace("winDestroyWindowRootless (%p)\n", pWin);
#endif
WIN_UNWRAP(DestroyWindow);
fResult = (*pScreen->DestroyWindow) (pWin);
WIN_WRAP(DestroyWindow, winDestroyWindowRootless);
Bool fResult = fbDestroyWindow(pWin);
if (pWinPriv->hRgn != NULL) {
DeleteObject(pWinPriv->hRgn);
@ -110,18 +105,11 @@ winDestroyWindowRootless(WindowPtr pWin)
Bool
winPositionWindowRootless(WindowPtr pWin, int x, int y)
{
Bool fResult = FALSE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if ENABLE_DEBUG
winTrace("winPositionWindowRootless (%p)\n", pWin);
#endif
WIN_UNWRAP(PositionWindow);
fResult = (*pScreen->PositionWindow) (pWin, x, y);
WIN_WRAP(PositionWindow, winPositionWindowRootless);
Bool fResult = fbPositionWindow(pWin, x, y);
winUpdateRgnRootless(pWin);
@ -134,18 +122,11 @@ winPositionWindowRootless(WindowPtr pWin, int x, int y)
Bool
winChangeWindowAttributesRootless(WindowPtr pWin, unsigned long mask)
{
Bool fResult = FALSE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if ENABLE_DEBUG
winTrace("winChangeWindowAttributesRootless (%p)\n", pWin);
#endif
WIN_UNWRAP(ChangeWindowAttributes);
fResult = (*pScreen->ChangeWindowAttributes) (pWin, mask);
WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesRootless);
Bool fResult = fbChangeWindowAttributes(pWin, mask);
winUpdateRgnRootless(pWin);
@ -159,19 +140,13 @@ winChangeWindowAttributesRootless(WindowPtr pWin, unsigned long mask)
Bool
winUnmapWindowRootless(WindowPtr pWin)
{
Bool fResult = FALSE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winWindowPriv(pWin);
winScreenPriv(pScreen);
#if ENABLE_DEBUG
winTrace("winUnmapWindowRootless (%p)\n", pWin);
#endif
WIN_UNWRAP(UnrealizeWindow);
fResult = (*pScreen->UnrealizeWindow) (pWin);
WIN_WRAP(UnrealizeWindow, winUnmapWindowRootless);
Bool fResult = fbUnrealizeWindow(pWin);
if (pWinPriv->hRgn != NULL) {
DeleteObject(pWinPriv->hRgn);
@ -190,18 +165,11 @@ winUnmapWindowRootless(WindowPtr pWin)
Bool
winMapWindowRootless(WindowPtr pWin)
{
Bool fResult = FALSE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if ENABLE_DEBUG
winTrace("winMapWindowRootless (%p)\n", pWin);
#endif
WIN_UNWRAP(RealizeWindow);
fResult = (*pScreen->RealizeWindow) (pWin);
WIN_WRAP(RealizeWindow, winMapWindowRootless);
Bool fResult = fbRealizeWindow(pWin);
winReshapeRootless(pWin);
@ -213,17 +181,11 @@ winMapWindowRootless(WindowPtr pWin)
void
winSetShapeRootless(WindowPtr pWin, int kind)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if ENABLE_DEBUG
winTrace("winSetShapeRootless (%p, %i)\n", pWin, kind);
#endif
WIN_UNWRAP(SetShape);
(*pScreen->SetShape) (pWin, kind);
WIN_WRAP(SetShape, winSetShapeRootless);
miSetShape(pWin, kind);
winReshapeRootless(pWin);
winUpdateRgnRootless(pWin);

View File

@ -490,8 +490,17 @@ typedef void (*DPMSProcPtr)(ScreenPtr pScreen, int level);
required. Unwrap occurs at the top of each function, just after
entry, and Wrap occurs at the bottom of each function, just
before returning.
DestroyWindow() should NOT be wrapped anymore
use dixScreenHookWindowDestroy() instead.
*/
#define _SCREEN_HOOK_TYPE(NAME, FUNCTYPE, ARRSIZE) \
struct { \
FUNCTYPE func; \
void *arg; \
} NAME[ARRSIZE];
typedef struct _Screen {
int myNum; /* index of this instance in Screens[] */
ATOM id;
@ -658,6 +667,26 @@ typedef struct _Screen {
ReplaceScanoutPixmapProcPtr ReplaceScanoutPixmap;
XYToWindowProcPtr XYToWindow;
DPMSProcPtr DPMS;
/* additional window destructors (replaces wrapping DestroyWindow).
should NOT be touched outside of DIX core */
CallbackListPtr hookWindowDestroy;
/* additional window position notify hooks (replaces wrapping PositionWindow)
should NOT be touched outside of DIX core */
CallbackListPtr hookWindowPosition;
/* additional screen close notify hooks (replaces wrapping CloseScreen)
should NOT be touched outside of DIX core */
CallbackListPtr hookClose;
/* additional pixmap destroy notify hooks (replaces wrapping DestroyPixmap)
should NOT be touched outside of DIX core */
CallbackListPtr hookPixmapDestroy;
/* hooks run right after SUCCESSFUL CreateScreenResources
should NOT be touched outside of DIX core */
CallbackListPtr hookPostCreateResources;
} ScreenRec;
static inline RegionPtr

View File

@ -214,4 +214,10 @@
/* byte order */
#mesondefine X_BYTE_ORDER
/* announce server API features */
#define XORG_API_DIX_SCREEN_HOOK_WINDOW_DESTROY 1
#define XORG_API_DIX_SCREEN_HOOK_WINDOW_POSITION 1
#define XORG_API_DIX_SCREEN_HOOK_CLOSE 1
#define XORG_API_DIX_SCREEN_HOOK_PIXMAP_DESTROY 1
#endif /* _XORG_SERVER_H_ */

View File

@ -53,7 +53,10 @@ void miWindowExposures(WindowPtr pWin, RegionPtr prgn);
void miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what);
void miSourceValidate(DrawablePtr pDrawable, int x, int y, int w, int h,
unsigned int subWindowMode);
Bool miCreateScreenResources(ScreenPtr pScreen);
/* only exported for modesetting, not for external drivers (yet) */
_X_EXPORT Bool miCreateScreenResources(ScreenPtr pScreen);
int miShapedWindowIn(RegionPtr universe, RegionPtr bounding, BoxPtr rect,
int x, int y);
int miValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind);

View File

@ -35,6 +35,7 @@ in this Software without prior written authorization from The Open Group.
#include "dix/dix_priv.h"
#include "dix/gc_priv.h"
#include "dix/screen_hooks_priv.h"
#include "misc.h"
#include "input.h"
@ -59,7 +60,7 @@ static DevScreenPrivateKeyRec miDCDeviceKeyRec;
#define miDCDeviceKey (&miDCDeviceKeyRec)
static Bool miDCCloseScreen(ScreenPtr pScreen);
static void miDCCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused);
/* per device private data */
typedef struct {
@ -79,7 +80,6 @@ typedef struct {
* in the pCursorBuffers array.
*/
typedef struct {
CloseScreenProcPtr CloseScreen;
PixmapPtr sourceBits; /* source bits */
PixmapPtr maskBits; /* mask bits */
PicturePtr pPicture;
@ -102,9 +102,7 @@ miDCInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
if (!pScreenPriv)
return FALSE;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = miDCCloseScreen;
dixScreenHookClose(pScreen, miDCCloseScreen);
dixSetPrivate(&pScreen->devPrivates, miDCScreenKey, pScreenPriv);
if (!miSpriteInitialize(pScreen, screenFuncs)) {
@ -118,6 +116,8 @@ static void
miDCSwitchScreenCursor(ScreenPtr pScreen, CursorPtr pCursor, PixmapPtr sourceBits, PixmapPtr maskBits, PicturePtr pPicture)
{
miDCScreenPtr pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey);
if (!pScreenPriv)
return;
dixDestroyPixmap(pScreenPriv->sourceBits, 0);
pScreenPriv->sourceBits = sourceBits;
@ -133,18 +133,16 @@ miDCSwitchScreenCursor(ScreenPtr pScreen, CursorPtr pCursor, PixmapPtr sourceBit
pScreenPriv->pCursor = pCursor;
}
static Bool
miDCCloseScreen(ScreenPtr pScreen)
static void miDCCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
miDCScreenPtr pScreenPriv;
dixScreenUnhookClose(pScreen, miDCCloseScreen);
miDCScreenPtr pScreenPriv;
pScreenPriv = (miDCScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
miDCSwitchScreenCursor(pScreen, NULL, NULL, NULL, NULL);
free((void *) pScreenPriv);
return (*pScreen->CloseScreen) (pScreen);
dixSetPrivate(&pScreen->devPrivates, miDCScreenKey, NULL); /* clear it, just for sure */
}
Bool

View File

@ -2,12 +2,14 @@
#include <dix-config.h>
#include <X11/X.h>
#include <X11/Xmd.h>
#include <X11/extensions/shapeproto.h>
#include "dix/cursor_priv.h"
#include "dix/screen_hooks_priv.h"
#include "mi/mi_priv.h"
#include "scrnintstr.h"
#include <X11/extensions/shapeproto.h>
#include "validate.h"
#include "windowstr.h"
#include "gcstruct.h"
@ -44,7 +46,6 @@ typedef struct {
} miOverlayWindowRec, *miOverlayWindowPtr;
typedef struct {
CloseScreenProcPtr CloseScreen;
CreateWindowProcPtr CreateWindow;
DestroyWindowProcPtr DestroyWindow;
UnrealizeWindowProcPtr UnrealizeWindow;
@ -67,7 +68,7 @@ static Bool HasUnderlayChildren(WindowPtr);
static void MarkUnderlayWindow(WindowPtr);
static Bool CollectUnderlayChildrenRegions(WindowPtr, RegionPtr);
static Bool miOverlayCloseScreen(ScreenPtr);
static void miOverlayCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused);
static Bool miOverlayCreateWindow(WindowPtr);
static Bool miOverlayDestroyWindow(WindowPtr);
static Bool miOverlayUnrealizeWindow(WindowPtr);
@ -126,18 +127,17 @@ miInitOverlay(ScreenPtr pScreen,
return FALSE;
dixSetPrivate(&pScreen->devPrivates, miOverlayScreenKey, pScreenPriv);
dixScreenHookClose(pScreen, miOverlayCloseScreen);
pScreenPriv->InOverlay = inOverlayFunc;
pScreenPriv->MakeTransparent = transFunc;
pScreenPriv->underlayMarked = FALSE;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreenPriv->CreateWindow = pScreen->CreateWindow;
pScreenPriv->DestroyWindow = pScreen->DestroyWindow;
pScreenPriv->UnrealizeWindow = pScreen->UnrealizeWindow;
pScreenPriv->RealizeWindow = pScreen->RealizeWindow;
pScreen->CloseScreen = miOverlayCloseScreen;
pScreen->CreateWindow = miOverlayCreateWindow;
pScreen->DestroyWindow = miOverlayDestroyWindow;
pScreen->UnrealizeWindow = miOverlayUnrealizeWindow;
@ -160,20 +160,21 @@ miInitOverlay(ScreenPtr pScreen,
return TRUE;
}
static Bool
miOverlayCloseScreen(ScreenPtr pScreen)
static void miOverlayCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
dixScreenUnhookClose(pScreen, miOverlayCloseScreen);
miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
if (!pScreenPriv)
return;
pScreen->CloseScreen = pScreenPriv->CloseScreen;
pScreen->CreateWindow = pScreenPriv->CreateWindow;
pScreen->DestroyWindow = pScreenPriv->DestroyWindow;
pScreen->UnrealizeWindow = pScreenPriv->UnrealizeWindow;
pScreen->RealizeWindow = pScreenPriv->RealizeWindow;
free(pScreenPriv);
return (*pScreen->CloseScreen) (pScreen);
dixSetPrivate(&pScreen->devPrivates, miOverlayScreenKey, NULL);
}
static Bool

View File

@ -55,6 +55,7 @@ in this Software without prior written authorization from The Open Group.
#include "dix/cursor_priv.h"
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "dix/screen_hooks_priv.h"
#include "mi/mi_priv.h"
#include "mi/mipointer_priv.h"
@ -107,7 +108,7 @@ static void miPointerCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen,
BoxPtr pTopLeftBox);
static Bool miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen,
int x, int y, Bool generateEvent);
static Bool miPointerCloseScreen(ScreenPtr pScreen);
static void miPointerCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused);
static void miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y);
static Bool miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
static void miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
@ -140,8 +141,7 @@ miPointerInitialize(ScreenPtr pScreen,
pScreenPriv->screenFuncs = screenFuncs;
pScreenPriv->waitForUpdate = waitForUpdate;
pScreenPriv->showTransparent = FALSE;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = miPointerCloseScreen;
dixScreenHookClose(pScreen, miPointerCloseScreen);
dixSetPrivate(&pScreen->devPrivates, miPointerScreenKey, pScreenPriv);
/*
* set up screen cursor method table
@ -163,19 +163,17 @@ miPointerInitialize(ScreenPtr pScreen,
/**
* Destroy screen-specific information.
*
* @param index Screen index of the screen in screenInfo.screens[]
* @param pScreen The actual screen pointer
*/
static Bool
miPointerCloseScreen(ScreenPtr pScreen)
static void miPointerCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
SetupScreen(pScreen);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
dixScreenUnhookClose(pScreen, miPointerCloseScreen);
free((void *) pScreenPriv);
dixSetPrivate(&pScreen->devPrivates, miPointerScreenKey, NULL);
FreeEventList(mipointermove_events, GetMaximumEventsNum());
mipointermove_events = NULL;
return (*pScreen->CloseScreen) (pScreen);
}
/*

View File

@ -38,6 +38,7 @@ in this Software without prior written authorization from The Open Group.
#include "dix/colormap_priv.h"
#include "dix/dix_priv.h"
#include "dix/screen_hooks_priv.h"
#include "mi/mipointer_priv.h"
#include "misc.h"
@ -72,7 +73,6 @@ typedef struct {
typedef struct {
/* screen procedures */
CloseScreenProcPtr CloseScreen;
SourceValidateProcPtr SourceValidate;
/* window procedures */
@ -190,7 +190,7 @@ miSpriteIsDown(miCursorInfoPtr pDevCursor)
* screen wrappers
*/
static Bool miSpriteCloseScreen(ScreenPtr pScreen);
static void miSpriteCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused);
static void miSpriteSourceValidate(DrawablePtr pDrawable, int x, int y,
int width, int height,
unsigned int subWindowMode);
@ -309,7 +309,6 @@ miSpriteInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
for (pVisual = pScreen->visuals;
pVisual->vid != pScreen->rootVisual; pVisual++);
pScreenPriv->pVisual = pVisual;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreenPriv->SourceValidate = pScreen->SourceValidate;
pScreenPriv->CopyWindow = pScreen->CopyWindow;
@ -332,7 +331,7 @@ miSpriteInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
dixSetPrivate(&pScreen->devPrivates, &miSpriteScreenKeyRec, pScreenPriv);
pScreen->CloseScreen = miSpriteCloseScreen;
dixScreenHookClose(pScreen, miSpriteCloseScreen);
pScreen->SourceValidate = miSpriteSourceValidate;
pScreen->CopyWindow = miSpriteCopyWindow;
@ -346,26 +345,22 @@ miSpriteInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
* Screen wrappers
*/
/*
* CloseScreen wrapper -- unwrap everything, free the private data
* and call the wrapped function
*/
static Bool
miSpriteCloseScreen(ScreenPtr pScreen)
static void miSpriteCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
miSpriteScreenPtr pScreenPriv = GetSpriteScreen(pScreen);
dixScreenUnhookClose(pScreen, miSpriteCloseScreen);
miSpriteScreenPtr pScreenPriv = GetSpriteScreen(pScreen);
if (!pScreenPriv)
return;
pScreen->CloseScreen = pScreenPriv->CloseScreen;
pScreen->SourceValidate = pScreenPriv->SourceValidate;
pScreen->InstallColormap = pScreenPriv->InstallColormap;
pScreen->StoreColors = pScreenPriv->StoreColors;
DamageDestroy(pScreenPriv->pDamage);
dixSetPrivate(&pScreen->devPrivates, &miSpriteScreenKeyRec, NULL);
free(pScreenPriv);
return (*pScreen->CloseScreen) (pScreen);
}
static void

View File

@ -50,6 +50,7 @@ SOFTWARE.
#include <X11/extensions/shapeconst.h>
#include "dix/cursor_priv.h"
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "mi/mi_priv.h"
@ -276,7 +277,7 @@ miMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pNextSib, VTKind kind)
SetWinSize(pWin);
SetBorderSize(pWin);
(*pScreen->PositionWindow) (pWin, x, y);
dixScreenRaiseWindowPosition(pWin, x, y);
windowToValidate = MoveWindowInStack(pWin, pNextSib);
@ -446,7 +447,7 @@ miResizeWindow(WindowPtr pWin, int x, int y, unsigned int w, unsigned int h,
ResizeChildrenWinSize(pWin, x - oldx, y - oldy, dw, dh);
/* let the hardware adjust background and border pixmaps, if any */
(*pScreen->PositionWindow) (pWin, x, y);
dixScreenRaiseWindowPosition(pWin, x, y);
pFirstChange = MoveWindowInStack(pWin, pSib);

View File

@ -24,6 +24,7 @@
#include <stdlib.h>
#include "dix/screen_hooks_priv.h"
#include "os/osdep.h"
#include <X11/X.h>
@ -1484,28 +1485,16 @@ damageInsertDamage(DamagePtr * pPrev, DamagePtr pDamage)
*pPrev = pDamage;
}
static Bool
damageDestroyPixmap(PixmapPtr pPixmap)
static void damagePixmapDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
{
ScreenPtr pScreen = pPixmap->drawable.pScreen;
DamagePtr *pPrev = getPixmapDamageRef(pPixmap);
DamagePtr pDamage;
damageScrPriv(pScreen);
if (pPixmap->refcnt == 1) {
DamagePtr *pPrev = getPixmapDamageRef(pPixmap);
DamagePtr pDamage;
while ((pDamage = *pPrev)) {
damageRemoveDamage(pPrev, pDamage);
if (!pDamage->isWindow)
DamageDestroy(pDamage);
}
while ((pDamage = *pPrev)) {
damageRemoveDamage(pPrev, pDamage);
if (!pDamage->isWindow)
DamageDestroy(pDamage);
}
unwrap(pScrPriv, pScreen, DestroyPixmap);
if (pScreen->DestroyPixmap)
pScreen->DestroyPixmap(pPixmap);
wrap(pScrPriv, pScreen, DestroyPixmap, damageDestroyPixmap);
return TRUE;
}
static void
@ -1576,35 +1565,31 @@ damageSetWindowPixmap(WindowPtr pWindow, PixmapPtr pPixmap)
}
}
static Bool
damageDestroyWindow(WindowPtr pWindow)
static void
damageWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWindow)
{
DamagePtr pDamage;
ScreenPtr pScreen = pWindow->drawable.pScreen;
Bool ret;
damageScrPriv(pScreen);
while ((pDamage = damageGetWinPriv(pWindow))) {
DamageDestroy(pDamage);
}
unwrap(pScrPriv, pScreen, DestroyWindow);
ret = (*pScreen->DestroyWindow) (pWindow);
wrap(pScrPriv, pScreen, DestroyWindow, damageDestroyWindow);
return ret;
}
static Bool
damageCloseScreen(ScreenPtr pScreen)
static void damageCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
damageScrPriv(pScreen);
dixScreenUnhookClose(pScreen, damageCloseScreen);
dixScreenUnhookWindowDestroy(pScreen, damageWindowDestroy);
dixScreenUnhookPixmapDestroy(pScreen, damagePixmapDestroy);
damageScrPriv(pScreen);
if (!pScrPriv)
return;
unwrap(pScrPriv, pScreen, DestroyPixmap);
unwrap(pScrPriv, pScreen, CreateGC);
unwrap(pScrPriv, pScreen, CopyWindow);
unwrap(pScrPriv, pScreen, CloseScreen);
dixSetPrivate(&pScreen->devPrivates, damageScrPrivateKey, NULL);
free(pScrPriv);
return (*pScreen->CloseScreen) (pScreen);
}
/**
@ -1691,12 +1676,13 @@ DamageSetup(ScreenPtr pScreen)
pScrPriv->internalLevel = 0;
pScrPriv->pScreenDamage = 0;
wrap(pScrPriv, pScreen, DestroyPixmap, damageDestroyPixmap);
dixScreenHookClose(pScreen, damageCloseScreen);
dixScreenHookWindowDestroy(pScreen, damageWindowDestroy);
dixScreenHookPixmapDestroy(pScreen, damagePixmapDestroy);
wrap(pScrPriv, pScreen, CreateGC, damageCreateGC);
wrap(pScrPriv, pScreen, DestroyWindow, damageDestroyWindow);
wrap(pScrPriv, pScreen, SetWindowPixmap, damageSetWindowPixmap);
wrap(pScrPriv, pScreen, CopyWindow, damageCopyWindow);
wrap(pScrPriv, pScreen, CloseScreen, damageCloseScreen);
if (ps) {
wrap(pScrPriv, ps, Glyphs, damageGlyphs);
wrap(pScrPriv, ps, Composite, damageComposite);

View File

@ -61,11 +61,8 @@ typedef struct _damageScrPriv {
DamagePtr pScreenDamage;
CopyWindowProcPtr CopyWindow;
CloseScreenProcPtr CloseScreen;
CreateGCProcPtr CreateGC;
DestroyPixmapProcPtr DestroyPixmap;
SetWindowPixmapProcPtr SetWindowPixmap;
DestroyWindowProcPtr DestroyWindow;
CompositeProcPtr Composite;
GlyphsProcPtr Glyphs;
AddTrapsProcPtr AddTraps;

View File

@ -80,11 +80,7 @@ typedef struct _RootlessScreenRec {
RootlessFrameProcsPtr imp;
// Wrapped screen functions
CreateScreenResourcesProcPtr CreateScreenResources;
CloseScreenProcPtr CloseScreen;
CreateWindowProcPtr CreateWindow;
DestroyWindowProcPtr DestroyWindow;
RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow;
MoveWindowProcPtr MoveWindow;
@ -92,7 +88,6 @@ typedef struct _RootlessScreenRec {
RestackWindowProcPtr RestackWindow;
ReparentWindowProcPtr ReparentWindow;
ChangeBorderWidthProcPtr ChangeBorderWidth;
PositionWindowProcPtr PositionWindow;
ChangeWindowAttributesProcPtr ChangeWindowAttributes;
PaintWindowProcPtr PaintWindow;

View File

@ -37,6 +37,7 @@
#include <string.h>
#include "dix/colormap_priv.h"
#include "dix/screen_hooks_priv.h"
#include "mi/mi_priv.h"
#include "scrnintstr.h"
@ -110,37 +111,19 @@ RootlessUpdateScreenPixmap(ScreenPtr pScreen)
* Rootless implementations typically set a null framebuffer pointer, which
* causes problems with miCreateScreenResources. We fix things up here.
*/
static Bool
RootlessCreateScreenResources(ScreenPtr pScreen)
static void RootlessCreateScreenResources(CallbackListPtr *pcbl,
ScreenPtr pScreen, Bool *ret)
{
Bool ret = TRUE;
SCREEN_UNWRAP(pScreen, CreateScreenResources);
if (pScreen->CreateScreenResources != NULL)
ret = (*pScreen->CreateScreenResources) (pScreen);
SCREEN_WRAP(pScreen, CreateScreenResources);
if (!ret)
return ret;
/* Make sure we have a valid screen pixmap. */
RootlessUpdateScreenPixmap(pScreen);
return ret;
}
static Bool
RootlessCloseScreen(ScreenPtr pScreen)
static void RootlessCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
RootlessScreenRec *s;
dixScreenUnhookClose(pScreen, RootlessCloseScreen);
dixScreenUnhookPostCreateResources(pScreen, RootlessCreateScreenResources);
s = SCREENREC(pScreen);
// fixme unwrap everything that was wrapped?
pScreen->CloseScreen = s->CloseScreen;
RootlessScreenRec *s = SCREENREC(pScreen);
if (s->pixmap_data != NULL) {
free(s->pixmap_data);
@ -149,7 +132,7 @@ RootlessCloseScreen(ScreenPtr pScreen)
}
free(s);
return pScreen->CloseScreen(pScreen);
dixSetPrivate(&(pScreen)->devPrivates, rootlessScreenPrivateKey, NULL);
}
static void
@ -649,6 +632,11 @@ RootlessWrap(ScreenPtr pScreen)
{
RootlessScreenRec *s = SCREENREC(pScreen);
dixScreenHookClose(pScreen, RootlessCloseScreen);
dixScreenHookWindowDestroy(pScreen, RootlessWindowDestroy);
dixScreenHookWindowPosition(pScreen, RootlessWindowPosition);
dixScreenHookPostCreateResources(pScreen, RootlessCreateScreenResources);
#define WRAP(a) \
if (pScreen->a) { \
s->a = pScreen->a; \
@ -658,19 +646,15 @@ RootlessWrap(ScreenPtr pScreen)
} \
pScreen->a = Rootless##a
WRAP(CreateScreenResources);
WRAP(CloseScreen);
WRAP(CreateGC);
WRAP(CopyWindow);
WRAP(PaintWindow);
WRAP(GetImage);
WRAP(SourceValidate);
WRAP(CreateWindow);
WRAP(DestroyWindow);
WRAP(RealizeWindow);
WRAP(UnrealizeWindow);
WRAP(MoveWindow);
WRAP(PositionWindow);
WRAP(ResizeWindow);
WRAP(RestackWindow);
WRAP(ReparentWindow);

View File

@ -36,8 +36,9 @@
#include <assert.h>
#include <X11/Xatom.h>
#include "dix/dix_priv.h"
#include "dix/screen_hooks_priv.h"
#include "mi/mi_priv.h"
#include "dix_priv.h"
#ifdef __APPLE__
#include <Xplugin.h>
@ -189,24 +190,14 @@ RootlessDestroyFrame(WindowPtr pWin, RootlessWindowPtr winRec)
}
/*
* RootlessDestroyWindow
* Destroy the physical window associated with the given window.
* @brief window destructor: remove physical window associated with given window
*/
Bool
RootlessDestroyWindow(WindowPtr pWin)
void
RootlessWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin)
{
RootlessWindowRec *winRec = WINREC(pWin);
Bool result;
if (winRec != NULL) {
if (winRec != NULL)
RootlessDestroyFrame(pWin, winRec);
}
SCREEN_UNWRAP(pWin->drawable.pScreen, DestroyWindow);
result = pWin->drawable.pScreen->DestroyWindow(pWin);
SCREEN_WRAP(pWin->drawable.pScreen, DestroyWindow);
return result;
}
static Bool
@ -313,20 +304,20 @@ RootlessChangeWindowAttributes(WindowPtr pWin, unsigned long vmask)
}
/*
* RootlessPositionWindow
* This is a hook for when DIX moves or resizes a window.
* Update the frame position now although the physical window is moved
* in RootlessMoveWindow. (x, y) are *inside* position. After this,
* mi and fb are expecting the pixmap to be at the new location.
* @brief DIX move/resize hook
*
* This is a hook for when DIX moves or resizes a window.
* Update the frame position now although the physical window is moved
* in RootlessMoveWindow. (x, y) are *inside* position. After this,
* mi and fb are expecting the pixmap to be at the new location.
*/
Bool
RootlessPositionWindow(WindowPtr pWin, int x, int y)
void RootlessWindowPosition(CallbackListPtr *pcbl, ScreenPtr pScreen, XorgScreenWindowPositionParamRec *param)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
WindowPtr pWin = param->window;
RootlessWindowRec *winRec = WINREC(pWin);
Bool result;
RL_DEBUG_MSG("positionwindow start (win %p (%lu) @ %i, %i)\n", pWin, RootlessWID(pWin), x, y);
RL_DEBUG_MSG("positionwindow start (win %p (%lu) @ %i, %i)\n", pWin,
RootlessWID(pWin), param->x, param->y);
if (winRec) {
if (winRec->is_drawing) {
@ -334,16 +325,11 @@ RootlessPositionWindow(WindowPtr pWin, int x, int y)
int bw = wBorderWidth(pWin);
winRec->pixmap->devPrivate.ptr = winRec->pixelData;
SetPixmapBaseToScreen(winRec->pixmap, x - bw, y - bw);
SetPixmapBaseToScreen(winRec->pixmap, param->x - bw, param->y - bw);
}
}
SCREEN_UNWRAP(pScreen, PositionWindow);
result = pScreen->PositionWindow(pWin, x, y);
SCREEN_WRAP(pScreen, PositionWindow);
RL_DEBUG_MSG("positionwindow end\n");
return result;
}
/*

View File

@ -37,12 +37,12 @@
#include "rootlessCommon.h"
Bool RootlessCreateWindow(WindowPtr pWin);
Bool RootlessDestroyWindow(WindowPtr pWin);
void RootlessWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin);
void RootlessSetShape(WindowPtr pWin, int kind);
Bool RootlessChangeWindowAttributes(WindowPtr pWin, unsigned long vmask);
Bool RootlessPositionWindow(WindowPtr pWin, int x, int y);
void RootlessWindowPosition(CallbackListPtr *pcbl, ScreenPtr pScreen, XorgScreenWindowPositionParamRec *param);
Bool RootlessRealizeWindow(WindowPtr pWin);
Bool RootlessUnrealizeWindow(WindowPtr pWin);
void RootlessRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib);

View File

@ -23,8 +23,10 @@
#include <dix-config.h>
#include <stdlib.h>
#include <X11/X.h>
#include "dix/screen_hooks_priv.h"
#include <X11/X.h>
#include "scrnintstr.h"
#include "windowstr.h"
#include "dixfontstr.h"
@ -93,19 +95,17 @@ shadowGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
wrap(pBuf, pScreen, GetImage);
}
static Bool
shadowCloseScreen(ScreenPtr pScreen)
static void shadowCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
shadowBuf(pScreen);
dixScreenUnhookClose(pScreen, shadowCloseScreen);
shadowBuf(pScreen);
unwrap(pBuf, pScreen, GetImage);
unwrap(pBuf, pScreen, CloseScreen);
unwrap(pBuf, pScreen, BlockHandler);
shadowRemove(pScreen, pBuf->pPixmap);
DamageDestroy(pBuf->pDamage);
dixDestroyPixmap(pBuf->pPixmap, 0);
free(pBuf);
return pScreen->CloseScreen(pScreen);
}
Bool
@ -130,7 +130,8 @@ shadowSetup(ScreenPtr pScreen)
return FALSE;
}
wrap(pBuf, pScreen, CloseScreen);
dixScreenHookClose(pScreen, shadowCloseScreen);
wrap(pBuf, pScreen, GetImage);
wrap(pBuf, pScreen, BlockHandler);
pBuf->update = 0;

View File

@ -53,7 +53,6 @@ typedef struct _shadowBuf {
/* screen wrappers */
GetImageProcPtr GetImage;
CloseScreenProcPtr CloseScreen;
ScreenBlockHandlerProcPtr BlockHandler;
} shadowBufRec;

View File

@ -149,16 +149,6 @@ miSyncGetScreenFuncs(ScreenPtr pScreen)
return &pScreenPriv->funcs;
}
static Bool
SyncCloseScreen(ScreenPtr pScreen)
{
SyncScreenPrivPtr pScreenPriv = SYNC_SCREEN_PRIV(pScreen);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
return (*pScreen->CloseScreen) (pScreen);
}
Bool
miSyncSetup(ScreenPtr pScreen)
{
@ -179,10 +169,6 @@ miSyncSetup(ScreenPtr pScreen)
if (!pScreenPriv->funcs.CreateFence) {
pScreenPriv->funcs = miSyncScreenFuncs;
/* Wrap CloseScreen to clean up */
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = SyncCloseScreen;
}
return TRUE;

View File

@ -13,9 +13,6 @@ extern DevPrivateKeyRec miSyncScreenPrivateKey;
typedef struct _syncScreenPriv {
/* Wrappable sync-specific screen functions */
SyncScreenFuncsRec funcs;
/* Wrapped screen functions */
CloseScreenProcPtr CloseScreen;
} SyncScreenPrivRec, *SyncScreenPrivPtr;
#define SYNC_SCREEN_PRIV(pScreen) \

View File

@ -163,9 +163,7 @@ typedef void (*present_priv_flip_destroy_ptr)(ScreenPtr screen);
struct present_screen_priv {
ScreenPtr pScreen;
CloseScreenProcPtr CloseScreen;
ConfigNotifyProcPtr ConfigNotify;
DestroyWindowProcPtr DestroyWindow;
ClipNotifyProcPtr ClipNotify;
present_vblank_ptr flip_pending;

View File

@ -21,6 +21,8 @@
*/
#include <dix-config.h>
#include "dix/screen_hooks_priv.h"
#include "present_priv.h"
int present_request;
@ -52,18 +54,18 @@ present_get_window_priv(WindowPtr window, Bool create)
/*
* Hook the close screen function to clean up our screen private
*/
static Bool
present_close_screen(ScreenPtr screen)
static void present_close_screen(CallbackListPtr *pcbl, ScreenPtr screen, void *unused)
{
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
if (!screen_priv)
return;
if (screen_priv->flip_destroy)
screen_priv->flip_destroy(screen);
unwrap(screen_priv, screen, CloseScreen);
(*screen->CloseScreen) (screen);
dixScreenUnhookClose(screen, present_close_screen);
dixSetPrivate(&screen->devPrivates, &present_screen_private_key, NULL);
free(screen_priv);
return TRUE;
}
/*
@ -86,10 +88,9 @@ present_free_window_vblank(WindowPtr window)
/*
* Hook the close window function to clean up our window private
*/
static Bool
present_destroy_window(WindowPtr window)
static void
present_destroy_window(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr window)
{
Bool ret;
ScreenPtr screen = window->drawable.pScreen;
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
present_window_priv_ptr window_priv = present_window_priv(window);
@ -112,13 +113,6 @@ present_destroy_window(WindowPtr window)
free(window_priv);
}
unwrap(screen_priv, screen, DestroyWindow);
if (screen->DestroyWindow)
ret = screen->DestroyWindow (window);
else
ret = TRUE;
wrap(screen_priv, screen, DestroyWindow, present_destroy_window);
return ret;
}
/*
@ -182,8 +176,9 @@ present_screen_priv_init(ScreenPtr screen)
if (!screen_priv)
return NULL;
wrap(screen_priv, screen, CloseScreen, present_close_screen);
wrap(screen_priv, screen, DestroyWindow, present_destroy_window);
dixScreenHookWindowDestroy(screen, present_destroy_window);
dixScreenHookClose(screen, present_close_screen);
wrap(screen_priv, screen, ConfigNotify, present_config_notify);
wrap(screen_priv, screen, ClipNotify, present_clip_notify);

View File

@ -28,6 +28,8 @@
#include <dix-config.h>
#include "dix/screen_hooks_priv.h"
#include "randrstr_priv.h"
#include "extinit_priv.h"
@ -81,14 +83,13 @@ RRClientCallback(CallbackListPtr *list, void *closure, void *data)
}
}
static Bool
RRCloseScreen(ScreenPtr pScreen)
static void RRCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
rrScrPriv(pScreen);
int j;
RRLeasePtr lease, next;
unwrap(pScrPriv, pScreen, CloseScreen);
dixScreenUnhookClose(pScreen, RRCloseScreen);
xorg_list_for_each_entry_safe(lease, next, &pScrPriv->leases, list)
RRTerminateLease(lease);
@ -106,7 +107,6 @@ RRCloseScreen(ScreenPtr pScreen)
free(pScrPriv->outputs);
free(pScrPriv);
RRNScreens -= 1; /* ok, one fewer screen with RandR running */
return (*pScreen->CloseScreen) (pScreen);
}
static void
@ -337,7 +337,7 @@ RRScreenInit(ScreenPtr pScreen)
pScrPriv->lastSetTime = currentTime;
pScrPriv->lastConfigTime = currentTime;
wrap(pScrPriv, pScreen, CloseScreen, RRCloseScreen);
dixScreenHookClose(pScreen, RRCloseScreen);
pScreen->ConstrainCursorHarder = RRConstrainCursorHarder;
pScreen->ReplaceScanoutPixmap = RRReplaceScanoutPixmap;

View File

@ -37,6 +37,7 @@
#include <X11/Xmd.h>
#include "dix/cursor_priv.h"
#include "dix/screen_hooks_priv.h"
#include "servermd.h"
#include "scrnintstr.h"
@ -60,7 +61,6 @@ typedef struct _AnimCur {
} AnimCurRec, *AnimCurPtr;
typedef struct _AnimScrPriv {
CloseScreenProcPtr CloseScreen;
CursorLimitsProcPtr CursorLimits;
DisplayCursorProcPtr DisplayCursor;
SetCursorPositionProcPtr SetCursorPosition;
@ -84,13 +84,11 @@ static DevPrivateKeyRec AnimCurScreenPrivateKeyRec;
#define Wrap(as,s,elt,func) (((as)->elt = (s)->elt), (s)->elt = func)
#define Unwrap(as,s,elt) ((s)->elt = (as)->elt)
static Bool
AnimCurCloseScreen(ScreenPtr pScreen)
static void AnimCurScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
Bool ret;
Unwrap(as, pScreen, CloseScreen);
dixScreenUnhookClose(pScreen, AnimCurScreenClose);
Unwrap(as, pScreen, CursorLimits);
Unwrap(as, pScreen, DisplayCursor);
@ -98,8 +96,6 @@ AnimCurCloseScreen(ScreenPtr pScreen)
Unwrap(as, pScreen, RealizeCursor);
Unwrap(as, pScreen, UnrealizeCursor);
Unwrap(as, pScreen, RecolorCursor);
ret = (*pScreen->CloseScreen) (pScreen);
return ret;
}
static void
@ -286,7 +282,7 @@ AnimCurInit(ScreenPtr pScreen)
as = GetAnimCurScreen(pScreen);
Wrap(as, pScreen, CloseScreen, AnimCurCloseScreen);
dixScreenHookClose(pScreen, AnimCurScreenClose);
Wrap(as, pScreen, CursorLimits, AnimCurCursorLimits);
Wrap(as, pScreen, DisplayCursor, AnimCurDisplayCursor);

View File

@ -25,6 +25,7 @@
#include <dix-config.h>
#include "dix/colormap_priv.h"
#include "dix/screen_hooks_priv.h"
#include "os/osdep.h"
#include "misc.h"
@ -63,13 +64,10 @@ PictureWindowFormat(WindowPtr pWindow)
WindowGetVisual(pWindow));
}
static Bool
PictureDestroyWindow(WindowPtr pWindow)
static void
picture_window_destructor(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWindow)
{
ScreenPtr pScreen = pWindow->drawable.pScreen;
PicturePtr pPicture;
PictureScreenPtr ps = GetPictureScreen(pScreen);
Bool ret;
while ((pPicture = GetPictureWindow(pWindow))) {
SetPictureWindow(pWindow, pPicture->pNext);
@ -77,22 +75,13 @@ PictureDestroyWindow(WindowPtr pWindow)
FreeResource(pPicture->id, PictureType);
FreePicture((void *) pPicture, pPicture->id);
}
pScreen->DestroyWindow = ps->DestroyWindow;
ret = (*pScreen->DestroyWindow) (pWindow);
ps->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = PictureDestroyWindow;
return ret;
}
static Bool
PictureCloseScreen(ScreenPtr pScreen)
static void PictureScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{
PictureScreenPtr ps = GetPictureScreen(pScreen);
Bool ret;
int n;
pScreen->CloseScreen = ps->CloseScreen;
ret = (*pScreen->CloseScreen) (pScreen);
PictureResetFilters(pScreen);
for (n = 0; n < ps->nformats; n++)
if (ps->formats[n].type == PictTypeIndexed)
@ -101,7 +90,7 @@ PictureCloseScreen(ScreenPtr pScreen)
SetPictureScreen(pScreen, 0);
free(ps->formats);
free(ps);
return ret;
dixScreenUnhookClose(pScreen, PictureScreenClose);
}
static void
@ -692,13 +681,12 @@ PictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats)
ps->subpixel = SubPixelUnknown;
ps->CloseScreen = pScreen->CloseScreen;
ps->DestroyWindow = pScreen->DestroyWindow;
ps->StoreColors = pScreen->StoreColors;
pScreen->DestroyWindow = PictureDestroyWindow;
pScreen->CloseScreen = PictureCloseScreen;
pScreen->StoreColors = PictureStoreColors;
dixScreenHookWindowDestroy(pScreen, picture_window_destructor);
dixScreenHookClose(pScreen, PictureScreenClose);
if (!PictureSetDefaultFilters(pScreen)) {
PictureResetFilters(pScreen);
SetPictureScreen(pScreen, 0);

Some files were not shown because too many files have changed in this diff Show More