<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -20,6 +20,7 @@
 #include &lt;sys/time.h&gt;
 #include &lt;sys/mman.h&gt;
 #include &lt;sys/ioctl.h&gt;
+#include &lt;uiomux/uiomux.h&gt;
 #include &lt;shveu/shveu.h&gt;
 #include &lt;asm/types.h&gt;          /* for videodev2.h */
 
@@ -245,6 +246,7 @@ static void uninit_device(sh_ceu * ceu)
   case IO_METHOD_USERPTR:
     for (i = 0; i &lt; ceu-&gt;n_buffers; ++i)
       //  free (ceu-&gt;buffers[i].start);//this is the VEU UIO memory, not stuff we malloc'ed
+      // uiomux_free (...);
       break;
   }
   free (ceu-&gt;buffers);
@@ -359,12 +361,21 @@ static void init_userp(sh_ceu * ceu, unsigned int buffer_size)
   }
 
   {
-    struct uio_map uio;
+    UIOMux * uiomux;
+    unsigned char * veu_virt_base;
+
+    fprintf (stderr, &quot;Initializing for buffer size %u\n&quot;, buffer_size);
+
     // get veu's virtual address
-    shveu_get_memory_info(&amp;uio);
+    // XXX: This capture.c isn't actually going to use the uiomux afterwards. This memory should
+    // be allocated with uiomux_malloc() and that ptr passed to the main gstshvideocapenc plugin.
+    uiomux = uiomux_open();
+    uiomux_get_mem (uiomux, UIOMUX_SH_VEU, NULL, NULL, (void *)&amp;veu_virt_base);
+
     for (ceu-&gt;n_buffers = 0; ceu-&gt;n_buffers &lt; req.count; ++ceu-&gt;n_buffers) {
       ceu-&gt;buffers[ceu-&gt;n_buffers].length = buffer_size;
-      ceu-&gt;buffers[ceu-&gt;n_buffers].start = (unsigned char *)((unsigned int)uio.iomem + (buffer_size*ceu-&gt;n_buffers));
+      ceu-&gt;buffers[ceu-&gt;n_buffers].start = (unsigned char *)(veu_virt_base + (buffer_size*ceu-&gt;n_buffers));
+      //ceu-&gt;buffers[ceu-&gt;n_buffers].start = uiomux_malloc (uiomux, UIOMUX_SH_VEU, buffer_size, 32);
       if (!ceu-&gt;buffers[ceu-&gt;n_buffers].start) {
         fprintf (stderr, &quot;Out of memory\n&quot;);
         exit (EXIT_FAILURE);
@@ -446,11 +457,11 @@ static void init_device(sh_ceu * ceu)
   if (-1 == xioctl (ceu-&gt;fd, VIDIOC_S_FMT, &amp;fmt)) {
    	fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_UYVY;
    	if (-1 == xioctl (ceu-&gt;fd, VIDIOC_S_FMT, &amp;fmt)) {
-      fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_RGB565;
-      if (-1 == xioctl (ceu-&gt;fd, VIDIOC_S_FMT, &amp;fmt)) {
-      	errno_exit (&quot;VIDIOC_S_FMT&quot;);
-      }
-    }
+          fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_RGB565;
+          if (-1 == xioctl (ceu-&gt;fd, VIDIOC_S_FMT, &amp;fmt)) {
+      	    errno_exit (&quot;VIDIOC_S_FMT&quot;);
+          }
+        }
   }
 
   ceu-&gt;pixel_format = fmt.fmt.pix.pixelformat;</diff>
      <filename>cntlfile/capture.c</filename>
    </modified>
    <modified>
      <diff>@@ -32,6 +32,7 @@
 #include &lt;sys/ioctl.h&gt;
 #include &lt;sys/mman.h&gt;
 #include &lt;string.h&gt;
+#include &lt;uiomux/uiomux.h&gt;
 #include &lt;shveu/shveu.h&gt;
 #include &quot;gstshvideocapenc.h&quot;
 #include &lt;linux/fb.h&gt;
@@ -85,6 +86,8 @@ struct _GstshvideoEnc
   pthread_mutex_t blit_mutex;
   pthread_mutex_t blit_vpu_end_mutex;
   pthread_mutex_t output_mutex;
+
+  UIOMux * uiomux;
   int veu;
 
   int ceu_buf_size;
@@ -229,24 +232,39 @@ static void *capture_thread(void *data)
   }
 }
 
