mirror of
https://github.com/X11Libre/xserver.git
synced 2026-11-23 06:43:07 +00:00
glamor_egl: Add some compatibility defines for missing libdrm
Allows us to get rid of some ifdefs and should get direct DRI3 working without libdrm Signed-off-by: stefan11111 <stefan11111github@gmail.com>
This commit is contained in:
parent
5f44d74b4a
commit
69c3f90728
1 changed files with 29 additions and 36 deletions
|
|
@ -72,6 +72,29 @@
|
|||
#define GBM_MAX_PLANES 4
|
||||
#endif
|
||||
|
||||
/* libdrm compat */
|
||||
#ifndef DRM_FORMAT_MOD_LINEAR
|
||||
#define DRM_FORMAT_MOD_LINEAR 0ULL
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_MOD_INVALID
|
||||
#define DRM_FORMAT_MOD_INVALID 0x00ffffffffffffffULL
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_ARGB1555
|
||||
#define DRM_FORMAT_ARGB1555 0x35315241
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_RGB565
|
||||
#define DRM_FORMAT_RGB565 0x36314752
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_XRGB8888
|
||||
#define DRM_FORMAT_XRGB8888 0x34325258
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_ARGB8888
|
||||
#define DRM_FORMAT_ARGB8888 0x34325241
|
||||
#endif
|
||||
#ifndef DRM_FORMAT_ARGB2101010
|
||||
#define DRM_FORMAT_ARGB2101010 0x30335241
|
||||
#endif
|
||||
|
||||
#define GLAMOR_LOG_STR(idx, type, str) \
|
||||
do { \
|
||||
if ((idx) != -1) { \
|
||||
|
|
@ -209,7 +232,7 @@ glamor_egl_make_current(struct glamor_context *glamor_ctx)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(GLAMOR_HAS_GBM) && defined (WITH_LIBDRM)
|
||||
#if defined(GLAMOR_HAS_GBM) && defined(WITH_LIBDRM)
|
||||
static int
|
||||
glamor_get_flink_name(int fd, int handle, int *name)
|
||||
{
|
||||
|
|
@ -600,12 +623,6 @@ glamor_egl_create_textured_pixmap_from_egl_image(PixmapPtr pixmap,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#ifdef WITH_LIBDRM
|
||||
/**
|
||||
* XXX We only need libdrm for fourcc's here XXX
|
||||
*
|
||||
* Perhaps we should have some compatibility defines somewhere?
|
||||
*/
|
||||
static Bool
|
||||
glamor_egl_create_textured_pixmap_from_dma_bufs(PixmapPtr pixmap,
|
||||
uint32_t num_fds, const int *fds,
|
||||
|
|
@ -625,7 +642,6 @@ glamor_egl_create_textured_pixmap_from_dma_bufs(PixmapPtr pixmap,
|
|||
return glamor_egl_create_textured_pixmap_from_egl_image(pixmap, image,
|
||||
used_modifiers);
|
||||
}
|
||||
#endif
|
||||
|
||||
Bool
|
||||
glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap,
|
||||
|
|
@ -643,7 +659,7 @@ glamor_egl_create_textured_pixmap_from_gbm_bo(PixmapPtr pixmap,
|
|||
#endif
|
||||
}
|
||||
|
||||
#if defined(GLAMOR_HAS_GBM) && defined (WITH_LIBDRM)
|
||||
#if defined(GLAMOR_HAS_GBM) && defined(WITH_LIBDRM)
|
||||
static void
|
||||
glamor_get_name_from_bo(int gbm_fd, struct gbm_bo *bo, int *name)
|
||||
{
|
||||
|
|
@ -707,8 +723,11 @@ glamor_make_pixmap_exportable(PixmapPtr pixmap, Bool modifiers_ok)
|
|||
}
|
||||
|
||||
/**
|
||||
* Now that DRI3 has been decoupled from glamor, the (indirect) callers of this
|
||||
* Now that DRI3 has been partially decoupled from gbm, the (indirect) callers of this
|
||||
* (e.g. modesetting's pageflip code) usually expect buffers that can be scanned out.
|
||||
*
|
||||
* Even DRI3 X clients seem to expect scanout-capable buffers.
|
||||
* See: https://github.com/X11Libre/xserver/issues/3262
|
||||
*/
|
||||
#ifdef GBM_BO_WITH_MODIFIERS
|
||||
if (modifiers_ok && glamor_egl->dmabuf_capable) {
|
||||
|
|
@ -904,7 +923,6 @@ glamor_egl_fds_from_pixmap_gbm(ScreenPtr screen, PixmapPtr pixmap, int *fds,
|
|||
uint32_t *strides, uint32_t *offsets,
|
||||
uint64_t *modifier)
|
||||
{
|
||||
#ifdef WITH_LIBDRM
|
||||
struct gbm_bo *bo;
|
||||
int num_fds;
|
||||
#ifdef GBM_BO_WITH_MODIFIERS
|
||||
|
|
@ -969,9 +987,6 @@ glamor_egl_fds_from_pixmap_gbm(ScreenPtr screen, PixmapPtr pixmap, int *fds,
|
|||
|
||||
gbm_bo_destroy(bo);
|
||||
return num_fds;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -1006,11 +1021,7 @@ glamor_egl_fds_from_pixmap_direct(ScreenPtr screen, PixmapPtr pixmap, int *fds,
|
|||
|
||||
*modifier = modifiers[0];
|
||||
|
||||
#ifdef WITH_LIBDRM
|
||||
pixmap_priv->used_modifiers = (*modifier != DRM_FORMAT_MOD_INVALID);
|
||||
#else
|
||||
pixmap_priv->used_modifiers = FALSE;
|
||||
#endif
|
||||
|
||||
return num_planes;
|
||||
#else
|
||||
|
|
@ -1135,7 +1146,6 @@ glamor_egl_fd_name_from_pixmap(ScreenPtr screen,
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef WITH_LIBDRM
|
||||
static uint32_t
|
||||
glamor_drm_format_for_depth(CARD8 depth)
|
||||
{
|
||||
|
|
@ -1154,7 +1164,6 @@ glamor_drm_format_for_depth(CARD8 depth)
|
|||
return DRM_FORMAT_ARGB8888;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static Bool
|
||||
glamor_back_pixmap_from_fd_direct(PixmapPtr pixmap,
|
||||
|
|
@ -1163,7 +1172,6 @@ glamor_back_pixmap_from_fd_direct(PixmapPtr pixmap,
|
|||
CARD16 height,
|
||||
CARD16 _stride, CARD8 depth, CARD8 bpp)
|
||||
{
|
||||
#ifdef WITH_LIBDRM
|
||||
ScreenPtr screen = pixmap->drawable.pScreen;
|
||||
uint32_t format;
|
||||
const int stride = _stride;
|
||||
|
|
@ -1182,9 +1190,6 @@ glamor_back_pixmap_from_fd_direct(PixmapPtr pixmap,
|
|||
width, height,
|
||||
&stride, &offset,
|
||||
format, DRM_FORMAT_MOD_INVALID);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef GLAMOR_HAS_GBM
|
||||
|
|
@ -1269,7 +1274,6 @@ glamor_pixmap_from_fds_direct(ScreenPtr screen,
|
|||
CARD8 depth, CARD8 bpp,
|
||||
uint64_t modifier)
|
||||
{
|
||||
#ifdef WITH_LIBDRM
|
||||
PixmapPtr pixmap;
|
||||
glamor_egl_priv_t *glamor_egl;
|
||||
bool ret = FALSE;
|
||||
|
|
@ -1329,9 +1333,6 @@ error:
|
|||
return NULL;
|
||||
}
|
||||
return pixmap;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef GLAMOR_HAS_GBM
|
||||
|
|
@ -1343,7 +1344,6 @@ glamor_pixmap_from_fds_gbm(ScreenPtr screen,
|
|||
CARD8 depth, CARD8 bpp,
|
||||
uint64_t modifier)
|
||||
{
|
||||
#ifdef WITH_LIBDRM
|
||||
PixmapPtr pixmap;
|
||||
glamor_egl_priv_t *glamor_egl;
|
||||
Bool ret = FALSE;
|
||||
|
|
@ -1396,9 +1396,6 @@ error:
|
|||
return NULL;
|
||||
}
|
||||
return pixmap;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -2692,12 +2689,8 @@ glamor_egl_can_texture_gbm_bo(glamor_egl_priv_t *glamor_egl, int is_nvidia)
|
|||
if (linear_only) {
|
||||
for (uint32_t j = 0; j < num_modifiers; j++) {
|
||||
if (
|
||||
#ifdef WITH_LIBDRM
|
||||
(modifiers[j] == DRM_FORMAT_MOD_LINEAR) ||
|
||||
(modifiers[j] == DRM_FORMAT_MOD_INVALID))
|
||||
#else
|
||||
modifiers[j] == 0) /* DRM_FORMAT_MOD_LINEAR */
|
||||
#endif
|
||||
{
|
||||
found = TRUE;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in a new issue