From 34aa1e3b2702a55799a5655a3ba10bce4cc2065a Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 12 Nov 2012 11:22:53 +0000 Subject: sna: Compile against ancient libdrm We need to trim the sprite video overlays if the prototypes are not known. Signed-off-by: Chris Wilson --- src/sna/sna.h | 4 ++-- src/sna/sna_display.c | 11 ++++++++--- src/sna/sna_video_sprite.c | 14 +++++++++++--- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/sna/sna.h b/src/sna/sna.h index 45cfebe3..f1b3beb8 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -371,8 +371,8 @@ static inline void sna_dri_close(struct sna *sna, ScreenPtr pScreen) { } void sna_dri_pixmap_update_bo(struct sna *sna, PixmapPtr pixmap); extern int sna_crtc_to_pipe(xf86CrtcPtr crtc); -extern int sna_crtc_to_plane(xf86CrtcPtr crtc); -extern int sna_crtc_id(xf86CrtcPtr crtc); +extern uint32_t sna_crtc_to_plane(xf86CrtcPtr crtc); +extern uint32_t sna_crtc_id(xf86CrtcPtr crtc); CARD32 sna_format_for_depth(int depth); CARD32 sna_render_format_for_depth(int depth); diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index d384bb2f..aefb6f7e 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -113,7 +113,7 @@ static inline uint32_t fb_id(struct kgem_bo *bo) return bo->delta; } -int sna_crtc_id(xf86CrtcPtr crtc) +uint32_t sna_crtc_id(xf86CrtcPtr crtc) { return to_sna_crtc(crtc)->id; } @@ -123,7 +123,7 @@ int sna_crtc_to_pipe(xf86CrtcPtr crtc) return to_sna_crtc(crtc)->pipe; } -int sna_crtc_to_plane(xf86CrtcPtr crtc) +uint32_t sna_crtc_to_plane(xf86CrtcPtr crtc) { return to_sna_crtc(crtc)->plane; } @@ -1458,9 +1458,10 @@ static const xf86CrtcFuncsRec sna_crtc_funcs = { #endif }; -static uint32_t +static int sna_crtc_find_plane(struct sna *sna, int pipe) { +#ifdef DRM_IOCTL_MODE_GETPLANERESOURCES struct drm_mode_get_plane_res r; uint32_t *planes, id = 0; int i; @@ -1496,7 +1497,11 @@ sna_crtc_find_plane(struct sna *sna, int pipe) } free(planes); + assert(id); return id; +#else + return 0; +#endif } static void diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c index ff3b4b33..d4eae913 100644 --- a/src/sna/sna_video_sprite.c +++ b/src/sna/sna_video_sprite.c @@ -37,9 +37,11 @@ #include #include #include -#include #include +#ifdef DRM_IOCTL_MODE_GETPLANERESOURCES +#include + #define IMAGE_MAX_WIDTH 2048 #define IMAGE_MAX_HEIGHT 2048 @@ -181,7 +183,7 @@ sna_video_sprite_show(struct sna *sna, xf86CrtcPtr crtc, BoxPtr dstBox) { - int plane = sna_crtc_to_plane(crtc); + uint32_t plane = sna_crtc_to_plane(crtc); update_dst_box_to_crtc_coords(sna, crtc, dstBox); if (crtc->rotation & (RR_Rotate_90 | RR_Rotate_270)) { @@ -286,7 +288,7 @@ static int sna_video_sprite_put_image(ScrnInfoPtr scrn, clip)) return Success; - if (!crtc || !sna_crtc_to_plane(crtc)) { + if (!crtc || sna_crtc_to_plane(crtc) == 0) { /* If the video isn't visible on any CRTC, turn it off */ sna_video_sprite_off(sna, video); return Success; @@ -441,3 +443,9 @@ XF86VideoAdaptorPtr sna_video_sprite_setup(struct sna *sna, return adaptor; } +#else +XF86VideoAdaptorPtr sna_video_sprite_setup(struct sna *sna, ScreenPtr screen) +{ + return NULL; +} +#endif -- cgit v1.2.3