+//#define USE_UIOMUX_VIRT_TO_PHYS
 
 static void *blit_thread(void *data)
 {
   GstshvideoEnc *shvideoenc = (GstshvideoEnc *)data;
-  struct uio_map uio;
-  unsigned char *in_yaddr;
-  unsigned char *in_caddr;
+  unsigned long veu_base;
+  unsigned long in_yaddr;
+  unsigned long in_caddr;
 
-  shveu_get_memory_info(&amp;uio);
+#ifndef USE_UIOMUX_VIRT_TO_PHYS
+  uiomux_get_mem (shvideoenc-&gt;uiomux, UIOMUX_SH_VEU, &amp;veu_base, NULL, NULL);
+#endif
 
   while(1)
   {
     GST_LOG_OBJECT(shvideoenc,&quot;%s called preview %d&quot;,__FUNCTION__, shvideoenc-&gt;preview);
     pthread_mutex_lock(&amp;shvideoenc-&gt;blit_mutex); 
-    in_yaddr = (unsigned char *)(uio.address+shvideoenc-&gt;ceu_buf_size*shvideoenc-&gt;ceu_buf_num);
-    in_caddr = (unsigned char *)(in_yaddr+shvideoenc-&gt;ceu_buf_size/2);
+
+#ifdef USE_UIOMUX_VIRT_TO_PHYS 
+    veu_base = uiomux_virt_to_phys (shvideoenc-&gt;uiomux, UIOMUX_SH_VEU, shvideoenc-&gt;ceu_ubuf);
+    in_yaddr = veu_base;
+#else
+    in_yaddr = veu_base+shvideoenc-&gt;ceu_buf_size*shvideoenc-&gt;ceu_buf_num;
+#endif
+
+    in_caddr = in_yaddr+shvideoenc-&gt;ceu_buf_size/2;
     /* memory copy from ceu output buffer to vpu input buffer */
 
+#if 0
+    fprintf (stderr, &quot;Resizing input data from %lu from size %ld x %ld to size %d x %d\n&quot;,
+             in_yaddr, shvideoenc-&gt;ainfo.xpic, shvideoenc-&gt;ainfo.ypic, shvideoenc-&gt;width, shvideoenc-&gt;height);
+#endif
+
     shveu_operation(
       shvideoenc-&gt;veu, 
       in_yaddr,
@@ -255,11 +273,11 @@ static void *blit_thread(void *data)
       shvideoenc-&gt;ainfo.ypic,
       shvideoenc-&gt;ainfo.xpic,
       SHVEU_YCbCr420,
-	  (unsigned char *)shvideoenc-&gt;enc_in_yaddr,
-	  (unsigned char *)shvideoenc-&gt;enc_in_caddr,
-      shvideoenc-&gt;width,
-      shvideoenc-&gt;height,
-      shvideoenc-&gt;width,
+      shvideoenc-&gt;enc_in_yaddr,
+      shvideoenc-&gt;enc_in_caddr,
+      (long)shvideoenc-&gt;width,
+      (long)shvideoenc-&gt;height,
+      (long)shvideoenc-&gt;width,
       SHVEU_YCbCr420,
       SHVEU_NO_ROT);
     pthread_mutex_unlock(&amp;shvideoenc-&gt;blit_vpu_end_mutex);
@@ -268,17 +286,17 @@ static void *blit_thread(void *data)
     {
       shveu_operation(
         shvideoenc-&gt;veu, 
-	    (unsigned char *)shvideoenc-&gt;enc_in_yaddr,
-        (unsigned char *)shvideoenc-&gt;enc_in_caddr,
-        shvideoenc-&gt;width,
-        shvideoenc-&gt;height,
-        shvideoenc-&gt;width,
+        shvideoenc-&gt;enc_in_yaddr,
+        shvideoenc-&gt;enc_in_caddr,
+        (long)shvideoenc-&gt;width,
+        (long)shvideoenc-&gt;height,
+        (long)shvideoenc-&gt;width,
         SHVEU_YCbCr420,
-	    (unsigned char *)shvideoenc-&gt;finfo.smem_start,
-        NULL,
-        shvideoenc-&gt;fbinfo.xres,
-        shvideoenc-&gt;fbinfo.yres,
-        shvideoenc-&gt;fbinfo.xres,
+        shvideoenc-&gt;finfo.smem_start,
+        0UL,
+        (long)shvideoenc-&gt;fbinfo.xres,
+        (long)shvideoenc-&gt;fbinfo.yres,
+        (long)shvideoenc-&gt;fbinfo.xres,
         SHVEU_RGB565,
         SHVEU_NO_ROT);
     }
@@ -356,6 +374,8 @@ gst_shvideo_enc_dispose (GObject * object)
   shveu_close();
   sh_ceu_close(shvideoenc-&gt;ainfo.ceu);
 
+  uiomux_close (shvideoenc-&gt;uiomux);
+
   pthread_mutex_destroy(&amp;shvideoenc-&gt;capture_start_mutex);
   pthread_mutex_destroy(&amp;shvideoenc-&gt;capture_end_mutex);
   pthread_mutex_destroy(&amp;shvideoenc-&gt;blit_mutex);
@@ -817,6 +837,9 @@ launch_camera_encoder_thread(void *data)
 		 enc-&gt;ainfo.buf_input_yuv_file_with_path,
 		 enc-&gt;ainfo.buf_input_yuv_file);
 
+  /* uiomux open */
+  enc-&gt;uiomux = uiomux_open ();
+
   /* veu oopen */
   enc-&gt;veu = shveu_open();
 </diff>
      <filename>gstshvideocapenc.c</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>757fc79b39742e8529eaf728126383343eabe474</id>
    </parent>
  </parents>
  <author>
    <name>Conrad Parker</name>
    <email>conrad@metadecks.org</email>
  </author>
  <url>http://github.com/kfish/gst-sh-mobile/commit/87e3216c51992e4ff54fa7a83f11df2453451959</url>
  <id>87e3216c51992e4ff54fa7a83f11df2453451959</id>
  <committed-date>2009-10-16T06:49:22-07:00</committed-date>
  <authored-date>2009-10-16T02:41:25-07:00</authored-date>
  <message>use libuiomux memory addresses, update new shveu_op types</message>
  <tree>9023c376bb050f7628227dd4bbfab47d65fbf583</tree>
  <committer>
    <name>Conrad Parker</name>
    <email>conrad@metadecks.org</email>
  </committer>
</commit>
