From 4cbbd0df9a130ec08cdfa79db2cbaa235cf293da Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 7 Oct 2024 13:43:10 +0200 Subject: [PATCH] WIP1 --- include/dix_pixmap.h | 58 ++++++++++++++++++++++++++++++++++ include/xorg-server.h.meson.in | 1 + 2 files changed, 59 insertions(+) create mode 100644 include/dix_pixmap.h diff --git a/include/dix_pixmap.h b/include/dix_pixmap.h new file mode 100644 index 000000000..6b795427b --- /dev/null +++ b/include/dix_pixmap.h @@ -0,0 +1,58 @@ +/* SPDX-License-Identifier: MIT OR X11 + * + * Copyright © 2024 Enrico Weigelt, metux IT consult + * + * @brief generic pixmap functions + * + * These functions replacing directly calling into ScreenRec vectors and also + * take care of calling hooks. + + * NOTE: The ScreenProc vectors should never be called directly anymore, + * otherwise hooks might not be called. + */ +#ifndef DIX_PIXMAP_H +#define DIX_PIXMAP_H + +#include + +#include "screenint.h" /* ScreenPtr */ +#include "window.h" /* WindowPtr */ + +/* + * @brief create a pixmap on specified screen + * + * Call into driver and hooks for creating a pixmap with given geometry. + * + * @param pScreen the screen to create the pixmap on + * @param width width of the new pixmap + * @param height height of the new pixmap + * @param depth color depth of the new pixmap + * @param usage_hints allocation hints - see CREATE_PIXMAP_USAGE_* defines + * @result pointer to new pixmap or NULL on failure + */ +_X_EXPORT PixmapPtr dixPixmapCreate(ScreenPtr pScreen, + uint32_t width, + uint32_t height, + uint32_t depth, + uint32_t usage_hint); + +/* + * @brief increase pixmap reference counter + * + * Increase the pixmap's reference counter. + * + * @param pPixmap the pixmap who's reference counter is increased + * @return the original pPixmap value (for function chaining) + */ +_X_EXPORT PixmapPtr dixPixmapGet(PixmapPtr pPixmap); + +/* + * @brief decrease reference counter and potentially release it + * + * Decrease the pixmap's reference counter. If it reaches zero, destroy it. + * + * @param pPixmap the pixmap to release (NULL protected) + */ +_X_EXPORT void dixPixmapPut(PixmapPtr pPixmap); + +#endif /* DIX_PIXMAP_H */ diff --git a/include/xorg-server.h.meson.in b/include/xorg-server.h.meson.in index 60dbb5dbe..839c7f41e 100644 --- a/include/xorg-server.h.meson.in +++ b/include/xorg-server.h.meson.in @@ -215,5 +215,6 @@ #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 +#define XORG_API_DIX_PIXMAP_LIFETIME 1 #endif /* _XORG_SERVER_H_ */