Move pf_get_block() to u_format auxiliary module.
[mesa.git] / src / gallium / state_trackers / xorg / xorg_xv.c
1 #include "xorg_tracker.h"
2
3 #include <xf86xv.h>
4 #include <X11/extensions/Xv.h>
5 #include <fourcc.h>
6
7 #include "xorg_exa.h"
8 #include "xorg_renderer.h"
9 #include "xorg_exa_tgsi.h"
10
11 #include "cso_cache/cso_context.h"
12
13 #include "pipe/p_screen.h"
14 #include "pipe/p_inlines.h"
15
16 #include "util/u_format.h"
17
18 /*XXX get these from pipe's texture limits */
19 #define IMAGE_MAX_WIDTH 2048
20 #define IMAGE_MAX_HEIGHT 2048
21
22 #define RES_720P_X 1280
23 #define RES_720P_Y 720
24
25
26 /* The ITU-R BT.601 conversion matrix for SDTV. */
27 /* original, matrix, but we transpose it to
28 * make the shader easier
29 static const float bt_601[] = {
30 1.0, 0.0, 1.4075, ,
31 1.0, -0.3455, -0.7169, 0,
32 1.0, 1.7790, 0., 0,
33 };*/
34 static const float bt_601[] = {
35 1.0, 1.0, 1.0, 0.5,
36 0.0, -0.3455, 1.7790, 0,
37 1.4075, -0.7169, 0., 0,
38 };
39
40 /* The ITU-R BT.709 conversion matrix for HDTV. */
41 /* original, but we transpose to make the conversion
42 * in the shader easier
43 static const float bt_709[] = {
44 1.0, 0.0, 1.581, 0,
45 1.0, -0.1881, -0.47, 0,
46 1.0, 1.8629, 0., 0,
47 };*/
48 static const float bt_709[] = {
49 1.0, 1.0, 1.0, 0.5,
50 0.0, -0.1881, 1.8629, 0,
51 1.581,-0.47 , 0.0, 0,
52 };
53
54 #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
55
56 static Atom xvBrightness, xvContrast;
57
58 #define NUM_TEXTURED_ATTRIBUTES 2
59 static XF86AttributeRec TexturedAttributes[NUM_TEXTURED_ATTRIBUTES] = {
60 {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"},
61 {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"}
62 };
63
64 #define NUM_FORMATS 3
65 static XF86VideoFormatRec Formats[NUM_FORMATS] = {
66 {15, TrueColor}, {16, TrueColor}, {24, TrueColor}
67 };
68
69 static XF86VideoEncodingRec DummyEncoding[1] = {
70 {
71 0,
72 "XV_IMAGE",
73 IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT,
74 {1, 1}
75 }
76 };
77
78 #define NUM_IMAGES 3
79 static XF86ImageRec Images[NUM_IMAGES] = {
80 XVIMAGE_UYVY,
81 XVIMAGE_YUY2,
82 XVIMAGE_YV12,
83 };
84
85 struct xorg_xv_port_priv {
86 struct xorg_renderer *r;
87
88 RegionRec clip;
89
90 int brightness;
91 int contrast;
92
93 int current_set;
94 /* juggle two sets of seperate Y, U and V
95 * textures */
96 struct pipe_texture *yuv[2][3];
97 };
98
99
100 static void
101 stop_video(ScrnInfoPtr pScrn, pointer data, Bool shutdown)
102 {
103 struct xorg_xv_port_priv *priv = (struct xorg_xv_port_priv *)data;
104
105 REGION_EMPTY(pScrn->pScreen, &priv->clip);
106 }
107
108 static int
109 set_port_attribute(ScrnInfoPtr pScrn,
110 Atom attribute, INT32 value, pointer data)
111 {
112 struct xorg_xv_port_priv *priv = (struct xorg_xv_port_priv *)data;
113
114 if (attribute == xvBrightness) {
115 if ((value < -128) || (value > 127))
116 return BadValue;
117 priv->brightness = value;
118 } else if (attribute == xvContrast) {
119 if ((value < 0) || (value > 255))
120 return BadValue;
121 priv->contrast = value;
122 } else
123 return BadMatch;
124
125 return Success;
126 }
127
128 static int
129 get_port_attribute(ScrnInfoPtr pScrn,
130 Atom attribute, INT32 * value, pointer data)
131 {
132 struct xorg_xv_port_priv *priv = (struct xorg_xv_port_priv *)data;
133
134 if (attribute == xvBrightness)
135 *value = priv->brightness;
136 else if (attribute == xvContrast)
137 *value = priv->contrast;
138 else
139 return BadMatch;
140
141 return Success;
142 }
143
144 static void
145 query_best_size(ScrnInfoPtr pScrn,
146 Bool motion,
147 short vid_w, short vid_h,
148 short drw_w, short drw_h,
149 unsigned int *p_w, unsigned int *p_h, pointer data)
150 {
151 if (vid_w > (drw_w << 1))
152 drw_w = vid_w >> 1;
153 if (vid_h > (drw_h << 1))
154 drw_h = vid_h >> 1;
155
156 *p_w = drw_w;
157 *p_h = drw_h;
158 }
159
160 static INLINE struct pipe_texture *
161 create_component_texture(struct pipe_context *pipe,
162 int width, int height)
163 {
164 struct pipe_screen *screen = pipe->screen;
165 struct pipe_texture *tex = 0;
166 struct pipe_texture templ;
167
168 memset(&templ, 0, sizeof(templ));
169 templ.target = PIPE_TEXTURE_2D;
170 templ.format = PIPE_FORMAT_L8_UNORM;
171 templ.last_level = 0;
172 templ.width0 = width;
173 templ.height0 = height;
174 templ.depth0 = 1;
175 util_format_get_block(PIPE_FORMAT_L8_UNORM, &templ.block);
176 templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER;
177
178 tex = screen->texture_create(screen, &templ);
179
180 return tex;
181 }
182
183 static int
184 check_yuv_textures(struct xorg_xv_port_priv *priv, int width, int height)
185 {
186 struct pipe_texture **dst = priv->yuv[priv->current_set];
187 if (!dst[0] ||
188 dst[0]->width0 != width ||
189 dst[0]->height0 != height) {
190 pipe_texture_reference(&dst[0], NULL);
191 }
192 if (!dst[1] ||
193 dst[1]->width0 != width ||
194 dst[1]->height0 != height) {
195 pipe_texture_reference(&dst[1], NULL);
196 }
197 if (!dst[2] ||
198 dst[2]->width0 != width ||
199 dst[2]->height0 != height) {
200 pipe_texture_reference(&dst[2], NULL);
201 }
202
203 if (!dst[0])
204 dst[0] = create_component_texture(priv->r->pipe, width, height);
205
206 if (!dst[1])
207 dst[1] = create_component_texture(priv->r->pipe, width, height);
208
209 if (!dst[2])
210 dst[2] = create_component_texture(priv->r->pipe, width, height);
211
212 if (!dst[0] || !dst[1] || !dst[2])
213 return BadAlloc;
214
215 return Success;
216 }
217
218 static void
219 copy_packed_data(ScrnInfoPtr pScrn,
220 struct xorg_xv_port_priv *port,
221 int id,
222 unsigned char *buf,
223 int srcPitch,
224 int left,
225 int top,
226 int w, int h)
227 {
228 unsigned char *src;
229 int i, j;
230 struct pipe_texture **dst = port->yuv[port->current_set];
231 struct pipe_transfer *ytrans, *utrans, *vtrans;
232 struct pipe_screen *screen = port->r->pipe->screen;
233 char *ymap, *vmap, *umap;
234 unsigned char y1, y2, u, v;
235 int yidx, uidx, vidx;
236 int y_array_size = w * h;
237
238 src = buf + (top * srcPitch) + (left << 1);
239
240 ytrans = screen->get_tex_transfer(screen, dst[0],
241 0, 0, 0,
242 PIPE_TRANSFER_WRITE,
243 left, top, w, h);
244 utrans = screen->get_tex_transfer(screen, dst[1],
245 0, 0, 0,
246 PIPE_TRANSFER_WRITE,
247 left, top, w, h);
248 vtrans = screen->get_tex_transfer(screen, dst[2],
249 0, 0, 0,
250 PIPE_TRANSFER_WRITE,
251 left, top, w, h);
252
253 ymap = (char*)screen->transfer_map(screen, ytrans);
254 umap = (char*)screen->transfer_map(screen, utrans);
255 vmap = (char*)screen->transfer_map(screen, vtrans);
256
257 yidx = uidx = vidx = 0;
258
259 switch (id) {
260 case FOURCC_YV12: {
261 for (i = 0; i < w; ++i) {
262 for (j = 0; j < h; ++j) {
263 /*XXX use src? */
264 y1 = buf[j*w + i];
265 u = buf[(j/2) * (w/2) + i/2 + y_array_size];
266 v = buf[(j/2) * (w/2) + i/2 + y_array_size + y_array_size/4];
267 ymap[yidx++] = y1;
268 umap[uidx++] = u;
269 vmap[vidx++] = v;
270 }
271 }
272 }
273 break;
274 case FOURCC_UYVY:
275 for (i = 0; i < y_array_size; i +=2 ) {
276 /* extracting two pixels */
277 u = buf[0];
278 y1 = buf[1];
279 v = buf[2];
280 y2 = buf[3];
281 buf += 4;
282
283 ymap[yidx++] = y1;
284 ymap[yidx++] = y2;
285 umap[uidx++] = u;
286 umap[uidx++] = u;
287 vmap[vidx++] = v;
288 vmap[vidx++] = v;
289 }
290 break;
291 case FOURCC_YUY2:
292 for (i = 0; i < y_array_size; i +=2 ) {
293 /* extracting two pixels */
294 y1 = buf[0];
295 u = buf[1];
296 y2 = buf[2];
297 v = buf[3];
298
299 buf += 4;
300
301 ymap[yidx++] = y1;
302 ymap[yidx++] = y2;
303 umap[uidx++] = u;
304 umap[uidx++] = u;
305 vmap[vidx++] = v;
306 vmap[vidx++] = v;
307 }
308 break;
309 default:
310 debug_assert(!"Unsupported yuv format!");
311 break;
312 }
313
314 screen->transfer_unmap(screen, ytrans);
315 screen->transfer_unmap(screen, utrans);
316 screen->transfer_unmap(screen, vtrans);
317 screen->tex_transfer_destroy(ytrans);
318 screen->tex_transfer_destroy(utrans);
319 screen->tex_transfer_destroy(vtrans);
320 }
321
322
323 static void
324 setup_fs_video_constants(struct xorg_renderer *r, boolean hdtv)
325 {
326 const int param_bytes = 12 * sizeof(float);
327 const float *video_constants = (hdtv) ? bt_709 : bt_601;
328
329 renderer_set_constants(r, PIPE_SHADER_FRAGMENT,
330 video_constants, param_bytes);
331 }
332
333 static void
334 draw_yuv(struct xorg_xv_port_priv *port,
335 int src_x, int src_y, int src_w, int src_h,
336 int dst_x, int dst_y, int dst_w, int dst_h)
337 {
338 struct pipe_texture **textures = port->yuv[port->current_set];
339
340 renderer_draw_yuv(port->r,
341 src_x, src_y, src_w, src_h,
342 dst_x, dst_y, dst_w, dst_h,
343 textures);
344 }
345
346 static void
347 bind_blend_state(struct xorg_xv_port_priv *port)
348 {
349 struct pipe_blend_state blend;
350
351 memset(&blend, 0, sizeof(struct pipe_blend_state));
352 blend.blend_enable = 1;
353 blend.colormask |= PIPE_MASK_RGBA;
354
355 /* porter&duff src */
356 blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE;
357 blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE;
358 blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO;
359 blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO;
360
361 cso_set_blend(port->r->cso, &blend);
362 }
363
364
365 static void
366 bind_shaders(struct xorg_xv_port_priv *port)
367 {
368 unsigned vs_traits = 0, fs_traits = 0;
369 struct xorg_shader shader;
370
371 vs_traits |= VS_YUV;
372 fs_traits |= FS_YUV;
373
374 shader = xorg_shaders_get(port->r->shaders, vs_traits, fs_traits);
375 cso_set_vertex_shader_handle(port->r->cso, shader.vs);
376 cso_set_fragment_shader_handle(port->r->cso, shader.fs);
377 }
378
379 static INLINE void
380 conditional_flush(struct pipe_context *pipe, struct pipe_texture **tex,
381 int num)
382 {
383 int i;
384 for (i = 0; i < num; ++i) {
385 if (tex[i] && pipe->is_texture_referenced(pipe, tex[i], 0, 0) &
386 PIPE_REFERENCED_FOR_WRITE) {
387 pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL);
388 return;
389 }
390 }
391 }
392
393 static void
394 bind_samplers(struct xorg_xv_port_priv *port)
395 {
396 struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS];
397 struct pipe_sampler_state sampler;
398 struct pipe_texture **dst = port->yuv[port->current_set];
399
400 memset(&sampler, 0, sizeof(struct pipe_sampler_state));
401
402 conditional_flush(port->r->pipe, dst, 3);
403
404 sampler.wrap_s = PIPE_TEX_WRAP_CLAMP;
405 sampler.wrap_t = PIPE_TEX_WRAP_CLAMP;
406 sampler.min_img_filter = PIPE_TEX_FILTER_LINEAR;
407 sampler.mag_img_filter = PIPE_TEX_FILTER_LINEAR;
408 sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST;
409 sampler.normalized_coords = 1;
410
411 samplers[0] = &sampler;
412 samplers[1] = &sampler;
413 samplers[2] = &sampler;
414
415
416 cso_set_samplers(port->r->cso, 3,
417 (const struct pipe_sampler_state **)samplers);
418 cso_set_sampler_textures(port->r->cso, 3,
419 dst);
420 }
421
422 static int
423 display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
424 RegionPtr dstRegion,
425 int src_x, int src_y, int src_w, int src_h,
426 int dstX, int dstY, int dst_w, int dst_h,
427 PixmapPtr pPixmap)
428 {
429 modesettingPtr ms = modesettingPTR(pScrn);
430 BoxPtr pbox;
431 int nbox;
432 int dxo, dyo;
433 Bool hdtv;
434 int x, y, w, h;
435 struct exa_pixmap_priv *dst = exaGetPixmapDriverPrivate(pPixmap);
436 struct pipe_surface *dst_surf = xorg_gpu_surface(pPriv->r->pipe->screen, dst);
437
438 if (dst && !dst->tex) {
439 xorg_exa_set_shared_usage(pPixmap);
440 pScrn->pScreen->ModifyPixmapHeader(pPixmap, 0, 0, 0, 0, 0, NULL);
441 }
442
443 if (!dst || !dst->tex)
444 XORG_FALLBACK("Xv destination %s", !dst ? "!dst" : "!dst->tex");
445
446 hdtv = ((src_w >= RES_720P_X) && (src_h >= RES_720P_Y));
447
448 REGION_TRANSLATE(pScrn->pScreen, dstRegion, -pPixmap->screen_x,
449 -pPixmap->screen_y);
450
451 dxo = dstRegion->extents.x1;
452 dyo = dstRegion->extents.y1;
453
454 pbox = REGION_RECTS(dstRegion);
455 nbox = REGION_NUM_RECTS(dstRegion);
456
457 renderer_bind_destination(pPriv->r, dst_surf,
458 dst_surf->width, dst_surf->height);
459
460 bind_blend_state(pPriv);
461 bind_shaders(pPriv);
462 bind_samplers(pPriv);
463 setup_fs_video_constants(pPriv->r, hdtv);
464
465 exaMoveInPixmap(pPixmap);
466 DamageDamageRegion(&pPixmap->drawable, dstRegion);
467
468 while (nbox--) {
469 int box_x1 = pbox->x1;
470 int box_y1 = pbox->y1;
471 int box_x2 = pbox->x2;
472 int box_y2 = pbox->y2;
473 float diff_x = (float)src_w / (float)dst_w;
474 float diff_y = (float)src_h / (float)dst_h;
475 int offset_x = box_x1 - dstX + pPixmap->screen_x;
476 int offset_y = box_y1 - dstY + pPixmap->screen_y;
477 int offset_w;
478 int offset_h;
479
480 x = box_x1;
481 y = box_y1;
482 w = box_x2 - box_x1;
483 h = box_y2 - box_y1;
484
485 offset_w = dst_w - w;
486 offset_h = dst_h - h;
487
488 draw_yuv(pPriv, src_x + offset_x*diff_x, src_y + offset_y*diff_y,
489 src_w - offset_w*diff_x, src_h - offset_h*diff_x,
490 x, y, w, h);
491
492 pbox++;
493 }
494 DamageRegionProcessPending(&pPixmap->drawable);
495
496 pipe_surface_reference(&dst_surf, NULL);
497
498 return TRUE;
499 }
500
501 static int
502 put_image(ScrnInfoPtr pScrn,
503 short src_x, short src_y,
504 short drw_x, short drw_y,
505 short src_w, short src_h,
506 short drw_w, short drw_h,
507 int id, unsigned char *buf,
508 short width, short height,
509 Bool sync, RegionPtr clipBoxes, pointer data,
510 DrawablePtr pDraw)
511 {
512 struct xorg_xv_port_priv *pPriv = (struct xorg_xv_port_priv *) data;
513 ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
514 PixmapPtr pPixmap;
515 INT32 x1, x2, y1, y2;
516 int srcPitch;
517 BoxRec dstBox;
518 int ret;
519
520 /* Clip */
521 x1 = src_x;
522 x2 = src_x + src_w;
523 y1 = src_y;
524 y2 = src_y + src_h;
525
526 dstBox.x1 = drw_x;
527 dstBox.x2 = drw_x + drw_w;
528 dstBox.y1 = drw_y;
529 dstBox.y2 = drw_y + drw_h;
530
531 if (!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, clipBoxes,
532 width, height))
533 return Success;
534
535 switch (id) {
536 case FOURCC_UYVY:
537 case FOURCC_YUY2:
538 case FOURCC_YV12:
539 default:
540 srcPitch = width << 1;
541 break;
542 }
543
544 ret = check_yuv_textures(pPriv, width, height);
545
546 if (ret)
547 return ret;
548
549 copy_packed_data(pScrn, pPriv, id, buf, srcPitch,
550 src_x, src_y, width, height);
551
552 if (pDraw->type == DRAWABLE_WINDOW) {
553 pPixmap = (*pScreen->GetWindowPixmap)((WindowPtr)pDraw);
554 } else {
555 pPixmap = (PixmapPtr)pDraw;
556 }
557
558 display_video(pScrn, pPriv, id, clipBoxes,
559 src_x, src_y, src_w, src_h,
560 drw_x, drw_y,
561 drw_w, drw_h, pPixmap);
562
563 pPriv->current_set = (pPriv->current_set + 1) & 1;
564 return Success;
565 }
566
567 static int
568 query_image_attributes(ScrnInfoPtr pScrn,
569 int id,
570 unsigned short *w, unsigned short *h,
571 int *pitches, int *offsets)
572 {
573 int size;
574
575 if (*w > IMAGE_MAX_WIDTH)
576 *w = IMAGE_MAX_WIDTH;
577 if (*h > IMAGE_MAX_HEIGHT)
578 *h = IMAGE_MAX_HEIGHT;
579
580 *w = (*w + 1) & ~1;
581 if (offsets)
582 offsets[0] = 0;
583
584 switch (id) {
585 case FOURCC_UYVY:
586 case FOURCC_YUY2:
587 case FOURCC_YV12:
588 default:
589 size = *w << 1;
590 if (pitches)
591 pitches[0] = size;
592 size *= *h;
593 break;
594 }
595
596 return size;
597 }
598
599 static struct xorg_xv_port_priv *
600 port_priv_create(struct xorg_renderer *r)
601 {
602 struct xorg_xv_port_priv *priv = NULL;
603
604 priv = calloc(1, sizeof(struct xorg_xv_port_priv));
605
606 if (!priv)
607 return NULL;
608
609 priv->r = r;
610
611 REGION_NULL(pScreen, &priv->clip);
612
613 debug_assert(priv && priv->r);
614
615 return priv;
616 }
617
618 static XF86VideoAdaptorPtr
619 xorg_setup_textured_adapter(ScreenPtr pScreen)
620 {
621 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
622 modesettingPtr ms = modesettingPTR(pScrn);
623 XF86VideoAdaptorPtr adapt;
624 XF86AttributePtr attrs;
625 DevUnion *dev_unions;
626 int nports = 16, i;
627 int nattributes;
628
629 nattributes = NUM_TEXTURED_ATTRIBUTES;
630
631 debug_assert(ms->exa);
632 debug_assert(ms->exa->renderer);
633
634 adapt = calloc(1, sizeof(XF86VideoAdaptorRec));
635 dev_unions = calloc(nports, sizeof(DevUnion));
636 attrs = calloc(nattributes, sizeof(XF86AttributeRec));
637 if (adapt == NULL || dev_unions == NULL || attrs == NULL) {
638 free(adapt);
639 free(dev_unions);
640 free(attrs);
641 return NULL;
642 }
643
644 adapt->type = XvWindowMask | XvInputMask | XvImageMask;
645 adapt->flags = 0;
646 adapt->name = "Gallium3D Textured Video";
647 adapt->nEncodings = 1;
648 adapt->pEncodings = DummyEncoding;
649 adapt->nFormats = NUM_FORMATS;
650 adapt->pFormats = Formats;
651 adapt->nPorts = 0;
652 adapt->pPortPrivates = dev_unions;
653 adapt->nAttributes = nattributes;
654 adapt->pAttributes = attrs;
655 memcpy(attrs, TexturedAttributes, nattributes * sizeof(XF86AttributeRec));
656 adapt->nImages = NUM_IMAGES;
657 adapt->pImages = Images;
658 adapt->PutVideo = NULL;
659 adapt->PutStill = NULL;
660 adapt->GetVideo = NULL;
661 adapt->GetStill = NULL;
662 adapt->StopVideo = stop_video;
663 adapt->SetPortAttribute = set_port_attribute;
664 adapt->GetPortAttribute = get_port_attribute;
665 adapt->QueryBestSize = query_best_size;
666 adapt->PutImage = put_image;
667 adapt->QueryImageAttributes = query_image_attributes;
668
669 for (i = 0; i < nports; i++) {
670 struct xorg_xv_port_priv *priv =
671 port_priv_create(ms->exa->renderer);
672
673 adapt->pPortPrivates[i].ptr = (pointer) (priv);
674 adapt->nPorts++;
675 }
676
677 return adapt;
678 }
679
680 void
681 xorg_xv_init(ScreenPtr pScreen)
682 {
683 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
684 /*modesettingPtr ms = modesettingPTR(pScrn);*/
685 XF86VideoAdaptorPtr *adaptors, *new_adaptors = NULL;
686 XF86VideoAdaptorPtr textured_adapter;
687 int num_adaptors;
688
689 num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors);
690 new_adaptors = malloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr *));
691 if (new_adaptors == NULL)
692 return;
693
694 memcpy(new_adaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr));
695 adaptors = new_adaptors;
696
697 /* Add the adaptors supported by our hardware. First, set up the atoms
698 * that will be used by both output adaptors.
699 */
700 xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
701 xvContrast = MAKE_ATOM("XV_CONTRAST");
702
703 textured_adapter = xorg_setup_textured_adapter(pScreen);
704
705 debug_assert(textured_adapter);
706
707 if (textured_adapter) {
708 adaptors[num_adaptors++] = textured_adapter;
709 }
710
711 if (num_adaptors) {
712 xf86XVScreenInit(pScreen, adaptors, num_adaptors);
713 } else {
714 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
715 "Disabling Xv because no adaptors could be initialized.\n");
716 }
717
718 free(adaptors);
719 }