Mercurial > mplayer.hg
comparison libvo/mga_common.c @ 4971:fa002f25631e
direct rendering support
author | arpi |
---|---|
date | Thu, 07 Mar 2002 02:44:16 +0000 |
parents | f21d15f0cba6 |
children | 877f0f643fef |
comparison
equal
deleted
inserted
replaced
4970:f21d15f0cba6 | 4971:fa002f25631e |
---|---|
1 | 1 |
2 #include "fastmemcpy.h" | 2 #include "fastmemcpy.h" |
3 #include "../mmx_defs.h" | 3 #include "../mmx_defs.h" |
4 #include "../mp_image.h" | |
4 | 5 |
5 // mga_vid drawing functions | 6 // mga_vid drawing functions |
6 | 7 |
7 static int mga_next_frame=0; | 8 static int mga_next_frame=0; |
8 | 9 |
170 uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31; | 171 uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31; |
171 | 172 |
172 mem2agpcpy_pic(vid_data, y, len, mga_vid_config.src_height, 2*bespitch, len); | 173 mem2agpcpy_pic(vid_data, y, len, mga_vid_config.src_height, 2*bespitch, len); |
173 } | 174 } |
174 | 175 |
175 | |
176 static uint32_t | 176 static uint32_t |
177 draw_frame(uint8_t *src[]) | 177 draw_frame(uint8_t *src[]) |
178 { | 178 { |
179 switch(mga_vid_config.format){ | 179 switch(mga_vid_config.format){ |
180 case MGA_VID_FORMAT_YUY2: | 180 case MGA_VID_FORMAT_YUY2: |
181 case MGA_VID_FORMAT_UYVY: | 181 case MGA_VID_FORMAT_UYVY: |
182 write_frame_yuy2(src[0]);break; | 182 write_frame_yuy2(src[0]);break; |
183 } | 183 } |
184 return 0; | 184 return 0; |
185 } | |
186 | |
187 static uint32_t | |
188 get_image(mp_image_t *mpi){ | |
189 uint32_t bespitch = (mga_vid_config.src_width + 31) & ~31; | |
190 uint32_t bespitch2 = bespitch/2; | |
191 // printf("mga: get_image() called\n"); | |
192 if(mpi->type==MP_IMGTYPE_STATIC) return VO_FALSE; // it is not static | |
193 if(mpi->flags&MP_IMGFLAG_READABLE) return VO_FALSE; // slow video ram | |
194 // printf("width=%d vs. bespitch=%d, flags=0x%X \n",mpi->width,bespitch,mpi->flags); | |
195 if((mpi->width==bespitch) || | |
196 (mpi->flags&(MP_IMGFLAG_ACCEPT_STRIDE|MP_IMGFLAG_ACCEPT_WIDTH))){ | |
197 // we're lucky or codec accepts stride => ok, let's go! | |
198 if(mpi->flags&MP_IMGFLAG_PLANAR){ | |
199 mpi->planes[0]=vid_data; | |
200 mpi->planes[1]=vid_data + bespitch*mga_vid_config.src_height; | |
201 mpi->planes[2]=vid_data + bespitch*mga_vid_config.src_height | |
202 + bespitch*mga_vid_config.src_height / 4; | |
203 mpi->width=mpi->stride[0]=bespitch; | |
204 mpi->stride[1]=mpi->stride[2]=bespitch2; | |
205 } else { | |
206 mpi->planes[0]=vid_data; | |
207 mpi->width=bespitch; | |
208 mpi->stride[0]=mpi->width*(mpi->bpp/8); | |
209 } | |
210 mpi->flags|=MP_IMGFLAG_DIRECT; | |
211 // printf("mga: get_image() SUCCESS -> Direct Rendering ENABLED\n"); | |
212 return VO_TRUE; | |
213 } | |
214 return VO_FALSE; | |
185 } | 215 } |
186 | 216 |
187 static uint32_t | 217 static uint32_t |
188 query_format(uint32_t format) | 218 query_format(uint32_t format) |
189 { | 219 { |
203 static uint32_t control(uint32_t request, void *data, ...) | 233 static uint32_t control(uint32_t request, void *data, ...) |
204 { | 234 { |
205 switch (request) { | 235 switch (request) { |
206 case VOCTRL_QUERY_FORMAT: | 236 case VOCTRL_QUERY_FORMAT: |
207 return query_format(*((uint32_t*)data)); | 237 return query_format(*((uint32_t*)data)); |
238 case VOCTRL_GET_IMAGE: | |
239 return get_image(data); | |
208 } | 240 } |
209 return VO_NOTIMPL; | 241 return VO_NOTIMPL; |
210 } | 242 } |
211 | 243 |
212 | 244 |