diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-06-06 21:40:30 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-06-06 21:40:59 +0100 |
commit | 7e1e18aca214a8705270972131a1800c81bc3b4d (patch) | |
tree | 718eb2f55cae18bce617f9336c8e71db670816a9 | |
parent | 0869acc0a6a5b92f5528049d2bd5ec62121ba114 (diff) |
sna/video: Fixup formats to select visuals
Fixes regression from
commit 195a51353c3af7bd253227da5f759f06cea01f73 [2.21.8]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Tue Apr 9 19:13:46 2013 +0100
sna/video: Convert to a pure Xv backend
Reported-by: Edward Sheldrake <ejsheldrake@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65479
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_video.c | 29 | ||||
-rw-r--r-- | src/sna/sna_video.h | 3 | ||||
-rw-r--r-- | src/sna/sna_video_overlay.c | 7 | ||||
-rw-r--r-- | src/sna/sna_video_sprite.c | 5 | ||||
-rw-r--r-- | src/sna/sna_video_textured.c | 7 |
5 files changed, 42 insertions, 9 deletions
diff --git a/src/sna/sna_video.c b/src/sna/sna_video.c index eb4f8463..6591c625 100644 --- a/src/sna/sna_video.c +++ b/src/sna/sna_video.c @@ -564,6 +564,35 @@ sna_xv_free_port(XvPortPtr port) return Success; } +int +sna_xv_fixup_formats(ScreenPtr screen, XvFormatPtr formats, int num_formats) +{ + XvFormatPtr out = formats; + int count = 0; + + while (num_formats--) { + int num_visuals = screen->numVisuals; + VisualPtr v = screen->visuals; + + while (num_visuals--) { + if (v->class == TrueColor && + v->nplanes == formats->depth) { + int tmp = out[count].depth; + out[count].depth = formats->depth; + out[count].visual = v->vid; + formats->depth = tmp; + count++; + break; + } + v++; + } + + formats++; + } + + return count; +} + static int sna_xv_query_adaptors(ScreenPtr screen, XvAdaptorPtr *adaptors, diff --git a/src/sna/sna_video.h b/src/sna/sna_video.h index e1b289d4..593a8cc4 100644 --- a/src/sna/sna_video.h +++ b/src/sna/sna_video.h @@ -109,6 +109,9 @@ void sna_video_textured_setup(struct sna *sna, ScreenPtr screen); void sna_video_destroy_window(WindowPtr win); XvAdaptorPtr sna_xv_adaptor_alloc(struct sna *sna); +int sna_xv_fixup_formats(ScreenPtr screen, + XvFormatPtr formats, + int num_formats); int sna_xv_alloc_port(unsigned long port, XvPortPtr in, XvPortPtr *out); int sna_xv_free_port(XvPortPtr port); diff --git a/src/sna/sna_video_overlay.c b/src/sna/sna_video_overlay.c index 26b30e2d..5ec9c179 100644 --- a/src/sna/sna_video_overlay.c +++ b/src/sna/sna_video_overlay.c @@ -57,9 +57,7 @@ static Atom xvSyncToVblank; #define IMAGE_MAX_WIDTH_LEGACY 1024 #define IMAGE_MAX_HEIGHT_LEGACY 1088 -static const XvFormatRec Formats[] = { - {15, TrueColor}, {16, TrueColor}, {24, TrueColor} -}; +static XvFormatRec Formats[] = { {15}, {16}, {24} }; static const XvAttributeRec Attributes[] = { {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, @@ -715,8 +713,9 @@ void sna_video_overlay_setup(struct sna *sna, ScreenPtr screen) adaptor->pEncodings[0].height = sna->kgem.gen < 021 ? IMAGE_MAX_HEIGHT_LEGACY : IMAGE_MAX_HEIGHT; adaptor->pEncodings[0].rate.numerator = 1; adaptor->pEncodings[0].rate.denominator = 1; - adaptor->nFormats = ARRAY_SIZE(Formats); adaptor->pFormats = Formats; + adaptor->nFormats = sna_xv_fixup_formats(screen, Formats, + ARRAY_SIZE(Formats)); adaptor->nAttributes = NUM_ATTRIBUTES; if (HAS_GAMMA(sna)) adaptor->nAttributes += GAMMA_ATTRIBUTES; diff --git a/src/sna/sna_video_sprite.c b/src/sna/sna_video_sprite.c index 06b278e5..05d61298 100644 --- a/src/sna/sna_video_sprite.c +++ b/src/sna/sna_video_sprite.c @@ -50,7 +50,7 @@ static Atom xvColorKey; -static const XvFormatRec formats[] = { {15, TrueColor}, {16, TrueColor}, {24, TrueColor} }; +static XvFormatRec formats[] = { {15}, {16}, {24} }; static const XvImageRec images[] = { XVIMAGE_YUY2, XVIMAGE_UYVY, XVMC_YUV }; static const XvAttributeRec attribs[] = { { XvSettable | XvGettable, 0, 0xffffff, "XV_COLORKEY" }, @@ -489,8 +489,9 @@ void sna_video_sprite_setup(struct sna *sna, ScreenPtr screen) adaptor->pEncodings[0].height = IMAGE_MAX_HEIGHT; adaptor->pEncodings[0].rate.numerator = 1; adaptor->pEncodings[0].rate.denominator = 1; - adaptor->nFormats = ARRAY_SIZE(formats); adaptor->pFormats = formats; + adaptor->nFormats = sna_xv_fixup_formats(screen, formats, + ARRAY_SIZE(formats)); adaptor->nAttributes = ARRAY_SIZE(attribs); adaptor->pAttributes = attribs; adaptor->nImages = ARRAY_SIZE(images); diff --git a/src/sna/sna_video_textured.c b/src/sna/sna_video_textured.c index 70f1f6e0..96f4f55a 100644 --- a/src/sna/sna_video_textured.c +++ b/src/sna/sna_video_textured.c @@ -38,8 +38,8 @@ static Atom xvBrightness, xvContrast, xvSyncToVblank; -static const XvFormatRec Formats[] = { - {15, TrueColor}, {16, TrueColor}, {24, TrueColor} +static XvFormatRec Formats[] = { + {15}, {16}, {24} }; static const XvAttributeRec Attributes[] = { @@ -367,8 +367,9 @@ void sna_video_textured_setup(struct sna *sna, ScreenPtr screen) adaptor->pEncodings[0].height = sna->render.max_3d_size; adaptor->pEncodings[0].rate.numerator = 1; adaptor->pEncodings[0].rate.denominator = 1; - adaptor->nFormats = ARRAY_SIZE(Formats); adaptor->pFormats = Formats; + adaptor->nFormats = sna_xv_fixup_formats(screen, Formats, + ARRAY_SIZE(Formats)); adaptor->nAttributes = ARRAY_SIZE(Attributes); adaptor->pAttributes = Attributes; adaptor->nImages = ARRAY_SIZE(Images); |