codec-engine: fix lpm build and clean up old files
[vuplus_openembedded] / packages / dsplink / files / dmai-update-v4l2-display.patch
1 Index: dmai_1_20_00_06/packages/ti/sdo/dmai/linux/Display_v4l2.c
2 ===================================================================
3 --- dmai_1_20_00_06.orig/packages/ti/sdo/dmai/linux/Display_v4l2.c      2009-02-11 19:22:51.000000000 -0600
4 +++ dmai_1_20_00_06/packages/ti/sdo/dmai/linux/Display_v4l2.c   2009-02-11 19:27:02.000000000 -0600
5 @@ -120,7 +120,9 @@
6      struct v4l2_format         fmt;
7      enum v4l2_buf_type         type;
8      Display_Handle             hDisplay;
9 -    Int                        channel;
10 +#if defined(Dmai_Device_omap3530) && defined(V4L2_CID_ROTATION)
11 +    struct v4l2_control        control;
12 +#endif
13  
14      assert(attrs);
15  
16 @@ -134,44 +136,6 @@
17  
18      hDisplay->userAlloc = TRUE;
19  
20 -#ifdef Dmai_Device_omap3530
21 -    /* channel = 0 - digital video path
22 -     * channel = 1 - analog video path
23 -     */
24 -    switch (attrs->videoOutput) {
25 -        case Display_Output_SVIDEO:
26 -        case Display_Output_COMPOSITE:
27 -            channel = 1;
28 -            break;
29 -        case Display_Output_DVI:
30 -        case Display_Output_LCD:
31 -        case Display_Output_SYSTEM:
32 -            channel = 0;
33 -            break;
34 -        default:
35 -            /* do nothing */
36 -            break;
37 -    }
38 -#else
39 -    if (strcmp(attrs->displayDevice, "/dev/video2") == 0) {
40 -        channel = 0;
41 -    }
42 -    else if (strcmp(attrs->displayDevice, "/dev/video3") == 0) {
43 -        channel = 1;
44 -    }
45 -    else {
46 -        Dmai_err1("%s not a display device\n", attrs->displayDevice);
47 -        cleanup(hDisplay);
48 -        return NULL;
49 -    }
50 -#endif
51 -
52 -    /* Set up the sysfs variables before opening the display device */
53 -    if (_Display_sysfsSetup(attrs, channel) < 0) {
54 -        cleanup(hDisplay);
55 -        return NULL;
56 -    }
57 -
58      /* Open video capture device */
59      hDisplay->fd = open(attrs->displayDevice, O_RDWR, 0);
60  
61 @@ -182,9 +146,8 @@
62          return NULL;
63      }
64  
65 -#ifdef Dmai_Device_omap3530
66 -#define VIDIOC_S_OMAP2_ROTATION     _IOW ('V', 3,  int)
67 -
68 +    
69 +#if defined(Dmai_Device_omap3530) && defined(V4L2_CID_ROTATION)
70      if (attrs->rotation != 0 && attrs->rotation != 90 &&
71          attrs->rotation != 180 && attrs->rotation != 270) {
72  
73 @@ -193,49 +156,16 @@
74          return NULL;
75      }
76  
77 -    if (ioctl(hDisplay->fd, VIDIOC_S_OMAP2_ROTATION, &attrs->rotation) < 0) {
78 -        Dmai_err2("Failed VIDIOC_S_OMAP2_ROTATION on %s (%s)\n",
79 +    control.id = V4L2_CID_ROTATION;
80 +    control.value = attrs->rotation;
81 +
82 +    if (ioctl(hDisplay->fd, VIDIOC_S_CTRL, &control) < 0) {
83 +        Dmai_err2("Failed VIDIOC_S_CTRL on %s (%s)\n",
84                    attrs->displayDevice, strerror(errno));
85          cleanup(hDisplay);
86          return NULL;
87      }
88  
89 -    switch (attrs->videoStd) {
90 -        case VideoStd_D1_NTSC:
91 -            fmt.fmt.pix.width = VideoStd_D1_WIDTH;
92 -            fmt.fmt.pix.height = VideoStd_D1_NTSC_HEIGHT;
93 -            break;
94 -        case VideoStd_D1_PAL:
95 -            fmt.fmt.pix.width = VideoStd_D1_WIDTH;
96 -            fmt.fmt.pix.height = VideoStd_D1_PAL_HEIGHT;
97 -            break;
98 -        case VideoStd_VGA:
99 -            fmt.fmt.pix.width = VideoStd_VGA_WIDTH;
100 -            fmt.fmt.pix.height = VideoStd_VGA_HEIGHT;
101 -            break;
102 -        case VideoStd_480P:
103 -            fmt.fmt.pix.width = VideoStd_480P_WIDTH;
104 -            fmt.fmt.pix.height = VideoStd_480P_HEIGHT;
105 -            break;
106 -        case VideoStd_720P_60:
107 -            fmt.fmt.pix.width = VideoStd_480P_WIDTH;
108 -            fmt.fmt.pix.height = VideoStd_480P_HEIGHT;
109 -            break;
110 -        default:
111 -            Dmai_err1("Unknown video standard %d\n", attrs->videoStd);
112 -            cleanup(hDisplay);
113 -            return NULL;
114 -    }
115 -
116 -    fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_UYVY;
117 -    fmt.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
118 -
119 -    if (ioctl(hDisplay->fd, VIDIOC_S_FMT, &fmt) == -1) {
120 -        Dmai_err2("Failed VIDIOC_S_FMT on %s (%s)\n", attrs->displayDevice,
121 -                                                      strerror(errno));
122 -        cleanup(hDisplay);
123 -        return NULL;
124 -    }
125  #endif /* Dmai_Device_omap3530 */
126  
127      /* Determine the video image dimensions */