Compare commits

...

22 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult b89f46dfa6 glamor: unexport GLAMOR_CREATE_PIXMAP_* defines
Not used by any external drivers, so no need to keep it in public API.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:24 +02:00
Enrico Weigelt, metux IT consult aa8f9d76e3 glamor: unexport glamor_copy_window()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:24 +02:00
Enrico Weigelt, metux IT consult a0a0f329c0 glamor: unexport glamor_change_window_attributes()
Not needed by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:24 +02:00
Enrico Weigelt, metux IT consult 0e8c35d7d8 glamor: unexport glamor_egl_screen_init()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:24 +02:00
Enrico Weigelt, metux IT consult f7957d7cb3 glamor: unexport glamor_get_drawable_modifiers()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:24 +02:00
Enrico Weigelt, metux IT consult fe692876ca glamor: unexport glamor_get_modifiers()
Not used by any external driveres, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:24 +02:00
Enrico Weigelt, metux IT consult 1ee814f41a glamor: unexport glamor_get_formats()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:24 +02:00
Enrico Weigelt, metux IT consult 088ed05ecf glamor: unexport glamor_pixmap_from_fds()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:24 +02:00
Enrico Weigelt, metux IT consult 6df6b87e5c glamor: unexport glamor_fds_from_pixmap()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:24 +02:00
Enrico Weigelt, metux IT consult 65d57e1dc9 glamor: unexport glamor_egl_fd_from_pixmap()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:24 +02:00
Enrico Weigelt, metux IT consult 3fe5fa739a glamor: unexport glamor_egl_fd_name_from_pixmap()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:24 +02:00
Enrico Weigelt, metux IT consult 401ce069a2 glamor: unexport glamor_egl_fds_from_pixmap()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:24 +02:00
Enrico Weigelt, metux IT consult ce2f0c25bd glamor: unexport glamor_enable_dri3()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:23 +02:00
Enrico Weigelt, metux IT consult ad807d1eae glamor: unexport glamor_pixmap_exchange_fbos()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:23 +02:00
Enrico Weigelt, metux IT consult e92b0aa30b glamor: unexport glamor_set_glvnd_vendor()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:23 +02:00
Enrico Weigelt, metux IT consult 6376dd8cef glamor: unexport glamor_set_pixmap_type()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:23 +02:00
Enrico Weigelt, metux IT consult 18d77154ad glamor: unexport glamor_set_pixmap_texture()
Not used by any external drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:23 +02:00
Enrico Weigelt, metux IT consult e88307386d glamor: make glamor_destroy_gc() static
Only needed inside glamor_core.c, no external callers, so it can be static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:23 +02:00
Enrico Weigelt, metux IT consult a2c4cb2a10 glamor: drop glamor_egl_create_textured_screen()
Not used anymore, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:23 +02:00
Enrico Weigelt, metux IT consult 9975aff2d8 glamor: drop glamor_egl_create_textured_screen_ext() macro
Not used anymore, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:23 +02:00
Enrico Weigelt, metux IT consult 00eaff0d6e glamor: drop glamor_get_glvnd_vendor()
Not used anywhere, so no need to keep it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:23 +02:00
Enrico Weigelt, metux IT consult 687049f394 ephyr: workaround for name clash between Xlib and Xserver
A slight change in include order can cause Xlib to be included and defining
"GC" type, which is conflicting with Xserver's own type by same name.

As long as MR !1393 hasn't merged yet, we need to do an ugly workaround
using some preprocessor black magic.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-05-20 10:51:17 +02:00
9 changed files with 103 additions and 146 deletions

View File

