Programming problems in Dual Head Mode with Tiny-X.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(Hope this is the right place to post this message.)
Hi all,

I am working on a small movie player which can play full screen movie
using Xserver.  It works fine in Single Head Mode. But is I set the
Xserver in Dual Head Mode. I can't see any thing on both screens. The
Code to Init the display is shown as below:

  display = XOpenDisplay(NULL);
   if (display == NULL)
    fprintf(stderr, "Can not open display\n");

 if (!XMBXDHQueryExtension(display, &eventBase, &errorBase))
  {
    printf("XMBXDHQueryExtension failed\n");
    exit(0);
  }

  if (!XMBXDHQueryVersion(display, &major, &minor, &patch) ||
        major < 1 ||
        minor < 0 ||
        patch < 0)
  {
        printf("XMBXDHQueryVersion or version check failed\n");
        exit(0);
  }

  if(!XMBXDHMode(display, MBX_DUAL_HEAD, PDP_DMT, 1))
  {
        printf("Can not Enter Dual Head Mode.\n");
        exit(0);
}
  int count = ScreenCount(display);
  printf("number of screens = %d\n", count);
  screen = DefaultScreen(display);
  printf("screen = %d\n", screen);
hwidth = 640;
  hheight = 480;

  /* Make the window */
  window = XCreateSimpleWindow (display, RootWindow(display, screen),
                                 0, 0, hwidth, hheight,0,0,0);

  XSelectInput(display, window, KeyPressMask | StructureNotifyMask);

  /* Map window. */

  XMapWindow(display, window);

  /* Wait for map. */
  do
  {
    XNextEvent(display, &xev);
  }
  while (xev.type != MapNotify || xev.xmap.event != window);

  gc = DefaultGC(display, screen);

  yuv_height = hheight;
  yuv_width = hwidth;

XvQueryAdaptors(display, RootWindow(display, screen), &numAdaptors, &info);
  for(i = 0; i < numAdaptors; i++) {
if(info[i].type & XvImageMask) { /* Adaptor has XvImage support */ formats = XvListImageFormats(display, info[i].base_id, &numImages);

            for(j = 0; j < numImages; j++) {
                if(formats[j].id == GUID_MBX1_PLANAR) {
                    /* It supports our format */
            adaptor = i;
                    for(k = 0; k < info[i].num_ports; k++) {
                        /* try to grab a port */
if(Success == XvGrabPort(display, info[i].base_id + k,
                                        CurrentTime))
                        {
                            portNum = info[i].base_id + k;
                            break;
                        }
                    }
                }
                if(portNum != -1) break;
            }
            XFree(formats);
        }

   }
   if (adaptor == -1 ) {
    printf("no suitable Xv adaptor found");
    exit(1);
   }
   if (portNum == -1 ) {
     printf("no free Xv adaptor ports found");
     exit(1);
   }
   CompletionType = XShmGetEventBase(display) + ShmCompletion;
   ximage = (XvImage *)  XvShmCreateImage(display, portNum,
        GUID_MBX1_PLANAR,0, yuv_width, yuv_height, (char *) &shminfo1);
shminfo1.shmid = shmget (IPC_PRIVATE, ximage->data_size, IPC_CREAT|0777);
   shminfo1.shmaddr = ximage->data = shmat (shminfo1.shmid, 0, 0);
   shminfo1.readOnly = False;
   if(!XShmAttach (display, &shminfo1)) {
       printf("XShmAttach failed!\n");
   }
   shmctl (shminfo1.shmid, IPC_RMID, 0);
   XSync(display,False);

I use tinyX as the Xserver and the xfbdev as the card for the second
screen.  After the Initialization, Both Screen as a respond. I mean both
of them have been waked up. but when I am trying to write image to the
first screen by

XvShmPutImage(display, portNum,
              window ,
              gc,  ximage, 0, 0,
              yuv_width, yuv_height, 0, 0,
              hwidth, hheight, False);
   XFlush(display);

I got nothing. What did I forget to do to get this work?

Many thanks.

Regards.

Ken




_______________________________________________
XFree86 mailing list
XFree86@xxxxxxxxxxx
http://XFree86.Org/mailman/listinfo/xfree86

[Index of Archives]     [X Forum]     [Xorg]     [XFree86 Newbie]     [IETF Announce]     [Security]     [Font Config]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux Kernel]

  Powered by Linux