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 <X11/extensions/panoramiXproto.h>
#include "dix/dix_priv.h" #include "dix/dix_priv.h"
#include "dix/screen_hooks_priv.h"
#include "misc.h" #include "misc.h"
#include "cursor.h" #include "cursor.h"
@ -123,7 +124,6 @@ typedef struct {
typedef struct { typedef struct {
CreateGCProcPtr CreateGC; CreateGCProcPtr CreateGC;
CloseScreenProcPtr CloseScreen;
} PanoramiXScreenRec, *PanoramiXScreenPtr; } PanoramiXScreenRec, *PanoramiXScreenPtr;
static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr); static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr);
@ -148,21 +148,23 @@ static const GCFuncs XineramaGCFuncs = {
pGCPriv->wrapFuncs = (pGC)->funcs;\ pGCPriv->wrapFuncs = (pGC)->funcs;\
(pGC)->funcs = &XineramaGCFuncs; (pGC)->funcs = &XineramaGCFuncs;
static Bool static void XineramaCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unsused)
XineramaCloseScreen(ScreenPtr pScreen)
{ {
dixScreenUnhookClose(pScreen, XineramaCloseScreen);
PanoramiXScreenPtr pScreenPriv = (PanoramiXScreenPtr) PanoramiXScreenPtr pScreenPriv = (PanoramiXScreenPtr)
dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey); dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey);
pScreen->CloseScreen = pScreenPriv->CloseScreen; if (!pScreenPriv)
return;
pScreen->CreateGC = pScreenPriv->CreateGC; pScreen->CreateGC = pScreenPriv->CreateGC;
if (pScreen->myNum == 0) if (pScreen->myNum == 0)
RegionUninit(&PanoramiXScreenRegion); RegionUninit(&PanoramiXScreenRegion);
free(pScreenPriv); free(pScreenPriv);
dixSetPrivate(&pScreen->devPrivates, PanoramiXScreenKey, NULL);
return (*pScreen->CloseScreen) (pScreen);
} }
static Bool static Bool
@ -484,11 +486,10 @@ PanoramiXExtensionInit(void)
return; return;
} }
pScreenPriv->CreateGC = pScreen->CreateGC; dixScreenHookClose(pScreen, XineramaCloseScreen);
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreenPriv->CreateGC = pScreen->CreateGC;
pScreen->CreateGC = XineramaCreateGC; pScreen->CreateGC = XineramaCreateGC;
pScreen->CloseScreen = XineramaCloseScreen;
} }
XRC_DRAWABLE = CreateNewResourceClass(); 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 <X11/Xfuncproto.h>
#include "dix/dix_priv.h" #include "dix/dix_priv.h"
#include "dix/screen_hooks_priv.h"
#include "os/auth.h" #include "os/auth.h"
#include "os/busfault.h" #include "os/busfault.h"
#include "os/client_priv.h" #include "os/client_priv.h"
@ -96,9 +97,7 @@ in this Software without prior written authorization from The Open Group.
#endif /* XINERAMA */ #endif /* XINERAMA */
typedef struct _ShmScrPrivateRec { typedef struct _ShmScrPrivateRec {
CloseScreenProcPtr CloseScreen;
ShmFuncsPtr shmFuncs; ShmFuncsPtr shmFuncs;
DestroyPixmapProcPtr destroyPixmap;
} ShmScrPrivateRec; } ShmScrPrivateRec;
Bool noMITShmExtension = FALSE; Bool noMITShmExtension = FALSE;
@ -109,8 +108,6 @@ static void ShmResetProc(ExtensionEntry *extEntry);
static void SShmCompletionEvent(xShmCompletionEvent *from, static void SShmCompletionEvent(xShmCompletionEvent *from,
xShmCompletionEvent *to); xShmCompletionEvent *to);
static Bool ShmDestroyPixmap(PixmapPtr pPixmap);
static unsigned char ShmReqCode; static unsigned char ShmReqCode;
int ShmCompletionCode; int ShmCompletionCode;
int BadShmSegCode; int BadShmSegCode;
@ -195,15 +192,13 @@ CheckForShmSyscall(void)
#endif #endif
static Bool static void
ShmCloseScreen(ScreenPtr pScreen) ShmScreenClose(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
{ {
ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen); ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen);
pScreen->CloseScreen = screen_priv->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL); dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL);
free(screen_priv); free(screen_priv);
return (*pScreen->CloseScreen) (pScreen);
} }
static ShmScrPrivateRec * static ShmScrPrivateRec *
@ -213,9 +208,8 @@ ShmInitScreenPriv(ScreenPtr pScreen)
if (!screen_priv) { if (!screen_priv) {
screen_priv = calloc(1, sizeof(ShmScrPrivateRec)); screen_priv = calloc(1, sizeof(ShmScrPrivateRec));
screen_priv->CloseScreen = pScreen->CloseScreen;
dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv); dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, screen_priv);
pScreen->CloseScreen = ShmCloseScreen; dixScreenHookClose(pScreen, ShmScreenClose);
} }
return screen_priv; return screen_priv;
} }
@ -247,28 +241,6 @@ ShmRegisterFuncs(ScreenPtr pScreen, ShmFuncsPtr funcs)
ShmInitScreenPriv(pScreen)->shmFuncs = 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 void
ShmRegisterFbFuncs(ScreenPtr pScreen) ShmRegisterFbFuncs(ScreenPtr pScreen)
@ -437,6 +409,9 @@ ShmDetachSegment(void *value, /* must conform to DeleteType */
ShmDescPtr shmdesc = (ShmDescPtr) value; ShmDescPtr shmdesc = (ShmDescPtr) value;
ShmDescPtr *prev; ShmDescPtr *prev;
if (!shmdesc)
return Success;
if (--shmdesc->refcnt) if (--shmdesc->refcnt)
return TRUE; return TRUE;
#if SHM_FD_PASSING #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 void
ShmExtensionInit(void) ShmExtensionInit(void)
{ {
@ -1542,13 +1525,8 @@ ShmExtensionInit(void)
sharedPixmaps = xFalse; sharedPixmaps = xFalse;
} }
if (sharedPixmaps) if (sharedPixmaps)
for (i = 0; i < screenInfo.numScreens; i++) { for (i = 0; i < screenInfo.numScreens; i++)
ShmScrPrivateRec *screen_priv = dixScreenHookPixmapDestroy(screenInfo.screens[i], ShmPixmapDestroy);
ShmGetScreenPriv(screenInfo.screens[i]);
screen_priv->destroyPixmap =
screenInfo.screens[i]->DestroyPixmap;
screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap;
}
} }
ShmSegType = CreateNewResourceType(ShmDetachSegment, "ShmSeg"); ShmSegType = CreateNewResourceType(ShmDetachSegment, "ShmSeg");
if (ShmSegType && if (ShmSegType &&

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

100
dbe/dbe.c
View File

@ -40,6 +40,7 @@
#include <X11/Xproto.h> #include <X11/Xproto.h>
#include "dix/dix_priv.h" #include "dix/dix_priv.h"
#include "dix/screen_hooks_priv.h"
#include "scrnintstr.h" #include "scrnintstr.h"
#include "extnsionst.h" #include "extnsionst.h"
@ -81,12 +82,6 @@ DbeStubScreen(DbeScreenPrivPtr pDbeScreenPriv, int *nStubbedScreens)
/* Stub DIX. */ /* Stub DIX. */
pDbeScreenPriv->SetupBackgroundPainter = NULL; 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. */ /* Stub DDX. */
pDbeScreenPriv->GetVisualInfo = NULL; pDbeScreenPriv->GetVisualInfo = NULL;
pDbeScreenPriv->AllocBackBufferName = NULL; pDbeScreenPriv->AllocBackBufferName = NULL;
@ -1201,7 +1196,9 @@ DbeWindowPrivDelete(void *pDbeWinPriv, XID id)
return Success; return Success;
} /* DbeWindowPrivDelete() */ } /* DbeWindowPrivDelete() */
static void miDbeWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin);
/****************************************************************************** /******************************************************************************
* *
* DBE DIX Procedure: DbeResetProc * DBE DIX Procedure: DbeResetProc
@ -1225,94 +1222,39 @@ DbeResetProc(ExtensionEntry * extEntry)
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
if (pDbeScreenPriv) { if (pDbeScreenPriv) {
/* Unwrap DestroyWindow, which was wrapped in DbeExtensionInit(). */ dixScreenUnhookWindowDestroy(pScreen, miDbeWindowDestroy);
pScreen->DestroyWindow = pDbeScreenPriv->DestroyWindow; dixScreenUnhookWindowPosition(pScreen, miDbeWindowPosition);
pScreen->PositionWindow = pDbeScreenPriv->PositionWindow;
free(pDbeScreenPriv); 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 ** Call the window priv delete function for all buffer IDs associated
** with this window. ** with this window.
************************************************************************** **************************************************************************
*/ */
if ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) { DbeWindowPrivPtr pDbeWindowPriv;
while (pDbeWindowPriv) { while ((pDbeWindowPriv = DBE_WINDOW_PRIV(pWin))) {
/* *DbeWinPrivDelete() will free the window private and set it to /* *DbeWinPrivDelete() will free the window private and set it to
* NULL if there are no more buffer IDs associated with this * NULL if there are no more buffer IDs associated with this
* window. * window.
*/ */
FreeResource(pDbeWindowPriv->IDs[0], X11_RESTYPE_NONE); FreeResource(pDbeWindowPriv->IDs[0], X11_RESTYPE_NONE);
pDbeWindowPriv = DBE_WINDOW_PRIV(pWin); 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 * DBE DIX Procedure: DbeExtensionInit
@ -1395,12 +1337,10 @@ DbeExtensionInit(void)
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
if (ddxInitSuccess) { if (ddxInitSuccess) {
/* Wrap DestroyWindow. The DDX initialization function /* Hook in our window destructor. The DDX initialization function
* already wrapped PositionWindow for us. * already added WindowPosition hook for us.
*/ */
dixScreenHookWindowDestroy(pScreen, miDbeWindowDestroy);
pDbeScreenPriv->DestroyWindow = pScreen->DestroyWindow;
pScreen->DestroyWindow = DbeDestroyWindow;
} }
else { else {
/* DDX initialization failed. Stub the screen. */ /* DDX initialization failed. Stub the screen. */

View File

@ -169,13 +169,6 @@ typedef struct _DbeWindowPrivRec {
*/ */
typedef struct _DbeScreenPrivRec { 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 */ /* Per-screen DIX routines */
Bool (*SetupBackgroundPainter) (WindowPtr /*pWin */ , Bool (*SetupBackgroundPainter) (WindowPtr /*pWin */ ,
GCPtr /*pGC */ 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 * the resources associated with a DBE buffer ID. There are 5 ways that
* miDbeWinPrivDelete() can be called by FreeResource(). They are: * miDbeWinPrivDelete() can be called by FreeResource(). They are:
* *
* - A DBE window is destroyed, in which case the DbeDestroyWindow() * - A DBE window is destroyed, in which case the DbeWindowDestroy()
* wrapper is invoked. The wrapper calls FreeResource() for all DBE * callback is invoked. It calls FreeResource() for all DBE buffer IDs.
* buffer IDs.
* *
* - miDbeAllocBackBufferName() calls FreeResource() to clean up resources * - miDbeAllocBackBufferName() calls FreeResource() to clean up resources
* after a buffer allocation failure. * 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() when it fails to create buffers of the new size.
* FreeResource() is called for all DBE buffer IDs. * FreeResource() is called for all DBE buffer IDs.
* *
@ -432,22 +431,20 @@ miDbeWinPrivDelete(DbeWindowPrivPtr pDbeWindowPriv, XID bufId)
if (pDbeWindowPriv->pBackBuffer) if (pDbeWindowPriv->pBackBuffer)
dixDestroyPixmap(pDbeWindowPriv->pBackBuffer, 0); dixDestroyPixmap(pDbeWindowPriv->pBackBuffer, 0);
} /* miDbeWinPrivDelete() */ } /* miDbeWinPrivDelete() */
/****************************************************************************** /******************************************************************************
* *
* DBE MI Procedure: miDbePositionWindow * DBE MI Procedure: miDbeWindowPosition
* *
* Description: * 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. * This function resizes the buffer when the window is resized.
* *
*****************************************************************************/ *****************************************************************************/
static Bool void miDbeWindowPosition(CallbackListPtr *pcbl, ScreenPtr pScreen, XorgScreenWindowPositionParamRec *param)
miDbePositionWindow(WindowPtr pWin, int x, int y)
{ {
ScreenPtr pScreen;
DbeScreenPrivPtr pDbeScreenPriv; DbeScreenPrivPtr pDbeScreenPriv;
DbeWindowPrivPtr pDbeWindowPriv; DbeWindowPrivPtr pDbeWindowPriv;
int width, height; int width, height;
@ -460,43 +457,9 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
Bool clear; Bool clear;
GCPtr pGC; GCPtr pGC;
xRectangle clearRect; xRectangle clearRect;
Bool ret;
/* WindowPtr pWin = param->window;
**************************************************************************
** 1. Unwrap the member routine.
**************************************************************************
*/
pScreen = pWin->drawable.pScreen;
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen); 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))) { if (!(pDbeWindowPriv = DBE_WINDOW_PRIV(pWin)))
return ret; return;
}
if (pDbeWindowPriv->width == pWin->drawable.width && if (pDbeWindowPriv->width == pWin->drawable.width &&
pDbeWindowPriv->height == pWin->drawable.height) { pDbeWindowPriv->height == pWin->drawable.height)
return ret; return;
}
width = pWin->drawable.width; width = pWin->drawable.width;
height = pWin->drawable.height; height = pWin->drawable.height;
@ -595,7 +556,7 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
} }
FreeScratchGC(pGC); FreeScratchGC(pGC);
return FALSE; return;
} }
else { else {
@ -645,11 +606,8 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
FreeScratchGC(pGC); FreeScratchGC(pGC);
} }
}
return ret;
} /* miDbePositionWindow() */
/****************************************************************************** /******************************************************************************
* *
* DBE MI Procedure: miDbeInit * DBE MI Procedure: miDbeInit
@ -663,9 +621,7 @@ miDbePositionWindow(WindowPtr pWin, int x, int y)
Bool Bool
miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv) miDbeInit(ScreenPtr pScreen, DbeScreenPrivPtr pDbeScreenPriv)
{ {
/* Wrap functions. */ dixScreenHookWindowPosition(pScreen, miDbeWindowPosition);
pDbeScreenPriv->PositionWindow = pScreen->PositionWindow;
pScreen->PositionWindow = miDbePositionWindow;
/* Initialize the per-screen DBE function pointers. */ /* Initialize the per-screen DBE function pointers. */
pDbeScreenPriv->GetVisualInfo = miDbeGetVisualInfo; pDbeScreenPriv->GetVisualInfo = miDbeGetVisualInfo;

