annotate libvo/vesa_lvo.c @ 2988:a1860b3a33c9

more debugging in configure.log [temporary] (calls ldd to debug dependencies for [future] static support) $_ld_x11 contains now $_ld_sock improved x11 C test libGL is no longer OS dependent (bsd) but depends on 2 compil' tests preliminary support for -static: -static requires any test succeeds with that flag missing -logg for vorbis (triggered by -static) NB: It still can't compile in static [undefined reference to... errors :/ ]
author pl
date Mon, 19 Nov 2001 00:38:41 +0000
parents 49199909c939
children fb792e58aac5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2869
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
1 /*
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
2 * vesa_lvo.c
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
3 *
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
4 * Copyright (C) Nick Kurshev <nickols_k@mail.ru> - Oct 2001
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
5 *
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
6 * You can redistribute this file under terms and conditions
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
7 * of GNU General Public licence v2.
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
8 *
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
9 * This file contains vo_vesa interface to Linux Video Overlay.
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
10 * (Partly based on vo_mga.c from mplayer's package)
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
11 */
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
12
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
13 #include <inttypes.h>
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
14 #include <sys/ioctl.h>
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
15 #include <unistd.h>
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
16 #include <fcntl.h>
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
17 #include <sys/mman.h>
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
18 #include <stdio.h>
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
19 #include <stdlib.h>
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
20 #include <string.h>
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
21
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
22 #include "vesa_lvo.h"
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
23 #include "img_format.h"
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
24 #include "../drivers/mga_vid.h" /* <- should be changed to "linux/'something'.h" */
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
25 #include "fastmemcpy.h"
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
26 #include "../mmx_defs.h"
2974
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
27 #include "../postproc/rgb2rgb.h"
2869
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
28
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
29 #define WIDTH_ALIGN 32 /* should be 16 for radeons */
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
30 #define NUM_FRAMES 2
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
31 static uint8_t *frames[NUM_FRAMES];
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
32
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
33 static int lvo_handler = -1;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
34 static uint8_t *lvo_mem = NULL;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
35 static uint8_t next_frame;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
36 static mga_vid_config_t mga_vid_config;
2974
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
37 static unsigned image_bpp,image_height,image_width,src_format;
2952
91723d82b64f working draw_slice stuff
nick
parents: 2924
diff changeset
38 extern int verbose;
2869
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
39
2974
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
40 #define HAVE_RADEON 1
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
41
2869
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
42 #define PIXEL_SIZE() ((video_mode_info.BitsPerPixel+7)/8)
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
43 #define SCREEN_LINE_SIZE(pixel_size) (video_mode_info.XResolution*(pixel_size) )
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
44 #define IMAGE_LINE_SIZE(pixel_size) (image_width*(pixel_size))
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
45
2971
56faed773768 Added preinit of lvo stuff
nick
parents: 2964
diff changeset
46 int vlvo_preinit(const char *drvname)
56faed773768 Added preinit of lvo stuff
nick
parents: 2964
diff changeset
47 {
56faed773768 Added preinit of lvo stuff
nick
parents: 2964
diff changeset
48 lvo_handler = open(drvname,O_RDWR);
56faed773768 Added preinit of lvo stuff
nick
parents: 2964
diff changeset
49 if(lvo_handler == -1)
56faed773768 Added preinit of lvo stuff
nick
parents: 2964
diff changeset
50 {
56faed773768 Added preinit of lvo stuff
nick
parents: 2964
diff changeset
51 printf("vesa_lvo: Couldn't open '%s'\n",drvname);
56faed773768 Added preinit of lvo stuff
nick
parents: 2964
diff changeset
52 return -1;
56faed773768 Added preinit of lvo stuff
nick
parents: 2964
diff changeset
53 }
56faed773768 Added preinit of lvo stuff
nick
parents: 2964
diff changeset
54 return 0;
56faed773768 Added preinit of lvo stuff
nick
parents: 2964
diff changeset
55 }
56faed773768 Added preinit of lvo stuff
nick
parents: 2964
diff changeset
56
56faed773768 Added preinit of lvo stuff
nick
parents: 2964
diff changeset
57 int vlvo_init(unsigned src_width,unsigned src_height,
2869
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
58 unsigned x_org,unsigned y_org,unsigned dst_width,
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
59 unsigned dst_height,unsigned format,unsigned dest_bpp)
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
60 {
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
61 size_t i,awidth;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
62 image_width = src_width;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
63 image_height = src_height;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
64 mga_vid_config.version=MGA_VID_VERSION;
2974
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
65 src_format = mga_vid_config.format=format;
2869
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
66 awidth = (src_width + (WIDTH_ALIGN-1)) & ~(WIDTH_ALIGN-1);
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
67 switch(format){
2974
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
68 #ifdef HAVE_RADEON
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
69 case IMGFMT_YV12:
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
70 case IMGFMT_I420:
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
71 case IMGFMT_IYUV:
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
72 image_bpp=16;
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
73 mga_vid_config.format = IMGFMT_YUY2;
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
74 mga_vid_config.frame_size = awidth*src_height*2;
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
75 break;
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
76 #else
2869
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
77 case IMGFMT_YV12:
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
78 case IMGFMT_I420:
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
79 case IMGFMT_IYUV:
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
80 image_bpp=16;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
81 mga_vid_config.frame_size = awidth*src_height+(awidth*src_height)/2;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
82 break;
2974
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
83 #endif
2869
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
84 case IMGFMT_YUY2:
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
85 case IMGFMT_UYVY:
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
86 image_bpp=16;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
87 mga_vid_config.frame_size = awidth*src_height*2;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
88 break;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
89 case IMGFMT_RGB15:
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
90 case IMGFMT_BGR15:
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
91 case IMGFMT_RGB16:
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
92 case IMGFMT_BGR16:
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
93 image_bpp=16;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
94 mga_vid_config.frame_size = awidth*src_height*2;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
95 break;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
96 case IMGFMT_RGB24:
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
97 case IMGFMT_BGR24:
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
98 image_bpp=24;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
99 mga_vid_config.frame_size = awidth*src_height*3;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
100 break;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
101 case IMGFMT_RGB32:
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
102 case IMGFMT_BGR32:
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
103 image_bpp=32;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
104 mga_vid_config.frame_size = awidth*src_height*4;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
105 break;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
106 default:
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
107 printf("vesa_lvo: invalid output format %s(%0X)\n",vo_format_name(format),format);
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
108 return -1;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
109 }
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
110 mga_vid_config.colkey_on=0;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
111 mga_vid_config.src_width = src_width;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
112 mga_vid_config.src_height= src_height;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
113 mga_vid_config.dest_width = dst_width;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
114 mga_vid_config.dest_height= dst_height;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
115 mga_vid_config.x_org=x_org;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
116 mga_vid_config.y_org=y_org;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
117 mga_vid_config.num_frames=NUM_FRAMES;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
118 if (ioctl(lvo_handler,MGA_VID_CONFIG,&mga_vid_config))
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
119 {
2971
56faed773768 Added preinit of lvo stuff
nick
parents: 2964
diff changeset
120 perror("vesa_lvo: Error in mga_vid_config ioctl()");
56faed773768 Added preinit of lvo stuff
nick
parents: 2964
diff changeset
121 printf("vesa_lvo: Your fb_vid driver version is incompatible with this MPlayer version!\n");
2869
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
122 return -1;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
123 }
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
124 ioctl(lvo_handler,MGA_VID_ON,0);
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
125
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
126 frames[0] = (char*)mmap(0,mga_vid_config.frame_size*mga_vid_config.num_frames,PROT_WRITE,MAP_SHARED,lvo_handler,0);
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
127 for(i=1;i<NUM_FRAMES;i++)
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
128 frames[i] = frames[i-1] + mga_vid_config.frame_size;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
129 next_frame = 0;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
130 lvo_mem = frames[next_frame];
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
131
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
132 /*clear the buffer*/
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
133 memset(frames[0],0x80,mga_vid_config.frame_size*mga_vid_config.num_frames);
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
134 return 0;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
135 }
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
136
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
137 void vlvo_term( void )
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
138 {
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
139 ioctl( lvo_handler,MGA_VID_OFF,0 );
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
140 munmap(frames[0],mga_vid_config.frame_size*mga_vid_config.num_frames);
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
141 if(lvo_handler != -1) close(lvo_handler);
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
142 }
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
143
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
144 uint32_t vlvo_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y)
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
145 {
2924
8350b8c25c02 Xv stuff
nick
parents: 2869
diff changeset
146 #if 0
8350b8c25c02 Xv stuff
nick
parents: 2869
diff changeset
147 /* original vo_mga stuff */
2869
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
148 uint8_t *src;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
149 uint8_t *dest;
2924
8350b8c25c02 Xv stuff
nick
parents: 2869
diff changeset
150 uint32_t bespitch,bespitch2,srcpitch;
2869
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
151 int i;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
152
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
153 bespitch = (mga_vid_config.src_width + (WIDTH_ALIGN-1)) & ~(WIDTH_ALIGN-1);
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
154 bespitch2 = bespitch/2;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
155
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
156 dest = lvo_mem + bespitch * y + x;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
157 src = image[0];
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
158 for(i=0;i<h;i++){
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
159 memcpy(dest,src,w);
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
160 src+=stride[0];
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
161 dest += bespitch;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
162 }
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
163
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
164 w/=2;h/=2;x/=2;y/=2;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
165
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
166 dest = lvo_mem + bespitch*mga_vid_config.src_height + bespitch2 * y + x;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
167 src = image[1];
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
168 for(i=0;i<h;i++){
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
169 memcpy(dest,src,w);
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
170 src+=stride[1];
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
171 dest += bespitch2;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
172 }
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
173
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
174 dest = lvo_mem + bespitch*mga_vid_config.src_height
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
175 + bespitch*mga_vid_config.src_height / 4
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
176 + bespitch2 * y + x;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
177 src = image[2];
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
178 for(i=0;i<h;i++){
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
179 memcpy(dest,src,w);
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
180 src+=stride[2];
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
181 dest += bespitch2;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
182 }
2952
91723d82b64f working draw_slice stuff
nick
parents: 2924
diff changeset
183 #else
91723d82b64f working draw_slice stuff
nick
parents: 2924
diff changeset
184 uint8_t *src;
91723d82b64f working draw_slice stuff
nick
parents: 2924
diff changeset
185 uint8_t *dst;
2974
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
186 uint8_t bytpp;
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
187 bytpp = (image_bpp+7)/8;
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
188 dst = lvo_mem + (image_width * y + x)*bytpp;
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
189 #ifdef HAVE_RADEON
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
190 if(src_format == IMGFMT_YV12)
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
191 {
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
192 yv12toyuy2(image[0],image[1],image[2],dst
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
193 ,w,h,stride[0],stride[1],w*2);
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
194 }
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
195 else
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
196 #endif
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
197 {
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
198 src = image[0];
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
199 memcpy(dst,src,w*h*bytpp);
49199909c939 Ugly YV12 support on Radeon BES. (Only radeon_vid currently work with this stuff :( Sorry!)
nick
parents: 2971
diff changeset
200 }
2924
8350b8c25c02 Xv stuff
nick
parents: 2869
diff changeset
201 #endif
8350b8c25c02 Xv stuff
nick
parents: 2869
diff changeset
202 return 0;
2869
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
203 }
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
204
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
205 uint32_t vlvo_draw_frame(uint8_t *src[])
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
206 {
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
207 size_t i, ssize;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
208 uint8_t *dest;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
209 const uint8_t *sptr;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
210 ssize = IMAGE_LINE_SIZE((image_bpp+7)/8);
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
211 dest = lvo_mem;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
212 sptr = src[0];
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
213 for(i=0;i<image_height;i++)
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
214 {
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
215 memcpy(dest,sptr,ssize);
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
216 sptr += ssize;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
217 dest += ssize;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
218 }
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
219 }
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
220
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
221 void vlvo_flip_page(void)
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
222 {
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
223 ioctl(lvo_handler,MGA_VID_FSEL,&next_frame);
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
224 next_frame=(next_frame+1)%mga_vid_config.num_frames;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
225 lvo_mem=frames[next_frame];
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
226 }
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
227
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
228 void vlvo_draw_osd(void)
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
229 {
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
230 /* TODO: hw support */
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
231 }
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
232
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
233 uint32_t vlvo_query_info(uint32_t format)
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
234 {
2952
91723d82b64f working draw_slice stuff
nick
parents: 2924
diff changeset
235 if(verbose) printf("vesa_lvo: query_format was called: %x (%s)\n",format,vo_format_name(format));
2869
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
236 return 1;
107d9e9e5bd1 New video output technique Linux Video Overlay:
nick
parents:
diff changeset
237 }