Mercurial > mplayer.hg
comparison vidix/sh_veu_vid.c @ 29946:54bacf6a38ca
Update the SuperH VEU vidix driver with code that calls fsync() after each
frame to make sure the frame is flushed in case of deferred io.
Patch by Magnus Damm, damm opensource se
author | cehoyos |
---|---|
date | Thu, 10 Dec 2009 23:16:08 +0000 |
parents | f504a06fcf50 |
children | 20da977f0f3e |
comparison
equal
deleted
inserted
replaced
29945:38485def91ba | 29946:54bacf6a38ca |
---|---|
1 /* | 1 /* |
2 * VIDIX driver for SuperH Mobile VEU hardware block. | 2 * VIDIX driver for SuperH Mobile VEU hardware block. |
3 * Copyright (C) 2008 Magnus Damm | 3 * Copyright (C) 2008, 2009 Magnus Damm |
4 * | 4 * |
5 * Requires a kernel that exposes the VEU hardware block to user space | 5 * Requires a kernel that exposes the VEU hardware block to user space |
6 * using UIO. Available in upstream linux-2.6.27 or later. | 6 * using UIO. Available in upstream linux-2.6.27 or later. |
7 * | 7 * |
8 * Tested using WVGA and QVGA panels with sh7722 VEU and sh7723 VEU2H. | 8 * Tested using WVGA and QVGA panels with sh7722 VEU and sh7723 VEU2H. |
177 | 177 |
178 /* clear framebuffer */ | 178 /* clear framebuffer */ |
179 memset(iomem, 0, fip->line_length * fip->height); | 179 memset(iomem, 0, fip->line_length * fip->height); |
180 munmap(iomem, fip->size); | 180 munmap(iomem, fip->size); |
181 | 181 |
182 close(fd); | 182 return fd; |
183 return 0; | |
184 } | 183 } |
185 | 184 |
186 #define VESTR 0x00 /* start register */ | 185 #define VESTR 0x00 /* start register */ |
187 #define VESWR 0x10 /* src: line length */ | 186 #define VESWR 0x10 /* src: line length */ |
188 #define VESSR 0x14 /* src: image size */ | 187 #define VESSR 0x14 /* src: image size */ |
266 unsigned long pos_y; | 265 unsigned long pos_y; |
267 }; | 266 }; |
268 | 267 |
269 static struct sh_veu_plane _src, _dst; | 268 static struct sh_veu_plane _src, _dst; |
270 static vidix_playback_t my_info; | 269 static vidix_playback_t my_info; |
270 static int fb_fd; | |
271 | 271 |
272 static int sh_veu_probe(int verbose, int force) | 272 static int sh_veu_probe(int verbose, int force) |
273 { | 273 { |
274 int ret; | 274 int ret; |
275 | 275 |
276 ret = get_fb_info("/dev/fb0", &fbi); | 276 ret = get_fb_info("/dev/fb0", &fbi); |
277 if (ret < 0) | 277 if (ret < 0) |
278 return ret; | 278 return ret; |
279 fb_fd = ret; | |
279 | 280 |
280 if (fbi.bpp != 16) { | 281 if (fbi.bpp != 16) { |
281 printf("sh_veu: only 16bpp supported\n"); | 282 printf("sh_veu: only 16bpp supported\n"); |
282 return -1; | 283 return -1; |
283 } | 284 } |
313 | 314 |
314 /* Wait for an interrupt */ | 315 /* Wait for an interrupt */ |
315 read(uio_dev.fd, &n_pending, sizeof(unsigned long)); | 316 read(uio_dev.fd, &n_pending, sizeof(unsigned long)); |
316 | 317 |
317 write_reg(&uio_mmio, 0x100, VEVTR); /* ack int, write 0 to bit 0 */ | 318 write_reg(&uio_mmio, 0x100, VEVTR); /* ack int, write 0 to bit 0 */ |
319 | |
320 /* flush framebuffer to handle deferred io case */ | |
321 fsync(fb_fd); | |
318 } | 322 } |
319 | 323 |
320 static int sh_veu_is_veu2h(void) | 324 static int sh_veu_is_veu2h(void) |
321 { | 325 { |
322 return uio_mmio.size > 0xb8; | 326 return uio_mmio.size > 0xb8; |
484 return 0; | 488 return 0; |
485 } | 489 } |
486 | 490 |
487 static void sh_veu_destroy(void) | 491 static void sh_veu_destroy(void) |
488 { | 492 { |
493 close(fb_fd); | |
489 } | 494 } |
490 | 495 |
491 static int sh_veu_get_caps(vidix_capability_t *to) | 496 static int sh_veu_get_caps(vidix_capability_t *to) |
492 { | 497 { |
493 memcpy(to, &sh_veu_cap, sizeof(vidix_capability_t)); | 498 memcpy(to, &sh_veu_cap, sizeof(vidix_capability_t)); |