summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2018-10-02 17:55:03 +0200
committerMichel Dänzer <michel@daenzer.net>2018-10-02 17:55:03 +0200
commitbabbd38057559471ab3cb6970010b9a4adf1ef3d (patch)
tree24de042612f3c94a3b2d49de0079da09a848b38e /src
parentb6ee7f92cfaa2c134bee101cf89983db73f4c28d (diff)
Fix --disable-glamor build
We were still relying on the glamor.h header being picked up implicitly.
Diffstat (limited to 'src')
-rw-r--r--src/amdgpu_bo_helper.c13
-rw-r--r--src/amdgpu_glamor.c4
-rw-r--r--src/amdgpu_glamor.h21
-rw-r--r--src/drmmode_display.c10
4 files changed, 44 insertions, 4 deletions
diff --git a/src/amdgpu_bo_helper.c b/src/amdgpu_bo_helper.c
index 6fd6884..ea51822 100644
--- a/src/amdgpu_bo_helper.c
+++ b/src/amdgpu_bo_helper.c
@@ -148,6 +148,8 @@ Bool amdgpu_bo_get_handle(struct amdgpu_buffer *bo, uint32_t *handle)
handle) == 0;
}
+#ifdef USE_GLAMOR
+
static void amdgpu_pixmap_do_get_tiling_info(PixmapPtr pixmap)
{
struct amdgpu_pixmap *priv = amdgpu_get_pixmap_private(pixmap);
@@ -164,6 +166,8 @@ static void amdgpu_pixmap_do_get_tiling_info(PixmapPtr pixmap)
priv->tiling_info = gem_metadata.data.tiling_info;
}
+#endif
+
uint64_t amdgpu_pixmap_get_tiling_info(PixmapPtr pixmap)
{
struct amdgpu_pixmap *priv = amdgpu_get_pixmap_private(pixmap);
@@ -207,16 +211,17 @@ Bool amdgpu_pixmap_get_handle(PixmapPtr pixmap, uint32_t *handle)
r = drmPrimeFDToHandle(pAMDGPUEnt->fd, fd, &priv->handle);
close(fd);
- if (r == 0)
- goto get_tiling_info;
+ if (r)
+ return FALSE;
+
+ amdgpu_pixmap_do_get_tiling_info(pixmap);
+ goto success;
}
#endif
if (!priv->bo || !amdgpu_bo_get_handle(priv->bo, &priv->handle))
return FALSE;
- get_tiling_info:
- amdgpu_pixmap_do_get_tiling_info(pixmap);
success:
priv->handle_valid = TRUE;
*handle = priv->handle;
diff --git a/src/amdgpu_glamor.c b/src/amdgpu_glamor.c
index 699861f..f91ee3a 100644
--- a/src/amdgpu_glamor.c
+++ b/src/amdgpu_glamor.c
@@ -28,6 +28,8 @@
#include "config.h"
#endif
+#ifdef USE_GLAMOR
+
#include <xf86.h>
#include "amdgpu_bo_helper.h"
@@ -517,3 +519,5 @@ XF86VideoAdaptorPtr amdgpu_glamor_xv_init(ScreenPtr pScreen, int num_adapt)
{
return glamor_xv_init(pScreen, num_adapt);
}
+
+#endif /* USE_GLAMOR */
diff --git a/src/amdgpu_glamor.h b/src/amdgpu_glamor.h
index 78fec0b..b629985 100644
--- a/src/amdgpu_glamor.h
+++ b/src/amdgpu_glamor.h
@@ -29,6 +29,8 @@
#include "xf86xv.h"
+#ifdef USE_GLAMOR
+
#define GLAMOR_FOR_XORG 1
#include <glamor.h>
@@ -71,4 +73,23 @@ PixmapPtr amdgpu_glamor_set_pixmap_bo(DrawablePtr drawable, PixmapPtr pixmap);
XF86VideoAdaptorPtr amdgpu_glamor_xv_init(ScreenPtr pScreen, int num_adapt);
+#else /* !USE_GLAMOR */
+
+static inline Bool amdgpu_glamor_pre_init(ScrnInfoPtr scrn) { return FALSE; }
+static inline Bool amdgpu_glamor_init(ScreenPtr screen) { return FALSE; }
+static inline void amdgpu_glamor_fini(ScreenPtr screen) { }
+static inline Bool amdgpu_glamor_create_screen_resources(ScreenPtr screen) { return FALSE; }
+
+static inline Bool amdgpu_glamor_create_textured_pixmap(PixmapPtr pixmap, struct amdgpu_buffer *bo) { return TRUE; }
+
+static inline void amdgpu_glamor_exchange_buffers(PixmapPtr src, PixmapPtr dst) {}
+static inline PixmapPtr amdgpu_glamor_set_pixmap_bo(DrawablePtr drawable, PixmapPtr pixmap) { return pixmap; }
+
+static inline XF86VideoAdaptorPtr amdgpu_glamor_xv_init(ScreenPtr pScreen, int num_adapt) { return NULL; }
+
+static inline void amdgpu_glamor_flush(ScrnInfoPtr pScrn) { }
+static inline void amdgpu_glamor_finish(ScrnInfoPtr pScrn) { }
+
+#endif /* USE_GLAMOR */
+
#endif /* AMDGPU_GLAMOR_H */
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 9917d9f..5315747 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -347,6 +347,8 @@ drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode)
crtc->x, crtc->y);
}
+#ifdef USE_GLAMOR
+
static PixmapPtr
create_pixmap_for_fbcon(drmmode_ptr drmmode,
ScrnInfoPtr pScrn, int fbcon_id)
@@ -384,9 +386,13 @@ out_free_fb:
return pixmap;
}
+#endif /* USE_GLAMOR */
+
void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
{
+#ifdef USE_GLAMOR
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
+ AMDGPUInfoPtr info = AMDGPUPTR(pScrn);
ScreenPtr pScreen = pScrn->pScreen;
PixmapPtr src, dst = pScreen->GetScreenPixmap(pScreen);
struct drmmode_fb *fb = amdgpu_pixmap_get_fb(dst);
@@ -394,6 +400,9 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
GCPtr gc;
int i;
+ if (!info->use_glamor)
+ return;
+
for (i = 0; i < xf86_config->num_crtc; i++) {
drmmode_crtc_private_ptr drmmode_crtc = xf86_config->crtc[i]->driver_private;
@@ -427,6 +436,7 @@ void drmmode_copy_fb(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
pScreen->canDoBGNoneRoot = TRUE;
pScreen->DestroyPixmap(src);
+#endif
return;
}