summaryrefslogtreecommitdiff
path: root/src/sna
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-06-20 11:44:23 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2016-06-20 11:58:37 +0100
commitebc5e9c3b2241be69bee7b96bd63ef00dacf816c (patch)
treebb0ca0889e12f8173b392bed057530aabaf2bb76 /src/sna
parent52c9d7ca2467bc273a8ef3c61c1b690ac56caa74 (diff)
sna/video: Create one XvAdapter for each sprite plane
The caveat here is that the sprite plane must be available on all CRTCs so that the availability of the XvAdapter is not dependent upon output configuration or Window placement. Based on a patch by Michael Hadley <michaelx.hadley@intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna')
-rw-r--r--src/sna/sna.h1
-rw-r--r--src/sna/sna_display.c12
-rw-r--r--src/sna/sna_video_sprite.c15
3 files changed, 22 insertions, 6 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h
index 033781e1..64bf498c 100644
--- a/src/sna/sna.h
+++ b/src/sna/sna.h
@@ -611,6 +611,7 @@ static inline void sna_present_vblank_handler(struct drm_event_vblank *event) {
static inline void sna_present_cancel_flip(struct sna *sna) { }
#endif
+extern unsigned sna_crtc_count_sprites(xf86CrtcPtr crtc);
extern bool sna_crtc_set_sprite_rotation(xf86CrtcPtr crtc, unsigned idx, uint32_t rotation);
extern uint32_t sna_crtc_to_sprite(xf86CrtcPtr crtc, unsigned idx);
extern bool sna_crtc_is_transformed(xf86CrtcPtr crtc);
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 2f54ff12..a22d94e4 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -445,6 +445,18 @@ static inline uint32_t fb_id(struct kgem_bo *bo)
return bo->delta;
}
+unsigned sna_crtc_count_sprites(xf86CrtcPtr crtc)
+{
+ struct plane *sprite;
+ unsigned count;
+
+ count = 0;
+ list_for_each_entry(sprite, &to_sna_crtc(crtc)->sprites, link)
+ count++;
+
+ return count;
+}
+
static struct plane *lookup_sprite(struct sna_crtc *crtc, unsigned idx)
{
struct plane *sprite;
diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c
index a302b5dc..1a2b1c83 100644
--- a/src/sna/sna_video_sprite.c
+++ b/src/sna/sna_video_sprite.c
@@ -654,6 +654,7 @@ static int sna_video_sprite_color_key(struct sna *sna)
static int sna_video_has_sprites(struct sna *sna)
{
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(sna->scrn);
+ unsigned min;
int i;
DBG(("%s: num_crtc=%d\n", __FUNCTION__, sna->mode.num_real_crtc));
@@ -661,15 +662,17 @@ static int sna_video_has_sprites(struct sna *sna)
if (sna->mode.num_real_crtc == 0)
return 0;
+ min = -1;
for (i = 0; i < sna->mode.num_real_crtc; i++) {
- if (!sna_crtc_to_sprite(config->crtc[i], 0)) {
- DBG(("%s: no sprite found on pipe %d\n", __FUNCTION__, sna_crtc_pipe(config->crtc[i])));
- return 0;
- }
+ unsigned count = sna_crtc_count_sprites(config->crtc[i]);
+ DBG(("%s: %d sprites found on pipe %d\n", __FUNCTION__,
+ count, sna_crtc_pipe(config->crtc[i])));
+ if (count < min)
+ min = count;
}
- DBG(("%s: yes\n", __FUNCTION__));
- return 1;
+ DBG(("%s: min=%d\n", __FUNCTION__, min));
+ return min;
}
void sna_video_sprite_setup(struct sna *sna, ScreenPtr screen)