]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/mplayer/mplayer-1.0pre7/mplayer-w100_1.0pre3.1.modified.diff
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / mplayer / mplayer-1.0pre7 / mplayer-w100_1.0pre3.1.modified.diff
1 diff -ruN MPlayer-1.0pre3/Makefile MPlayer-1.0pre3.custom/Makefile
2 --- MPlayer-1.0pre3.orig/Makefile    Tue Dec  9 06:33:31 2003
3 +++ MPlayer-1.0pre3/Makefile     Thu Dec 11 16:18:27 2003
4 @@ -17,7 +17,7 @@
5
6  # These subdirectories require installation due to binaries within them.
7  ifeq ($(VIDIX),yes)
8 -SUBDIRS += libdha vidix
9 +SUBDIRS += vidix
10  DO_MAKE = @ for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done
11  endif
12
13 @@ -45,7 +45,7 @@
14  PARTS += libfaad2
15  endif
16  ifeq ($(VIDIX),yes)
17 -PARTS += libdha vidix
18 +PARTS += vidix
19  endif
20  ifeq ($(FAME),yes)
21  PARTS += libfame
22 @@ -81,7 +81,7 @@
23  COMMON_DEPS += libfaad2/libfaad2.a
24  endif
25  ifeq ($(VIDIX),yes)
26 -COMMON_DEPS += libdha/libdha.so vidix/libvidix.a
27 +COMMON_DEPS += vidix/libvidix.a
28  endif
29  ifeq ($(FAME),yes)
30  COMMON_DEPS += libfame/libfame.a
31 diff -ruN MPlayer-1.0pre3.orig/configure MPlayer-1.0pre3/configure
32 --- MPlayer-1.0pre3.orig/configure      Tue Dec  9 06:33:31 2003
33 +++ MPlayer-1.0pre3/configure   Thu Dec 11 17:29:38 2003
34 @@ -2151,7 +2151,7 @@
35  #include <sys/types.h>
36  int main(void) { printf("%d\n", sizeof(size_t)*8); return 0; }
37  EOF
38 -cc_check && _wordsize=`$TMPO` && _mp_wordsize="#define MP_WORDSIZE $_wordsize"
39 +cc_check && _wordsize="32" && _mp_wordsize="#define MP_WORDSIZE $_wordsize"
40  echores "$_wordsize"
41  
42  
43 @@ -2289,6 +2289,8 @@
44  EOF
45  if mingw32 ; then
46    _ld_pthread=''
47 +elif true ; then
48 +  _ld_pthread='-lpthread'
49  elif ( cc_check && $TMPO ) ; then              # QNX
50    _ld_pthread=''
51  elif ( cc_check -lpthread && $TMPO ) ; then
52 diff -ruN MPlayer-1.0pre3.orig/vidix/drivers/Makefile MPlayer-1.0pre3/vidix/drivers/Makefile
53 --- MPlayer-1.0pre3.orig/vidix/drivers/Makefile Thu Oct 23 01:45:33 2003
54 +++ MPlayer-1.0pre3/vidix/drivers/Makefile      Thu Dec 11 17:13:01 2003
55 @@ -124,6 +131,12 @@
56  
57  $(SIS_VID):     $(SIS_OBJS)
58         $(CC) -shared $(SIS_OBJS) $(SIS_LIBS) -Wl,-soname,$(SIS_VID) -o $(SIS_VID) 
59 +
60 +$(W100_OBJS):    $(W100_SRCS)
61 +       $(CC) -c $(W100_CFLAGS) -o $@ $<
62 +
63 +$(W100_VID):     $(W100_OBJS)
64 +       $(CC) -shared $(W100_OBJS) $(W100_LIBS) -Wl,-soname,$(W100_VID) -o $(W100_VID)
65  
66  clean:
67         rm -f *.o *.so *~
68 diff -ruN MPlayer-1.0pre3.orig/vidix/drivers/w100_vid.c MPlayer-1.0pre3/vidix/drivers/w100_vid.c
69 --- MPlayer-1.0pre3.orig/vidix/drivers/w100_vid.c       Thu Jan  1 09:00:00 1970
70 +++ MPlayer-1.0pre3/vidix/drivers/w100_vid.c    Thu Dec 11 16:24:01 2003
71 @@ -0,0 +1,375 @@
72 +#include <errno.h>
73 +#include <stdio.h>
74 +#include <stdlib.h>
75 +#include <string.h>
76 +#include <inttypes.h>
77 +#include <unistd.h>
78 +
79 +#include "../vidix.h"
80 +#include "../fourcc.h"
81 +#include "../../config.h"
82 +#include "aticore.h"
83 +
84 +#define UNUSED(v) ((void)(v))
85 +
86 +static uint16_t st_overlayHandle;
87 +
88 +static vidix_capability_t w100_cap =
89 +{
90 +    "ATI W100 driver",
91 +    "AGAWA Koji <kaoru-K@self-core.org>",
92 +    TYPE_OUTPUT,
93 +    { 0, 0, 0, 0 },                     /* reserved */
94 +    480,                                /* max width */
95 +    640,                                /* max height */
96 +    4,                                  /* min width */
97 +    4,                                  /* min height */
98 +    -1,                                 /* max framerate */
99 +    FLAG_EQUALIZER,                     /* flags */
100 +    0x1002,                             /* VENDOR_ATI(libdha/pci_vendors.h) */
101 +    -1,                                 /* device id */
102 +    { 0, 0, 0, 0 }                      /* reserved */
103 +};
104 +
105 +unsigned int vixGetVersion(void)
106 +{
107 +    return VIDIX_VERSION;
108 +}
109 +
110 +int vixProbe(int verbose, int force)
111 +{
112 +    UNUSED(verbose);
113 +    UNUSED(force);
114 +    return 0;
115 +}
116 +
117 +int vixInit(void)
118 +{
119 +    if (AtiCore_ProcessAttach()) {
120 +        if (AtiCore_AllocOverlay(&st_overlayHandle))
121 +            return 0;
122 +    }
123 +
124 +    return ENOSYS;
125 +}
126 +
127 +void vixDestroy(void)
128 +{
129 +    AtiCore_SetOverlayOnOff(st_overlayHandle, 0);
130 +    AtiCore_ReleaseOverlay(st_overlayHandle);
131 +    AtiCore_ProcessDetach();
132 +}
133 +
134 +int vixGetCapability(vidix_capability_t *to)
135 +{
136 +    memcpy(to, &w100_cap, sizeof(vidix_capability_t));
137 +    return 0;
138 +}
139 +
140 +static int is_supported_fourcc(uint32_t fourcc)
141 +{
142 +    switch(fourcc) {
143 +    case IMGFMT_YV12:
144 +        return 1;
145 +    default:
146 +        return 0;
147 +    }
148 +}
149 +
150 +int vixQueryFourcc(vidix_fourcc_t *to)
151 +{
152 +    if (is_supported_fourcc(to->fourcc)) {
153 +        to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP |
154 +            VID_DEPTH_4BPP | VID_DEPTH_8BPP |
155 +            VID_DEPTH_12BPP| VID_DEPTH_15BPP|
156 +            VID_DEPTH_16BPP| VID_DEPTH_24BPP|
157 +            VID_DEPTH_32BPP;
158 +        to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK;
159 +/*         to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY; */
160 +        return 0;
161 +    } else
162 +        to->depth = to->flags = 0;
163 +
164 +    return ENOSYS;
165 +}
166 +
167 +int vixGetGrKeys(vidix_grkey_t *grkey)
168 +{
169 +    UNUSED(grkey);
170 +    return 0;
171 +}
172 +
173 +int vixSetGrKeys(const vidix_grkey_t *grkey)
174 +{
175 +    UNUSED(grkey);
176 +    return 0;
177 +}
178 +
179 +static vidix_video_eq_t st_equal =
180 +{
181 +    VEQ_CAP_BRIGHTNESS,
182 +    0, 0, 0, 0, 0, 0, 0, 0
183 +};
184 +
185 +int vixPlaybackGetEq(vidix_video_eq_t * eq)
186 +{
187 +    memcpy(eq, &st_equal, sizeof(st_equal));
188 +    return 0;
189 +}
190 +
191 +int vixPlaybackSetEq(const vidix_video_eq_t * eq)
192 +{
193 +    int br;
194 +
195 +    if (eq->cap & VEQ_CAP_BRIGHTNESS)
196 +        st_equal.brightness = eq->brightness;
197 +    if (eq->cap & VEQ_CAP_CONTRAST)
198 +        st_equal.contrast = eq->contrast;
199 +    if (eq->cap & VEQ_CAP_SATURATION)
200 +        st_equal.saturation = eq->saturation;
201 +    if (eq->cap & VEQ_CAP_HUE)
202 +        st_equal.hue = eq->hue;
203 +    if (eq->cap & VEQ_CAP_RGB_INTENSITY) {
204 +        st_equal.red_intensity   = eq->red_intensity;
205 +        st_equal.green_intensity = eq->green_intensity;
206 +        st_equal.blue_intensity  = eq->blue_intensity;
207 +    }
208 +    st_equal.flags = eq->flags;
209 +
210 +    br = (st_equal.brightness + 1000) * 127 / 2000;
211 +    if (br < 0)
212 +        br = 0;
213 +    if (br > 127)
214 +        br = 127;
215 +    if (br > 64)
216 +        br -= 64;
217 +    else
218 +        br += 64;
219 +
220 +    AtiCore_SetDisplayBrightness(br);
221 +
222 +    return 0;
223 +}
224 +
225 +static uint32_t st_frameOffsets[VID_PLAY_MAXFRAMES];
226 +static vidix_playback_t st_playbackInfo;
227 +static ATI_OVERLAYPROP st_overlayProp;
228 +
229 +int vixConfigPlayback(vidix_playback_t *info)
230 +{
231 +    int src_w, src_h;
232 +    int drw_w, drw_h;
233 +    int y_pitch, uv_pitch;
234 +    int i, ret, newNumFrames;
235 +    ATI_CLIPRECT clipRect;
236 +    uint32_t base;
237 +    uint32_t internalVramSize, internalVramAddr;
238 +    uint32_t externalVramSize, externalVramAddr;
239 +    int useExternalVram = 0;
240 +
241 +    if (!is_supported_fourcc(info->fourcc))
242 +        return -1;
243 +
244 +    src_w = info->src.w;
245 +    src_h = info->src.h;
246 +    drw_w = info->dest.w;
247 +    drw_h = info->dest.h;
248 +
249 +    switch (info->fourcc) {
250 +    case IMGFMT_YV12:
251 +        y_pitch = (src_w + 15) & ~15;
252 +        uv_pitch = ((src_w / 2) + 7) & ~7;
253 +        info->offset.y = 0;
254 +        info->offset.v = y_pitch * src_h;
255 +        info->offset.u = info->offset.v + uv_pitch * (src_h / 2);
256 +        info->frame_size = y_pitch * src_h + 2 * uv_pitch * (src_h / 2);
257 +        break;
258 +    default:
259 +        return -1;
260 +    }
261 +/*     fprintf(stderr, "w100_vid: num_frames:%d\n", info->num_frames); */
262 +/*     fprintf(stderr, "w100_vid: y_pitch:%d\n", y_pitch); */
263 +
264 +/*     fprintf(stderr, "w100_vid: struct info {\n"); */
265 +/*     fprintf(stderr, "w100_vid:   src.x:%d. src.y:%d. src.w:%d, src.h:%d,\n", */
266 +/*             info->src.x, info->src.y, info->src.w, info->src.h); */
267 +/*     fprintf(stderr, "w100_vid:   dest.x:%d. dest.y:%d. dest.w:%d, dest.h:%d,\n", */
268 +/*             info->dest.x, info->dest.y, info->dest.w, info->dest.h); */
269 +/*     fprintf(stderr, "w100_vid:   offset.y:%d, offset.v:%d offset.y:%d\n", */
270 +/*             info->offset.y, info->offset.v, info->offset.u); */
271 +/*     fprintf(stderr, "w100_vid:   frame_size:%d,\n", info->frame_size); */
272 +
273 +    GetAvailableVideoMem(&internalVramSize, &externalVramSize);
274 +    AtiCore_SetupMemoryTransfer(0, &internalVramAddr);
275 +    AtiCore_TerminateMemoryTransfer();
276 +    AtiCore_SetupMemoryTransfer(0xF000000, &externalVramAddr);
277 +    AtiCore_TerminateMemoryTransfer();
278 +
279 +/*     info->num_frames = 1; */
280 +    useExternalVram =  (getenv("MPLAYER_W100_USEEXTVRAM") ? 1 : 0);
281 +
282 +    if (useExternalVram) {
283 +        /* \e$B%U%l!<%`%P%C%U%!$H$7$FMxMQ$5$l$F$$$kItJ,$O;H$o$J$$\e(B */
284 +        base = 640 * 480 * 2;
285 +        newNumFrames = (externalVramSize - (640 * 480 * 2))
286 +            / info->frame_size;
287 +
288 +        /* FIXME: \e$B30It\e(B VRAM \e$B$K%*!<%P%l%$$r3NJ]$9$k$H!"\e(BVGA/QVGA \e$BLd$o$:\e(B
289 +         \e$BI=<($,GH>u$KMp$l$k!#\e(B @SL-C700/C750 */
290 +    } else {
291 +        /* \e$B%U%l!<%`%P%C%U%!It$b;H$o$J$$$H!"\e(BVRAM \e$BMFNL$,B-$j$J$$\e(B */
292 +/*         base = 320 * 240 * 2; */
293 +        base = 320 * 4 * 2;
294 +        memset((void *)internalVramAddr, 0x00, 320 * 4 * 2);
295 +        newNumFrames = internalVramSize / info->frame_size;
296 +    }
297 +
298 +    if (newNumFrames > info->num_frames)
299 +        newNumFrames = info->num_frames;
300 +    if (newNumFrames > VID_PLAY_MAXFRAMES)
301 +        newNumFrames = VID_PLAY_MAXFRAMES;
302 +    info->num_frames = newNumFrames;
303 +
304 +    info->dga_addr =
305 +        (void *)(useExternalVram ? externalVramAddr : internalVramAddr);
306 +/*     fprintf(stderr, "w100_vid:   num_frames:%d,\n", info->num_frames); */
307 +
308 +    info->dest.pitch.y = 16;
309 +    info->dest.pitch.u = 16;
310 +    info->dest.pitch.v = 16;
311 +
312 +/*     fprintf(stderr, "w100_vid: }\n"); */
313 +/*     fprintf(stderr, "w100_vid: base:%d\n", base); */
314 +
315 +    for (i = 0; i < info->num_frames; ++i) {
316 +        info->offsets[i] = base + info->frame_size * i;
317 +        st_frameOffsets[i] = info->offsets[i]
318 +            + (useExternalVram ? 0xF000000 : 0);
319 +    }
320 +
321 +    st_overlayProp.lpSrcBitmap = (void *)st_frameOffsets[0];
322 +    st_overlayProp.XCoord = 0;
323 +    st_overlayProp.YCoord = 0;
324 +    st_overlayProp.SrcPitch = y_pitch;
325 +    st_overlayProp.SrcHeight = src_h;
326 +    st_overlayProp.OverlayWidth = y_pitch;
327 +    st_overlayProp.OverlayHeight = src_h;
328 +    st_overlayProp.lpOverlayKey = 0;
329 +    st_overlayProp.OverlayFormat = OVLTYPE_YUV420;
330 +
331 +    ret = AtiCore_SetupOverlay(st_overlayHandle, &st_overlayProp);
332 +/*     printf("w100_vid: AtiCore_SetupOverlay: ret=%d\n", ret); */
333 +
334 +    clipRect.X_Top_Left = 0;
335 +    clipRect.Y_Top_Left = 0;
336 +    clipRect.X_Bottom_Right = st_overlayProp.SrcPitch;
337 +    clipRect.Y_Bottom_Right = st_overlayProp.SrcHeight;
338 +    AtiCore_SetDstClippingRect(&clipRect);
339 +    clipRect.X_Bottom_Right = info->src.w;
340 +    clipRect.Y_Bottom_Right = info->src.h;
341 +    AtiCore_SetSrcClippingRect(&clipRect);
342 +
343 +/*     AtiCore_SetOverlayPos(st_overlayHandle, info->dest.x, info->dest.y); */
344 +    AtiCore_SetOverlayPos(st_overlayHandle, 4, 0);
345 +
346 +    AtiCore_SetRopOperation(ROP3_SRCCOPY);
347 +    AtiCore_SetDstType(DSTTYPE_8BPP);
348 +    AtiCore_SetSrcType(SRCTYPE_EQU_DST);
349 +
350 +    vixPlaybackSetEq(&st_equal);
351 +
352 +    memcpy(&st_playbackInfo, info, sizeof(*info));
353 +
354 +/*     fprintf(stderr, "w100_vid: ---- vixConfigPlayback complete.\n"); */
355 +
356 +    return 0;
357 +}
358 +
359 +int vixPlaybackOn(void)
360 +{
361 +    AtiCore_SetOverlayOnOff(st_overlayHandle, 1);
362 +
363 +    return 0;
364 +}
365 +
366 +int vixPlaybackOff(void)
367 +{
368 +    AtiCore_SetOverlayOnOff(st_overlayHandle, 0);
369 +
370 +    return 0;
371 +}
372 +
373 +int vixPlaybackFrameSelect(unsigned int frame)
374 +{
375 +    st_overlayProp.lpSrcBitmap = (void *)st_frameOffsets[frame];
376 +    AtiCore_SetupOverlay(st_overlayHandle, &st_overlayProp);
377 +
378 +#if 0
379 +    ATI_STRETCH stretchOptions;
380 +    ATI_POINT dpPoint;
381 +    ATI_RECT srcRect, dstRect;
382 +    int ret;
383 +
384 +/*     fprintf(stderr, "w100_vid: vixPlaybackFrameSelect(frame=%d)\n", frame); */
385 +/*     fprintf(stderr, "w100_vid:   dga_addr:0x%08x, offset:%d,\n", */
386 +/*             st_playbackInfo.dga_addr, st_frameOffsets[frame]); */
387 +
388 +    stretchOptions.Count = 1;
389 +    stretchOptions.ScaleXFactor = 4;
390 +    stretchOptions.ScaleYFactor = 4;
391 +    stretchOptions.BlendOn = 0;
392 +    stretchOptions.dummy1 = 0;
393 +
394 +    dpPoint.XCoord = 0;
395 +    dpPoint.YCoord = 0;
396 +
397 +    srcRect.XCoord = st_playbackInfo.src.x;
398 +    srcRect.YCoord = st_playbackInfo.src.y;
399 +    srcRect.Width = st_playbackInfo.src.w;
400 +    srcRect.Height = st_playbackInfo.src.h;
401 +    fprintf(stderr, "%d, %d, %d, %d\n", srcRect.XCoord, srcRect.YCoord,
402 +            srcRect.Width, srcRect.Height);
403 +
404 +    dstRect.XCoord = 0;
405 +    dstRect.YCoord = 0;
406 +    dstRect.Width = 432;//st_playbackInfo.src.w;
407 +    dstRect.Height = 592;//st_playbackInfo.src.h;
408 +
409 +#if 1
410 +    while (AtiCore_WaitComplete(100) != 1)
411 +        ;
412 +
413 +       AtiCore_SetRopOperation( ROP3_SRCCOPY );
414 +       AtiCore_SetDstType( DSTTYPE_8BPP );
415 +       AtiCore_SetSrcType( SRCTYPE_EQU_DST );
416 +
417 +    ret = AtiCore_SetSrcPitchOffset(st_playbackInfo.src.w,
418 +                                    st_frameOffsets[frame]);
419 +    fprintf(stderr, "AtiCore_SetSrcPitchOffset(%d, %x) %d\n",
420 +            st_playbackInfo.src.w, st_frameOffsets[frame], ret);
421 +    ret = AtiCore_SetDstPitchOffset(432, 0);
422 +/*     printf("AtiCore_SetDstPitchOffset: ret=%d\n", ret); */
423 +
424 +/*     ret = AtiCore_BitBltFilpRotate(0, &srcRect, &dstRect); */
425 +    ret = AtiCore_StretchBlt(&stretchOptions, &dpPoint, &srcRect);
426 +    fprintf(stderr, "AtiCore_StretchBlt: ret=%d\n", ret);
427 +
428 +#else
429 +    {
430 +        int y, srcOffset = 0, dstOffset = 0;
431 +        fprintf(stderr, "%d %d %d\n", st_playbackInfo.src.h,
432 +                st_playbackInfo.src.w, 0);
433 +        for (y = 0; y < st_playbackInfo.src.h; ++y) {
434 +            memcpy(
435 +                0xF1100000 + dstOffset,
436 +                st_playbackInfo.dga_addr + st_playbackInfo.offsets[frame] + srcOffset,
437 +                st_playbackInfo.src.w);
438 +            srcOffset += st_playbackInfo.src.w;
439 +            dstOffset += 432;
440 +        }
441 +    }
442 +#endif
443 +#endif
444 +
445 +    return 0;
446 +}