@ -957,17 +957,6 @@ glamor_set_glvnd_vendor(ScreenPtr screen, const char *vendor_name)
glamor_priv->glvnd_vendor = XNFstrdup(vendor_name);
}
const char *
glamor_get_glvnd_vendor(ScreenPtr screen)
{
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
if (!glamor_priv)
return NULL;
return glamor_priv->glvnd_vendor;
}
void
glamor_enable_dri3(ScreenPtr screen)
{

View File

@ -110,33 +110,14 @@ extern _X_EXPORT Bool glamor_close_screen(ScreenPtr screen);
extern _X_EXPORT uint32_t glamor_get_pixmap_texture(PixmapPtr pixmap);
extern _X_EXPORT Bool glamor_set_pixmap_texture(PixmapPtr pixmap,
unsigned int tex);
extern _X_EXPORT void glamor_set_pixmap_type(PixmapPtr pixmap,
glamor_pixmap_type_t type);
extern _X_EXPORT void glamor_clear_pixmap(PixmapPtr pixmap);
extern _X_EXPORT void glamor_block_handler(ScreenPtr screen);
/* This function should be called after glamor_init,
* but before adding a glamor GLX provider */
extern _X_EXPORT void glamor_set_glvnd_vendor(ScreenPtr screen,
const char *vendor);
extern _X_EXPORT const char *glamor_get_glvnd_vendor(ScreenPtr screen);
extern _X_EXPORT PixmapPtr glamor_create_pixmap(ScreenPtr screen, int w, int h,
int depth, unsigned int usage);
extern _X_EXPORT Bool glamor_destroy_pixmap(PixmapPtr pixmap);
#define GLAMOR_CREATE_PIXMAP_CPU 0x100
#define GLAMOR_CREATE_PIXMAP_FIXUP 0x101
#define GLAMOR_CREATE_FBO_NO_FBO 0x103
#define GLAMOR_CREATE_NO_LARGE 0x105
#define GLAMOR_CREATE_PIXMAP_NO_TEXTURE 0x106
#define GLAMOR_CREATE_FORMAT_CBCR 0x107
/* @glamor_egl_exchange_buffers: Exchange the underlying buffers(KHR image,fbo).
*
* @front: front pixmap.
@ -148,19 +129,7 @@ extern _X_EXPORT Bool glamor_destroy_pixmap(PixmapPtr pixmap);
extern _X_EXPORT void glamor_egl_exchange_buffers(PixmapPtr front,
PixmapPtr back);
extern _X_EXPORT void glamor_pixmap_exchange_fbos(PixmapPtr front,
PixmapPtr back);
/* The DDX is not supposed to call these four functions */
extern _X_EXPORT void glamor_enable_dri3(ScreenPtr screen);
extern _X_EXPORT int glamor_egl_fds_from_pixmap(ScreenPtr, PixmapPtr, int *,
uint32_t *, uint32_t *,
uint64_t *);
extern _X_EXPORT int glamor_egl_fd_name_from_pixmap(ScreenPtr, PixmapPtr,
CARD16 *, CARD32 *);
extern _X_EXPORT struct gbm_device *glamor_egl_get_gbm_device(ScreenPtr screen);
extern _X_EXPORT int glamor_egl_fd_from_pixmap(ScreenPtr, PixmapPtr, CARD16 *, CARD32 *);
/* @glamor_supports_pixmap_import_export: Returns whether
* glamor_fds_from_pixmap(), glamor_name_from_pixmap(), and
@ -177,23 +146,6 @@ extern _X_EXPORT int glamor_egl_fd_from_pixmap(ScreenPtr, PixmapPtr, CARD16 *, C
* */
extern _X_EXPORT Bool glamor_supports_pixmap_import_export(ScreenPtr screen);
/* @glamor_fds_from_pixmap: Get a dma-buf fd from a pixmap.
*
* @screen: Current screen pointer.
* @pixmap: The pixmap from which we want the fd.
* @fds, @strides, @offsets: Pointers to fill info of each plane.
* @modifier: Pointer to fill the modifier of the buffer.
*
* the pixmap and the buffer associated by the fds will share the same
* content. The caller is responsible to close the returned file descriptors.
* Returns the number of planes, -1 on error.
* */
extern _X_EXPORT int glamor_fds_from_pixmap(ScreenPtr screen,
PixmapPtr pixmap,
int *fds,
uint32_t *strides, uint32_t *offsets,
uint64_t *modifier);
/* @glamor_fd_from_pixmap: Get a dma-buf fd from a pixmap.
*
* @screen: Current screen pointer.
@ -259,31 +211,6 @@ extern _X_EXPORT int glamor_name_from_pixmap(PixmapPtr pixmap,
extern _X_EXPORT struct gbm_bo *glamor_gbm_bo_from_pixmap(ScreenPtr screen,
PixmapPtr pixmap);
/* @glamor_pixmap_from_fds: Creates a pixmap to wrap a dma-buf fds.
*
* @screen: Current screen pointer.
* @num_fds: Number of fds to import
* @fds: The dma-buf fds to import.
* @width: The width of the buffers.
* @height: The height of the buffers.
* @stride: The stride of the buffers.
* @depth: The depth of the buffers.
* @bpp: The bpp of the buffers.
* @modifier: The modifier of the buffers.
*
* Returns a valid pixmap if the import succeeded, else NULL.
* */
extern _X_EXPORT PixmapPtr glamor_pixmap_from_fds(ScreenPtr screen,
CARD8 num_fds,
const int *fds,
CARD16 width,
CARD16 height,
const CARD32 *strides,
const CARD32 *offsets,
CARD8 depth,
CARD8 bpp,
uint64_t modifier);
/* @glamor_pixmap_from_fd: Creates a pixmap to wrap a dma-buf fd.
*
* @screen: Current screen pointer.
@ -324,20 +251,6 @@ extern _X_EXPORT Bool glamor_back_pixmap_from_fd(PixmapPtr pixmap,
CARD8 depth,
CARD8 bpp);
extern _X_EXPORT Bool glamor_get_formats(ScreenPtr screen,
CARD32 *num_formats,
CARD32 **formats);
extern _X_EXPORT Bool glamor_get_modifiers(ScreenPtr screen,
uint32_t format,
uint32_t *num_modifiers,
uint64_t **modifiers);
extern _X_EXPORT Bool glamor_get_drawable_modifiers(DrawablePtr draw,
uint32_t format,
uint32_t *num_modifiers,
uint64_t **modifiers);
extern _X_EXPORT void glamor_set_drawable_modifiers_func(ScreenPtr screen,
GetDrawableModifiersFuncPtr func);
@ -358,24 +271,6 @@ extern _X_EXPORT Bool glamor_egl_init(ScrnInfoPtr scrn, int fd);
extern _X_EXPORT Bool glamor_egl_init_textured_pixmap(ScreenPtr screen);
/* @glamor_egl_create_textured_screen: Create textured screen pixmap.
*
* @screen: screen pointer to be processed.
* @handle: screen pixmap's BO handle.
* @stride: screen pixmap's stride in bytes.
*
* This function is similar with the create_textured_pixmap. As the
* screen pixmap is a special, we handle it separately in this function.
*/
extern _X_EXPORT Bool glamor_egl_create_textured_screen(ScreenPtr screen,
int handle, int stride);
/* Obsolete entrypoint, temporarily left here for API compatibility
* for xf86-video-ati.
*/
#define glamor_egl_create_textured_screen_ext(a, b, c, d) \
glamor_egl_create_textured_screen(a, b, c)
/*
* @glamor_egl_create_textured_pixmap: Try to create a textured pixmap from
* a BO handle.
@ -409,21 +304,13 @@ extern _X_EXPORT const char *glamor_egl_get_driver_name(ScreenPtr screen);
#endif
extern _X_EXPORT void glamor_egl_screen_init(ScreenPtr screen,
struct glamor_context *glamor_ctx);
extern _X_EXPORT int glamor_create_gc(GCPtr gc);
extern _X_EXPORT void glamor_validate_gc(GCPtr gc, unsigned long changes,
DrawablePtr drawable);
extern _X_EXPORT void glamor_destroy_gc(GCPtr gc);
#define HAS_GLAMOR_DESTROY_GC 1
extern Bool _X_EXPORT glamor_change_window_attributes(WindowPtr pWin, unsigned long mask);
extern void _X_EXPORT glamor_copy_window(WindowPtr window, DDXPointRec old_origin, RegionPtr src_region);
extern _X_EXPORT void glamor_finish(ScreenPtr screen);
#define HAS_GLAMOR_TEXT 1

View File

@ -248,7 +248,7 @@ glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable)
gc->ops = &glamor_gc_ops;
}
void
static void
glamor_destroy_gc(GCPtr gc)
{
glamor_gc_private *gc_priv = glamor_get_gc_private(gc);

View File

@ -42,10 +42,9 @@
#include <gbm.h>
#include <drm_fourcc.h>
#include "glamor_egl.h"
#include "glamor/glamor_priv.h"
#include "glamor.h"
#include "glamor_priv.h"
#include "glamor_egl.h"
#include "glamor_glx_provider.h"
#include "dri3.h"
@ -145,22 +144,6 @@ glamor_egl_get_gbm_device(ScreenPtr screen)
return glamor_egl->gbm;
}
Bool
glamor_egl_create_textured_screen(ScreenPtr screen, int handle, int stride)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
PixmapPtr screen_pixmap;
screen_pixmap = screen->GetScreenPixmap(screen);
if (!glamor_egl_create_textured_pixmap(screen_pixmap, handle, stride)) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
"Failed to create textured screen.");
return FALSE;
}
return TRUE;
}
static void
glamor_egl_set_pixmap_image(PixmapPtr pixmap, EGLImageKHR image,
Bool used_modifiers)

View File

@ -28,7 +28,7 @@
#include <stdlib.h>
#include "glamor_priv.h"
#include "glamor/glamor_priv.h"
void
glamor_destroy_fbo(glamor_screen_private *glamor_priv,

View File

@ -173,6 +173,13 @@ enum gradient_shader {
SHADER_GRADIENT_COUNT,
};
#define GLAMOR_CREATE_PIXMAP_CPU 0x100
#define GLAMOR_CREATE_PIXMAP_FIXUP 0x101
#define GLAMOR_CREATE_FBO_NO_FBO 0x103
#define GLAMOR_CREATE_NO_LARGE 0x105
#define GLAMOR_CREATE_PIXMAP_NO_TEXTURE 0x106
#define GLAMOR_CREATE_FORMAT_CBCR 0x107
struct glamor_screen_private;
struct glamor_pixmap_private;
@ -982,6 +989,85 @@ int glamor_xv_put_image(glamor_port_private *port_priv,
void glamor_xv_core_init(ScreenPtr screen);
void glamor_xv_render(glamor_port_private *port_priv, int id);
Bool glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex);
void glamor_set_pixmap_type(PixmapPtr pixmap, glamor_pixmap_type_t type);
/* This function should be called after glamor_init,
* but before adding a glamor GLX provider */
void glamor_set_glvnd_vendor(ScreenPtr screen, const char *vendor);
void glamor_pixmap_exchange_fbos(PixmapPtr front, PixmapPtr back);
/* The DDX is not supposed to call these four functions */
void glamor_enable_dri3(ScreenPtr screen);
int glamor_egl_fds_from_pixmap(ScreenPtr pScreen, PixmapPtr pPixmap, int *fds,
uint32_t *strides, uint32_t *offsets,
uint64_t *modifier);
int glamor_egl_fd_name_from_pixmap(ScreenPtr pScreen, PixmapPtr pPixmap,
CARD16 *stride, CARD32 *size);
int glamor_egl_fd_from_pixmap(ScreenPtr, PixmapPtr, CARD16 *, CARD32 *);
/* @glamor_fds_from_pixmap: Get a dma-buf fd from a pixmap.
*
* @screen: Current screen pointer.
* @pixmap: The pixmap from which we want the fd.
* @fds, @strides, @offsets: Pointers to fill info of each plane.
* @modifier: Pointer to fill the modifier of the buffer.
*
* the pixmap and the buffer associated by the fds will share the same
* content. The caller is responsible to close the returned file descriptors.
* Returns the number of planes, -1 on error.
* */
int glamor_fds_from_pixmap(ScreenPtr screen, PixmapPtr pixmap, int *fds,
uint32_t *strides, uint32_t *offsets,
uint64_t *modifier);
/* @glamor_pixmap_from_fds: Creates a pixmap to wrap a dma-buf fds.
*
* @screen: Current screen pointer.
* @num_fds: Number of fds to import
* @fds: The dma-buf fds to import.
* @width: The width of the buffers.
* @height: The height of the buffers.
* @stride: The stride of the buffers.
* @depth: The depth of the buffers.
* @bpp: The bpp of the buffers.
* @modifier: The modifier of the buffers.
*
* Returns a valid pixmap if the import succeeded, else NULL.
* */
PixmapPtr glamor_pixmap_from_fds(ScreenPtr screen,
CARD8 num_fds,
const int *fds,
CARD16 width,
CARD16 height,
const CARD32 *strides,
const CARD32 *offsets,
CARD8 depth,
CARD8 bpp,
uint64_t modifier);
Bool glamor_get_formats(ScreenPtr screen, CARD32 *num_formats, CARD32 **formats);
Bool glamor_get_modifiers(ScreenPtr screen,
uint32_t format,
uint32_t *num_modifiers,
uint64_t **modifiers);
Bool glamor_get_drawable_modifiers(DrawablePtr draw,
uint32_t format,
uint32_t *num_modifiers,
uint64_t **modifiers);
void glamor_egl_screen_init(ScreenPtr screen,
struct glamor_context *glamor_ctx);
Bool glamor_change_window_attributes(WindowPtr pWin, unsigned long mask);
void glamor_copy_window(WindowPtr window, DDXPointRec old_origin, RegionPtr src_region);
#include "glamor_utils.h"
#if 0

View File

@ -37,7 +37,16 @@
#include <sys/time.h>
#include <sys/mman.h>
// workaround for name clash between Xlib and Xserver:
// GL might pull in Xlib.h (why ?), which is definining a type "GC", that's
// conflicting with Xserver's "GC" type.
#define GC XlibGC
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#undef GC
#include "dix/input_priv.h"
#include "glamor/glamor_priv.h"
#include "hostx.h"
@ -58,7 +67,6 @@
#include <xcb/glx.h>
#include <epoxy/common.h>
#include <epoxy/gl.h>
#include "glamor.h"
#include "glamor_glx_provider.h"
#include "ephyr_glamor.h"
#endif

View File

@ -55,6 +55,8 @@
#include <dri3.h>
#include "drm-client-protocol.h"
#include "glamor/glamor_priv.h"
#include "xwayland-glamor.h"
#include "xwayland-glamor-gbm.h"
#include "xwayland-pixmap.h"

View File

@ -25,6 +25,8 @@
#include <xwayland-config.h>
#include "glamor/glamor_priv.h"
#define MESA_EGL_NO_X11_HEADERS
#define EGL_NO_X11
#include <glamor_egl.h>