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