View File

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

View File

@ -10,4 +10,15 @@
void InitCallbackManager(void); void InitCallbackManager(void);
void DeleteCallbackManager(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 */ #endif /* _XSERVER_CALLBACK_PRIV_H */

View File

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

View File

@ -255,4 +255,71 @@ extern Bool enableBackingStore;
/* in generated BuiltInAtoms.c */ /* in generated BuiltInAtoms.c */
void MakePredeclaredAtoms(void); 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 */ #endif /* _XSERVER_DIX_PRIV_H */

View File

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

View File

@ -768,6 +768,8 @@ int
FreeGC(void *value, XID gid) FreeGC(void *value, XID gid)
{ {
GCPtr pGC = (GCPtr) value; GCPtr pGC = (GCPtr) value;
if (!pGC)
return BadMatch;
CloseFont(pGC->font, (Font) 0); CloseFont(pGC->font, (Font) 0);
if (pGC->funcs) if (pGC->funcs)
@ -819,13 +821,14 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth)
} }
void void
FreeGCperDepth(int screenNum) FreeGCperDepth(ScreenPtr pScreen)
{ {
int i; int i;
ScreenPtr pScreen;
GCPtr *ppGC; GCPtr *ppGC;
pScreen = screenInfo.screens[screenNum]; if (!pScreen)
return;
ppGC = pScreen->GCperDepth; ppGC = pScreen->GCperDepth;
for (i = 0; i <= pScreen->numDepths; i++) { for (i = 0; i <= pScreen->numDepths; i++) {
@ -900,13 +903,6 @@ CreateDefaultStipple(int screenNum)
return TRUE; return TRUE;
} }
void
FreeDefaultStipple(int screenNum)
{
ScreenPtr pScreen = screenInfo.screens[screenNum];
dixDestroyPixmap(pScreen->defaultStipple, 0);
}
int int
SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash) 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); int FreeGC(void *pGC, XID gid);
void FreeGCperDepth(int screenNum); void FreeGCperDepth(ScreenPtr pScreen);
Bool CreateGCperDepth(int screenNum); Bool CreateGCperDepth(int screenNum);
Bool CreateDefaultStipple(int screenNum); Bool CreateDefaultStipple(int screenNum);
void FreeDefaultStipple(int screenNum);
int SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash); int SetDashes(GCPtr pGC, unsigned offset, unsigned ndash, unsigned char *pdash);
int VerifyRectOrder(int nrects, xRectangle *prects, int ordering); 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]; ScreenPtr pScreen = screenInfo.gpuscreens[i];
if (!PixmapScreenInit(pScreen)) if (!PixmapScreenInit(pScreen))
FatalError("failed to create screen pixmap properties"); FatalError("failed to create screen pixmap properties");
if (pScreen->CreateScreenResources && if (!dixScreenRaiseCreateResources(pScreen))
!(*pScreen->CreateScreenResources) (pScreen))
FatalError("failed to create screen resources"); FatalError("failed to create screen resources");
} }
@ -217,8 +216,7 @@ dix_main(int argc, char *argv[], char *envp[])
if (!PixmapScreenInit(pScreen)) if (!PixmapScreenInit(pScreen))
FatalError("failed to create screen pixmap properties"); FatalError("failed to create screen pixmap properties");
if (pScreen->CreateScreenResources && if (!dixScreenRaiseCreateResources(pScreen))
!(*pScreen->CreateScreenResources) (pScreen))
FatalError("failed to create screen resources"); FatalError("failed to create screen resources");
if (!CreateGCperDepth(i)) if (!CreateGCperDepth(i))
FatalError("failed to create scratch GCs"); FatalError("failed to create scratch GCs");
@ -318,23 +316,16 @@ dix_main(int argc, char *argv[], char *envp[])
CloseDownEvents(); CloseDownEvents();
for (i = screenInfo.numGPUScreens - 1; i >= 0; i--) { for (i = screenInfo.numGPUScreens - 1; i >= 0; i--) {
ScreenPtr pScreen = screenInfo.gpuscreens[i]; dixFreeScreen(screenInfo.gpuscreens[i]);
dixFreeScreenSpecificPrivates(pScreen);
(*pScreen->CloseScreen) (pScreen);
dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
free(pScreen);
screenInfo.numGPUScreens = i; screenInfo.numGPUScreens = i;
} }
memset(&screenInfo.numGPUScreens, 0, sizeof(screenInfo.numGPUScreens));
for (i = screenInfo.numScreens - 1; i >= 0; i--) { for (i = screenInfo.numScreens - 1; i >= 0; i--) {
FreeGCperDepth(i); dixFreeScreen(screenInfo.screens[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]);
screenInfo.numScreens = i; screenInfo.numScreens = i;
} }
memset(&screenInfo.screens, 0, sizeof(screenInfo.numGPUScreens));
ReleaseClientIds(serverClient); ReleaseClientIds(serverClient);
dixFreePrivates(serverClient->devPrivates, PRIVATE_CLIENT); dixFreePrivates(serverClient->devPrivates, PRIVATE_CLIENT);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -185,33 +185,19 @@ exaModifyPixmapHeader_driver(PixmapPtr pPixmap, int width, int height,
return ret; return ret;
} }
Bool void exaPixmapDestroy_driver(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
exaDestroyPixmap_driver(PixmapPtr pPixmap)
{ {
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ExaScreenPriv(pScreen); ExaScreenPriv(pScreen);
Bool ret = TRUE;
if (pPixmap->refcnt == 1) { ExaPixmapPriv(pPixmap);
ExaPixmapPriv(pPixmap); if (!pExaPixmap) // we're called on an error path
if (!pExaPixmap) // we're called on an error path return;
goto out;
exaDestroyPixmap(pPixmap); exaDestroyPixmap(pPixmap);
if (pExaPixmap->driverPriv) if (pExaPixmap->driverPriv)
pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv); pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
pExaPixmap->driverPriv = NULL; 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;
} }
Bool Bool

View File

@ -239,42 +239,28 @@ exaModifyPixmapHeader_mixed(PixmapPtr pPixmap, int width, int height, int depth,
return ret; return ret;
} }
Bool void exaPixmapDestroy_mixed(CallbackListPtr *pcbl, ScreenPtr pScreen, PixmapPtr pPixmap)
exaDestroyPixmap_mixed(PixmapPtr pPixmap)
{ {
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ExaScreenPriv(pScreen); ExaScreenPriv(pScreen);
Bool ret = TRUE;
if (pPixmap->refcnt == 1) { ExaPixmapPriv(pPixmap);
ExaPixmapPriv(pPixmap); if (!pExaPixmap) // we're called on an error path
if (!pExaPixmap) return;
goto out; // we're called on an error path
exaDestroyPixmap(pPixmap); exaDestroyPixmap(pPixmap);
if (pExaScr->deferred_mixed_pixmap == pPixmap) if (pExaScr->deferred_mixed_pixmap == pPixmap)
pExaScr->deferred_mixed_pixmap = NULL; pExaScr->deferred_mixed_pixmap = NULL;
if (pExaPixmap->driverPriv) if (pExaPixmap->driverPriv)
pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv); pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
pExaPixmap->driverPriv = NULL; pExaPixmap->driverPriv = NULL;
if (pExaPixmap->pDamage) { if (pExaPixmap->pDamage) {
free(pExaPixmap->sys_ptr); free(pExaPixmap->sys_ptr);
pExaPixmap->sys_ptr = NULL; pExaPixmap->sys_ptr = NULL;
pExaPixmap->pDamage = 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 Bool

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -69,12 +69,10 @@ struct xwl_screen {
int hidpi; int hidpi;
ClipNotifyProcPtr ClipNotify; ClipNotifyProcPtr ClipNotify;
CreateScreenResourcesProcPtr CreateScreenResources;
CloseScreenProcPtr CloseScreen; CloseScreenProcPtr CloseScreen;
ConfigNotifyProcPtr ConfigNotify; ConfigNotifyProcPtr ConfigNotify;
RealizeWindowProcPtr RealizeWindow; RealizeWindowProcPtr RealizeWindow;
UnrealizeWindowProcPtr UnrealizeWindow; UnrealizeWindowProcPtr UnrealizeWindow;
DestroyWindowProcPtr DestroyWindow;
XYToWindowProcPtr XYToWindow; XYToWindowProcPtr XYToWindow;
SetWindowPixmapProcPtr SetWindowPixmap; SetWindowPixmapProcPtr SetWindowPixmap;
ChangeWindowAttributesProcPtr ChangeWindowAttributes; 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_width(struct xwl_screen *xwl_screen);
int xwl_screen_get_height(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); Bool xwl_screen_init(ScreenPtr pScreen, int argc, char **argv);
void xwl_sync_events (struct xwl_screen *xwl_screen); void xwl_sync_events (struct xwl_screen *xwl_screen);
void xwl_screen_roundtrip (struct xwl_screen *xwl_screen); void xwl_screen_roundtrip (struct xwl_screen *xwl_screen);

View File

@ -36,6 +36,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include "mi/mi_priv.h"
#include "os/osdep.h" #include "os/osdep.h"
#include "fb.h" #include "fb.h"
@ -351,15 +352,9 @@ Bool
xwl_shm_create_screen_resources(ScreenPtr screen) xwl_shm_create_screen_resources(ScreenPtr screen)
{ {
struct xwl_screen *xwl_screen = xwl_screen_get(screen); struct xwl_screen *xwl_screen = xwl_screen_get(screen);
int ret;
screen->CreateScreenResources = xwl_screen->CreateScreenResources; if (!miCreateScreenResources(screen))
ret = (*screen->CreateScreenResources) (screen); return FALSE;
xwl_screen->CreateScreenResources = screen->CreateScreenResources;
screen->CreateScreenResources = xwl_shm_create_screen_resources;
if (!ret)
return ret;
if (xwl_screen->rootless) if (xwl_screen->rootless)
screen->devPrivate = 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); xwl_present_for_each_frame_callback(xwl_window, xwl_present_reset_timer);
} }
Bool void
xwl_destroy_window(WindowPtr window) xwl_window_destroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr window)
{ {
ScreenPtr screen = window->drawable.pScreen; struct xwl_screen *xwl_screen = xwl_screen_get(pScreen);
struct xwl_screen *xwl_screen = xwl_screen_get(screen);
struct xwl_window *xwl_window = xwl_window_get(window); struct xwl_window *xwl_window = xwl_window_get(window);
Bool ret;
if (xwl_screen->present) if (xwl_screen->present)
xwl_present_cleanup(window); xwl_present_cleanup(window);
if (xwl_window) if (xwl_window)
xwl_window_dispose(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 static Bool

View File

@ -146,7 +146,7 @@ void xwl_move_window(WindowPtr window,
int x, int y, int x, int y,
WindowPtr next_sib, WindowPtr next_sib,
VTKind kind); 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_post_damage(struct xwl_window *xwl_window);
void xwl_window_create_frame_callback(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); 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, int type,
XID glxDrawId, __GLXconfig * conf); XID glxDrawId, __GLXconfig * conf);
static Bool glxWinRealizeWindow(WindowPtr pWin);
static Bool glxWinUnrealizeWindow(WindowPtr pWin);
static void glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, static void glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
RegionPtr prgnSrc); RegionPtr prgnSrc);
static Bool glxWinSetPixelFormat(HDC hdc, int bppOverride, int drawableTypeOverride, 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 // dump out fbConfigs now fbConfigIds and visualIDs have been assigned
fbConfigsDump(screen->base.numFBConfigs, screen->base.fbconfigs, &rejects); fbConfigsDump(screen->base.numFBConfigs, screen->base.fbconfigs, &rejects);
/* Wrap RealizeWindow, UnrealizeWindow and CopyWindow on this screen */ /* Wrap CopyWindow on this screen */
screen->RealizeWindow = pScreen->RealizeWindow;
pScreen->RealizeWindow = glxWinRealizeWindow;
screen->UnrealizeWindow = pScreen->UnrealizeWindow;
pScreen->UnrealizeWindow = glxWinUnrealizeWindow;
screen->CopyWindow = pScreen->CopyWindow; screen->CopyWindow = pScreen->CopyWindow;
pScreen->CopyWindow = glxWinCopyWindow; pScreen->CopyWindow = glxWinCopyWindow;
@ -730,23 +724,6 @@ glxWinScreenProbe(ScreenPtr pScreen)
* Window functions * 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 static void
glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{ {
@ -778,22 +755,6 @@ glxWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
pScreen->CopyWindow = glxWinCopyWindow; 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 * Drawable functions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -32,8 +32,13 @@
#ifdef HAVE_XWIN_CONFIG_H #ifdef HAVE_XWIN_CONFIG_H
#include <xwin-config.h> #include <xwin-config.h>
#endif #endif
#include "mi/mi_priv.h"
#include "win.h" #include "win.h"
#include "mi/mi_priv.h"
/* /*
* Prototypes for local functions * Prototypes for local functions
*/ */
@ -56,18 +61,14 @@ Bool
winCreateWindowRootless(WindowPtr pWin) winCreateWindowRootless(WindowPtr pWin)
{ {
Bool fResult = FALSE; Bool fResult = FALSE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winWindowPriv(pWin); winWindowPriv(pWin);
winScreenPriv(pScreen);
#if ENABLE_DEBUG #if ENABLE_DEBUG
winTrace("winCreateWindowRootless (%p)\n", pWin); winTrace("winCreateWindowRootless (%p)\n", pWin);
#endif #endif
WIN_UNWRAP(CreateWindow); fResult = fbCreateWindow(pWin);
fResult = (*pScreen->CreateWindow) (pWin);
WIN_WRAP(CreateWindow, winCreateWindowRootless);
pWinPriv->hRgn = NULL; pWinPriv->hRgn = NULL;
@ -80,19 +81,13 @@ winCreateWindowRootless(WindowPtr pWin)
Bool Bool
winDestroyWindowRootless(WindowPtr pWin) winDestroyWindowRootless(WindowPtr pWin)
{ {
Bool fResult = FALSE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winWindowPriv(pWin); winWindowPriv(pWin);
winScreenPriv(pScreen);
#if ENABLE_DEBUG #if ENABLE_DEBUG
winTrace("winDestroyWindowRootless (%p)\n", pWin); winTrace("winDestroyWindowRootless (%p)\n", pWin);
#endif #endif
WIN_UNWRAP(DestroyWindow); Bool fResult = fbDestroyWindow(pWin);
fResult = (*pScreen->DestroyWindow) (pWin);
WIN_WRAP(DestroyWindow, winDestroyWindowRootless);
if (pWinPriv->hRgn != NULL) { if (pWinPriv->hRgn != NULL) {
DeleteObject(pWinPriv->hRgn); DeleteObject(pWinPriv->hRgn);
@ -110,18 +105,11 @@ winDestroyWindowRootless(WindowPtr pWin)
Bool Bool
winPositionWindowRootless(WindowPtr pWin, int x, int y) winPositionWindowRootless(WindowPtr pWin, int x, int y)
{ {
Bool fResult = FALSE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if ENABLE_DEBUG #if ENABLE_DEBUG
winTrace("winPositionWindowRootless (%p)\n", pWin); winTrace("winPositionWindowRootless (%p)\n", pWin);
#endif #endif
WIN_UNWRAP(PositionWindow); Bool fResult = fbPositionWindow(pWin, x, y);
fResult = (*pScreen->PositionWindow) (pWin, x, y);
WIN_WRAP(PositionWindow, winPositionWindowRootless);
winUpdateRgnRootless(pWin); winUpdateRgnRootless(pWin);
@ -134,18 +122,11 @@ winPositionWindowRootless(WindowPtr pWin, int x, int y)
Bool Bool
winChangeWindowAttributesRootless(WindowPtr pWin, unsigned long mask) winChangeWindowAttributesRootless(WindowPtr pWin, unsigned long mask)
{ {
Bool fResult = FALSE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if ENABLE_DEBUG #if ENABLE_DEBUG
winTrace("winChangeWindowAttributesRootless (%p)\n", pWin); winTrace("winChangeWindowAttributesRootless (%p)\n", pWin);
#endif #endif
WIN_UNWRAP(ChangeWindowAttributes); Bool fResult = fbChangeWindowAttributes(pWin, mask);
fResult = (*pScreen->ChangeWindowAttributes) (pWin, mask);
WIN_WRAP(ChangeWindowAttributes, winChangeWindowAttributesRootless);
winUpdateRgnRootless(pWin); winUpdateRgnRootless(pWin);
@ -159,19 +140,13 @@ winChangeWindowAttributesRootless(WindowPtr pWin, unsigned long mask)
Bool Bool
winUnmapWindowRootless(WindowPtr pWin) winUnmapWindowRootless(WindowPtr pWin)
{ {
Bool fResult = FALSE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winWindowPriv(pWin); winWindowPriv(pWin);
winScreenPriv(pScreen);
#if ENABLE_DEBUG #if ENABLE_DEBUG
winTrace("winUnmapWindowRootless (%p)\n", pWin); winTrace("winUnmapWindowRootless (%p)\n", pWin);
#endif #endif
WIN_UNWRAP(UnrealizeWindow); Bool fResult = fbUnrealizeWindow(pWin);
fResult = (*pScreen->UnrealizeWindow) (pWin);
WIN_WRAP(UnrealizeWindow, winUnmapWindowRootless);
if (pWinPriv->hRgn != NULL) { if (pWinPriv->hRgn != NULL) {
DeleteObject(pWinPriv->hRgn); DeleteObject(pWinPriv->hRgn);
@ -190,18 +165,11 @@ winUnmapWindowRootless(WindowPtr pWin)
Bool Bool
winMapWindowRootless(WindowPtr pWin) winMapWindowRootless(WindowPtr pWin)
{ {
Bool fResult = FALSE;
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if ENABLE_DEBUG #if ENABLE_DEBUG
winTrace("winMapWindowRootless (%p)\n", pWin); winTrace("winMapWindowRootless (%p)\n", pWin);
#endif #endif
WIN_UNWRAP(RealizeWindow); Bool fResult = fbRealizeWindow(pWin);
fResult = (*pScreen->RealizeWindow) (pWin);
WIN_WRAP(RealizeWindow, winMapWindowRootless);
winReshapeRootless(pWin); winReshapeRootless(pWin);
@ -213,17 +181,11 @@ winMapWindowRootless(WindowPtr pWin)
void void
winSetShapeRootless(WindowPtr pWin, int kind) winSetShapeRootless(WindowPtr pWin, int kind)
{ {
ScreenPtr pScreen = pWin->drawable.pScreen;
winScreenPriv(pScreen);
#if ENABLE_DEBUG #if ENABLE_DEBUG
winTrace("winSetShapeRootless (%p, %i)\n", pWin, kind); winTrace("winSetShapeRootless (%p, %i)\n", pWin, kind);
#endif #endif
WIN_UNWRAP(SetShape); miSetShape(pWin, kind);
(*pScreen->SetShape) (pWin, kind);
WIN_WRAP(SetShape, winSetShapeRootless);
winReshapeRootless(pWin); winReshapeRootless(pWin);
winUpdateRgnRootless(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 required. Unwrap occurs at the top of each function, just after
entry, and Wrap occurs at the bottom of each function, just entry, and Wrap occurs at the bottom of each function, just
before returning. 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 { typedef struct _Screen {
int myNum; /* index of this instance in Screens[] */ int myNum; /* index of this instance in Screens[] */
ATOM id; ATOM id;
@ -658,6 +667,26 @@ typedef struct _Screen {
ReplaceScanoutPixmapProcPtr ReplaceScanoutPixmap; ReplaceScanoutPixmapProcPtr ReplaceScanoutPixmap;
XYToWindowProcPtr XYToWindow; XYToWindowProcPtr XYToWindow;
DPMSProcPtr DPMS; 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; } ScreenRec;
static inline RegionPtr static inline RegionPtr

View File

@ -214,4 +214,10 @@
/* byte order */ /* byte order */
#mesondefine X_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_ */ #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 miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what);
void miSourceValidate(DrawablePtr pDrawable, int x, int y, int w, int h, void miSourceValidate(DrawablePtr pDrawable, int x, int y, int w, int h,
unsigned int subWindowMode); 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 miShapedWindowIn(RegionPtr universe, RegionPtr bounding, BoxPtr rect,
int x, int y); int x, int y);
int miValidateTree(WindowPtr pParent, WindowPtr pChild, VTKind kind); 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/dix_priv.h"
#include "dix/gc_priv.h" #include "dix/gc_priv.h"
#include "dix/screen_hooks_priv.h"
#include "misc.h" #include "misc.h"
#include "input.h" #include "input.h"
@ -59,7 +60,7 @@ static DevScreenPrivateKeyRec miDCDeviceKeyRec;
#define miDCDeviceKey (&miDCDeviceKeyRec) #define miDCDeviceKey (&miDCDeviceKeyRec)
static Bool miDCCloseScreen(ScreenPtr pScreen); static void miDCCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused);
/* per device private data */ /* per device private data */
typedef struct { typedef struct {
@ -79,7 +80,6 @@ typedef struct {
* in the pCursorBuffers array. * in the pCursorBuffers array.
*/ */
typedef struct { typedef struct {
CloseScreenProcPtr CloseScreen;
PixmapPtr sourceBits; /* source bits */ PixmapPtr sourceBits; /* source bits */
PixmapPtr maskBits; /* mask bits */ PixmapPtr maskBits; /* mask bits */
PicturePtr pPicture; PicturePtr pPicture;
@ -102,9 +102,7 @@ miDCInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
if (!pScreenPriv) if (!pScreenPriv)
return FALSE; return FALSE;
pScreenPriv->CloseScreen = pScreen->CloseScreen; dixScreenHookClose(pScreen, miDCCloseScreen);
pScreen->CloseScreen = miDCCloseScreen;
dixSetPrivate(&pScreen->devPrivates, miDCScreenKey, pScreenPriv); dixSetPrivate(&pScreen->devPrivates, miDCScreenKey, pScreenPriv);
if (!miSpriteInitialize(pScreen, screenFuncs)) { if (!miSpriteInitialize(pScreen, screenFuncs)) {
@ -118,6 +116,8 @@ static void
miDCSwitchScreenCursor(ScreenPtr pScreen, CursorPtr pCursor, PixmapPtr sourceBits, PixmapPtr maskBits, PicturePtr pPicture) miDCSwitchScreenCursor(ScreenPtr pScreen, CursorPtr pCursor, PixmapPtr sourceBits, PixmapPtr maskBits, PicturePtr pPicture)
{ {
miDCScreenPtr pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey); miDCScreenPtr pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey);
if (!pScreenPriv)
return;
dixDestroyPixmap(pScreenPriv->sourceBits, 0); dixDestroyPixmap(pScreenPriv->sourceBits, 0);
pScreenPriv->sourceBits = sourceBits; pScreenPriv->sourceBits = sourceBits;
@ -133,18 +133,16 @@ miDCSwitchScreenCursor(ScreenPtr pScreen, CursorPtr pCursor, PixmapPtr sourceBit
pScreenPriv->pCursor = pCursor; pScreenPriv->pCursor = pCursor;
} }
static Bool static void miDCCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
miDCCloseScreen(ScreenPtr pScreen)
{ {
miDCScreenPtr pScreenPriv; dixScreenUnhookClose(pScreen, miDCCloseScreen);
miDCScreenPtr pScreenPriv;
pScreenPriv = (miDCScreenPtr) dixLookupPrivate(&pScreen->devPrivates, pScreenPriv = (miDCScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey); miDCScreenKey);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
miDCSwitchScreenCursor(pScreen, NULL, NULL, NULL, NULL); miDCSwitchScreenCursor(pScreen, NULL, NULL, NULL, NULL);
free((void *) pScreenPriv); free((void *) pScreenPriv);
return (*pScreen->CloseScreen) (pScreen); dixSetPrivate(&pScreen->devPrivates, miDCScreenKey, NULL); /* clear it, just for sure */
} }
Bool Bool

View File

@ -2,12 +2,14 @@
#include <dix-config.h> #include <dix-config.h>
#include <X11/X.h> #include <X11/X.h>
#include <X11/Xmd.h>
#include <X11/extensions/shapeproto.h>
#include "dix/cursor_priv.h" #include "dix/cursor_priv.h"
#include "dix/screen_hooks_priv.h"
#include "mi/mi_priv.h" #include "mi/mi_priv.h"
#include "scrnintstr.h" #include "scrnintstr.h"
#include <X11/extensions/shapeproto.h>
#include "validate.h" #include "validate.h"
#include "windowstr.h" #include "windowstr.h"
#include "gcstruct.h" #include "gcstruct.h"
@ -44,7 +46,6 @@ typedef struct {
} miOverlayWindowRec, *miOverlayWindowPtr; } miOverlayWindowRec, *miOverlayWindowPtr;
typedef struct { typedef struct {
CloseScreenProcPtr CloseScreen;
CreateWindowProcPtr CreateWindow; CreateWindowProcPtr CreateWindow;
DestroyWindowProcPtr DestroyWindow; DestroyWindowProcPtr DestroyWindow;
UnrealizeWindowProcPtr UnrealizeWindow; UnrealizeWindowProcPtr UnrealizeWindow;
@ -67,7 +68,7 @@ static Bool HasUnderlayChildren(WindowPtr);
static void MarkUnderlayWindow(WindowPtr); static void MarkUnderlayWindow(WindowPtr);
static Bool CollectUnderlayChildrenRegions(WindowPtr, RegionPtr); static Bool CollectUnderlayChildrenRegions(WindowPtr, RegionPtr);
static Bool miOverlayCloseScreen(ScreenPtr); static void miOverlayCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused);
static Bool miOverlayCreateWindow(WindowPtr); static Bool miOverlayCreateWindow(WindowPtr);
static Bool miOverlayDestroyWindow(WindowPtr); static Bool miOverlayDestroyWindow(WindowPtr);
static Bool miOverlayUnrealizeWindow(WindowPtr); static Bool miOverlayUnrealizeWindow(WindowPtr);
@ -126,18 +127,17 @@ miInitOverlay(ScreenPtr pScreen,
return FALSE; return FALSE;
dixSetPrivate(&pScreen->devPrivates, miOverlayScreenKey, pScreenPriv); dixSetPrivate(&pScreen->devPrivates, miOverlayScreenKey, pScreenPriv);
dixScreenHookClose(pScreen, miOverlayCloseScreen);
pScreenPriv->InOverlay = inOverlayFunc; pScreenPriv->InOverlay = inOverlayFunc;
pScreenPriv->MakeTransparent = transFunc; pScreenPriv->MakeTransparent = transFunc;
pScreenPriv->underlayMarked = FALSE; pScreenPriv->underlayMarked = FALSE;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreenPriv->CreateWindow = pScreen->CreateWindow; pScreenPriv->CreateWindow = pScreen->CreateWindow;
pScreenPriv->DestroyWindow = pScreen->DestroyWindow; pScreenPriv->DestroyWindow = pScreen->DestroyWindow;
pScreenPriv->UnrealizeWindow = pScreen->UnrealizeWindow; pScreenPriv->UnrealizeWindow = pScreen->UnrealizeWindow;
pScreenPriv->RealizeWindow = pScreen->RealizeWindow; pScreenPriv->RealizeWindow = pScreen->RealizeWindow;
pScreen->CloseScreen = miOverlayCloseScreen;
pScreen->CreateWindow = miOverlayCreateWindow; pScreen->CreateWindow = miOverlayCreateWindow;
pScreen->DestroyWindow = miOverlayDestroyWindow; pScreen->DestroyWindow = miOverlayDestroyWindow;
pScreen->UnrealizeWindow = miOverlayUnrealizeWindow; pScreen->UnrealizeWindow = miOverlayUnrealizeWindow;
@ -160,20 +160,21 @@ miInitOverlay(ScreenPtr pScreen,
return TRUE; return TRUE;
} }
static Bool static void miOverlayCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
miOverlayCloseScreen(ScreenPtr pScreen)
{ {
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->CreateWindow = pScreenPriv->CreateWindow;
pScreen->DestroyWindow = pScreenPriv->DestroyWindow; pScreen->DestroyWindow = pScreenPriv->DestroyWindow;
pScreen->UnrealizeWindow = pScreenPriv->UnrealizeWindow; pScreen->UnrealizeWindow = pScreenPriv->UnrealizeWindow;
pScreen->RealizeWindow = pScreenPriv->RealizeWindow; pScreen->RealizeWindow = pScreenPriv->RealizeWindow;
free(pScreenPriv); free(pScreenPriv);
dixSetPrivate(&pScreen->devPrivates, miOverlayScreenKey, NULL);
return (*pScreen->CloseScreen) (pScreen);
} }
static Bool 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/cursor_priv.h"
#include "dix/dix_priv.h" #include "dix/dix_priv.h"
#include "dix/input_priv.h" #include "dix/input_priv.h"
#include "dix/screen_hooks_priv.h"
#include "mi/mi_priv.h" #include "mi/mi_priv.h"
#include "mi/mipointer_priv.h" #include "mi/mipointer_priv.h"
@ -107,7 +108,7 @@ static void miPointerCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen,
BoxPtr pTopLeftBox); BoxPtr pTopLeftBox);
static Bool miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen, static Bool miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen,
int x, int y, Bool generateEvent); 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 void miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y);
static Bool miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen); static Bool miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
static void miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen); static void miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
@ -140,8 +141,7 @@ miPointerInitialize(ScreenPtr pScreen,
pScreenPriv->screenFuncs = screenFuncs; pScreenPriv->screenFuncs = screenFuncs;
pScreenPriv->waitForUpdate = waitForUpdate; pScreenPriv->waitForUpdate = waitForUpdate;
pScreenPriv->showTransparent = FALSE; pScreenPriv->showTransparent = FALSE;
pScreenPriv->CloseScreen = pScreen->CloseScreen; dixScreenHookClose(pScreen, miPointerCloseScreen);
pScreen->CloseScreen = miPointerCloseScreen;
dixSetPrivate(&pScreen->devPrivates, miPointerScreenKey, pScreenPriv); dixSetPrivate(&pScreen->devPrivates, miPointerScreenKey, pScreenPriv);
/* /*
* set up screen cursor method table * set up screen cursor method table
@ -163,19 +163,17 @@ miPointerInitialize(ScreenPtr pScreen,
/** /**
* Destroy screen-specific information. * Destroy screen-specific information.
* *
* @param index Screen index of the screen in screenInfo.screens[]
* @param pScreen The actual screen pointer * @param pScreen The actual screen pointer
*/ */
static Bool static void miPointerCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
miPointerCloseScreen(ScreenPtr pScreen)
{ {
SetupScreen(pScreen); SetupScreen(pScreen);
pScreen->CloseScreen = pScreenPriv->CloseScreen; dixScreenUnhookClose(pScreen, miPointerCloseScreen);
free((void *) pScreenPriv); free((void *) pScreenPriv);
dixSetPrivate(&pScreen->devPrivates, miPointerScreenKey, NULL);
FreeEventList(mipointermove_events, GetMaximumEventsNum()); FreeEventList(mipointermove_events, GetMaximumEventsNum());
mipointermove_events = NULL; 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/colormap_priv.h"
#include "dix/dix_priv.h" #include "dix/dix_priv.h"
#include "dix/screen_hooks_priv.h"
#include "mi/mipointer_priv.h" #include "mi/mipointer_priv.h"
#include "misc.h" #include "misc.h"
@ -72,7 +73,6 @@ typedef struct {
typedef struct { typedef struct {
/* screen procedures */ /* screen procedures */
CloseScreenProcPtr CloseScreen;
SourceValidateProcPtr SourceValidate; SourceValidateProcPtr SourceValidate;
/* window procedures */ /* window procedures */
@ -190,7 +190,7 @@ miSpriteIsDown(miCursorInfoPtr pDevCursor)
* screen wrappers * 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, static void miSpriteSourceValidate(DrawablePtr pDrawable, int x, int y,
int width, int height, int width, int height,
unsigned int subWindowMode); unsigned int subWindowMode);
@ -309,7 +309,6 @@ miSpriteInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
for (pVisual = pScreen->visuals; for (pVisual = pScreen->visuals;
pVisual->vid != pScreen->rootVisual; pVisual++); pVisual->vid != pScreen->rootVisual; pVisual++);
pScreenPriv->pVisual = pVisual; pScreenPriv->pVisual = pVisual;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreenPriv->SourceValidate = pScreen->SourceValidate; pScreenPriv->SourceValidate = pScreen->SourceValidate;
pScreenPriv->CopyWindow = pScreen->CopyWindow; pScreenPriv->CopyWindow = pScreen->CopyWindow;
@ -332,7 +331,7 @@ miSpriteInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
dixSetPrivate(&pScreen->devPrivates, &miSpriteScreenKeyRec, pScreenPriv); dixSetPrivate(&pScreen->devPrivates, &miSpriteScreenKeyRec, pScreenPriv);
pScreen->CloseScreen = miSpriteCloseScreen; dixScreenHookClose(pScreen, miSpriteCloseScreen);
pScreen->SourceValidate = miSpriteSourceValidate; pScreen->SourceValidate = miSpriteSourceValidate;
pScreen->CopyWindow = miSpriteCopyWindow; pScreen->CopyWindow = miSpriteCopyWindow;
@ -346,26 +345,22 @@ miSpriteInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
* Screen wrappers * Screen wrappers
*/ */
/* static void miSpriteCloseScreen(CallbackListPtr *pcbl, ScreenPtr pScreen, void *unused)
* CloseScreen wrapper -- unwrap everything, free the private data
* and call the wrapped function
*/
static Bool
miSpriteCloseScreen(ScreenPtr pScreen)
{ {
miSpriteScreenPtr pScreenPriv = GetSpriteScreen(pScreen); dixScreenUnhookClose(pScreen, miSpriteCloseScreen);
miSpriteScreenPtr pScreenPriv = GetSpriteScreen(pScreen);
if (!pScreenPriv)
return;
pScreen->CloseScreen = pScreenPriv->CloseScreen;
pScreen->SourceValidate = pScreenPriv->SourceValidate; pScreen->SourceValidate = pScreenPriv->SourceValidate;
pScreen->InstallColormap = pScreenPriv->InstallColormap; pScreen->InstallColormap = pScreenPriv->InstallColormap;
pScreen->StoreColors = pScreenPriv->StoreColors; pScreen->StoreColors = pScreenPriv->StoreColors;
DamageDestroy(pScreenPriv->pDamage); DamageDestroy(pScreenPriv->pDamage);
dixSetPrivate(&pScreen->devPrivates, &miSpriteScreenKeyRec, NULL);
free(pScreenPriv); free(pScreenPriv);
return (*pScreen->CloseScreen) (pScreen);
} }
static void static void

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -37,12 +37,12 @@
#include "rootlessCommon.h" #include "rootlessCommon.h"
Bool RootlessCreateWindow(WindowPtr pWin); Bool RootlessCreateWindow(WindowPtr pWin);
Bool RootlessDestroyWindow(WindowPtr pWin); void RootlessWindowDestroy(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr pWin);
void RootlessSetShape(WindowPtr pWin, int kind); void RootlessSetShape(WindowPtr pWin, int kind);
Bool RootlessChangeWindowAttributes(WindowPtr pWin, unsigned long vmask); 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 RootlessRealizeWindow(WindowPtr pWin);
Bool RootlessUnrealizeWindow(WindowPtr pWin); Bool RootlessUnrealizeWindow(WindowPtr pWin);
void RootlessRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib); void RootlessRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -21,6 +21,8 @@
*/ */
#include <dix-config.h> #include <dix-config.h>
#include "dix/screen_hooks_priv.h"
#include "present_priv.h" #include "present_priv.h"
int present_request; 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 * Hook the close screen function to clean up our screen private
*/ */
static Bool static void present_close_screen(CallbackListPtr *pcbl, ScreenPtr screen, void *unused)
present_close_screen(ScreenPtr screen)
{ {
present_screen_priv_ptr screen_priv = present_screen_priv(screen); present_screen_priv_ptr screen_priv = present_screen_priv(screen);
if (!screen_priv)
return;
if (screen_priv->flip_destroy) if (screen_priv->flip_destroy)
screen_priv->flip_destroy(screen); screen_priv->flip_destroy(screen);
unwrap(screen_priv, screen, CloseScreen); dixScreenUnhookClose(screen, present_close_screen);
(*screen->CloseScreen) (screen); dixSetPrivate(&screen->devPrivates, &present_screen_private_key, NULL);
free(screen_priv); 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 * Hook the close window function to clean up our window private
*/ */
static Bool static void
present_destroy_window(WindowPtr window) present_destroy_window(CallbackListPtr *pcbl, ScreenPtr pScreen, WindowPtr window)
{ {
Bool ret;
ScreenPtr screen = window->drawable.pScreen; ScreenPtr screen = window->drawable.pScreen;
present_screen_priv_ptr screen_priv = present_screen_priv(screen); present_screen_priv_ptr screen_priv = present_screen_priv(screen);
present_window_priv_ptr window_priv = present_window_priv(window); present_window_priv_ptr window_priv = present_window_priv(window);
@ -112,13 +113,6 @@ present_destroy_window(WindowPtr window)
free(window_priv); 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) if (!screen_priv)
return NULL; return NULL;
wrap(screen_priv, screen, CloseScreen, present_close_screen); dixScreenHookWindowDestroy(screen, present_destroy_window);
wrap(screen_priv, screen, DestroyWindow, present_destroy_window); dixScreenHookClose(screen, present_close_screen);
wrap(screen_priv, screen, ConfigNotify, present_config_notify); wrap(screen_priv, screen, ConfigNotify, present_config_notify);
wrap(screen_priv, screen, ClipNotify, present_clip_notify); wrap(screen_priv, screen, ClipNotify, present_clip_notify);

View File

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

View File

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

View File

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

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