Update of /cvsroot/mplayer/main/libvo In directory usw-pr-cvs1:/tmp/cvs-serv13012 Modified Files: vo_fbdev.c Log Message: changed query_format return; lots of fixes/changes Index: vo_fbdev.c =================================================================== RCS file: /cvsroot/mplayer/main/libvo/vo_fbdev.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -r1.28 -r1.29 *** vo_fbdev.c 2001/04/18 10:59:12 1.28 --- vo_fbdev.c 2001/04/19 01:18:05 1.29 *************** *** 352,356 **** static float dcf(fb_mode_t *m) //driving clock frequency { ! return 1000000.0f / m->pixclock; } --- 352,356 ---- static float dcf(fb_mode_t *m) //driving clock frequency { ! return 1e12f / m->pixclock; } *************** *** 386,409 **** int i; fb_mode_t *best = fb_modes; ! fb_mode_t *curr = fb_modes + 1; ! for (i = nr_modes - 1; i; i--, curr++) { ! if (curr->xres >= xres && curr->yres >= yres) { if (curr->xres < best->xres && curr->yres < best->yres) { ! if (!in_range(hfreq, hsf(curr))) ! continue; ! if (!in_range(vfreq, vsf(curr))) ! continue; ! if (!in_range(dotclock, dcf(curr))) ! continue; best = curr; ! } ! } } - if ((best->xres < xres || best->yres < yres) || - !in_range(hfreq, hsf(best)) || - !in_range(vfreq, vsf(best)) || - !in_range(dotclock, dcf(curr))) - return NULL; return best; } --- 386,438 ---- int i; fb_mode_t *best = fb_modes; ! fb_mode_t *curr; ! /* find first working mode */ ! for (i = nr_modes - 1; i; i--, best++) { ! if (in_range(hfreq, hsf(best)) && in_range(vfreq, vsf(best)) && ! in_range(dotclock, dcf(best))) ! break; ! if (verbose > 1) ! printf(FBDEV "can't set %dx%d\n", best->xres, best->yres); ! } ! ! if (!i) ! return NULL; ! if (i == 1) ! return best; ! ! for (curr = best + 1; i; i--, curr++) { ! if (!in_range(hfreq, hsf(curr))) ! continue; ! if (!in_range(vfreq, vsf(curr))) ! continue; ! if (!in_range(dotclock, dcf(curr))) ! continue; ! if (verbose > 1) ! printf(FBDEV "%dx%d ", curr->xres, curr->yres); ! if ((best->xres < xres || best->yres < yres) && ! (curr->xres > best->xres || ! curr->yres > best->yres)) { ! if (verbose > 1) ! printf("better than %dx%d\n", best->xres, ! best->yres); ! best = curr; ! } else if (curr->xres >= xres && curr->yres >= yres) { if (curr->xres < best->xres && curr->yres < best->yres) { ! if (verbose > 1) ! printf("smaller than %dx%d\n", ! best->xres, best->yres); best = curr; ! } else if (curr->xres == best->xres && ! curr->yres == best->yres && ! (vsf(curr) > vsf(best))) { ! if (verbose > 1) ! printf("faster screen refresh\n"); ! best = curr; ! } else if (verbose > 1) ! printf("\n"); ! } else if (verbose > 1) ! printf("is too small\n"); } return best; } *************** *** 539,542 **** --- 568,572 ---- static size_t fb_size; static uint8_t *frame_buffer; + static uint8_t *L123123875; /* thx to .so */ static struct fb_fix_screeninfo fb_finfo; static struct fb_var_screeninfo fb_orig_vinfo; *************** *** 551,555 **** static fb_mode_t *fb_mode = NULL; - static void (*put_frame)(void); static int left_band_width; static int right_band_width; --- 581,584 ---- *************** *** 674,680 **** } ! static void put_frame_without_bands(void); ! static void put_frame_with_bands(void); static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, --- 703,714 ---- } ! static void clear_bg(void) ! { ! int i, offset = 0; + for (i = 0; i < out_height; i++, offset += fb_screen_width) + memset(frame_buffer + offset, 0x0, out_width * fb_pixel_size); + } + static uint32_t init(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, char *title, *************** *** 741,744 **** --- 775,780 ---- return 1; } + printf(FBDEV "using mode %dx%d @ %.1fHz\n", fb_mode->xres, + fb_mode->yres, vsf(fb_mode)); fb_mode2fb_vinfo(fb_mode, &fb_vinfo); } *************** *** 759,770 **** if (verbose > 0) { printf(FBDEV "var info:\n"); ! printf(FBDEV "xres: %ul\n", fb_vinfo.xres); ! printf(FBDEV "yres: %ul\n", fb_vinfo.yres); ! printf(FBDEV "xres_virtual: %ul\n", fb_vinfo.xres_virtual); ! printf(FBDEV "yres_virtual: %ul\n", fb_vinfo.yres_virtual); ! printf(FBDEV "xoffset: %ul\n", fb_vinfo.xoffset); ! printf(FBDEV "yoffset: %ul\n", fb_vinfo.yoffset); ! printf(FBDEV "bits_per_pixel: %ul\n", fb_vinfo.bits_per_pixel); ! printf(FBDEV "grayscale: %ul\n", fb_vinfo.grayscale); printf(FBDEV "red: %lu %lu %lu\n", (unsigned long) fb_vinfo.red.offset, --- 795,806 ---- if (verbose > 0) { printf(FBDEV "var info:\n"); ! printf(FBDEV "xres: %u\n", fb_vinfo.xres); ! printf(FBDEV "yres: %u\n", fb_vinfo.yres); ! printf(FBDEV "xres_virtual: %u\n", fb_vinfo.xres_virtual); ! printf(FBDEV "yres_virtual: %u\n", fb_vinfo.yres_virtual); ! printf(FBDEV "xoffset: %u\n", fb_vinfo.xoffset); ! printf(FBDEV "yoffset: %u\n", fb_vinfo.yoffset); ! printf(FBDEV "bits_per_pixel: %u\n", fb_vinfo.bits_per_pixel); ! printf(FBDEV "grayscale: %u\n", fb_vinfo.grayscale); printf(FBDEV "red: %lu %lu %lu\n", (unsigned long) fb_vinfo.red.offset, *************** *** 783,802 **** (unsigned long) fb_vinfo.transp.length, (unsigned long) fb_vinfo.transp.msb_right); ! printf(FBDEV "nonstd: %ul\n", fb_vinfo.nonstd); if (verbose > 1) { ! printf(FBDEV "activate: %ul\n", fb_vinfo.activate); ! printf(FBDEV "height: %ul\n", fb_vinfo.height); ! printf(FBDEV "width: %ul\n", fb_vinfo.width); ! printf(FBDEV "accel_flags: %ul\n", fb_vinfo.accel_flags); printf(FBDEV "timing:\n"); ! printf(FBDEV "pixclock: %ul\n", fb_vinfo.pixclock); ! printf(FBDEV "left_margin: %ul\n", fb_vinfo.left_margin); ! printf(FBDEV "right_margin: %ul\n", fb_vinfo.right_margin); ! printf(FBDEV "upper_margin: %ul\n", fb_vinfo.upper_margin); ! printf(FBDEV "lower_margin: %ul\n", fb_vinfo.lower_margin); ! printf(FBDEV "hsync_len: %ul\n", fb_vinfo.hsync_len); ! printf(FBDEV "vsync_len: %ul\n", fb_vinfo.vsync_len); ! printf(FBDEV "sync: %ul\n", fb_vinfo.sync); ! printf(FBDEV "vmode: %ul\n", fb_vinfo.vmode); } } --- 819,838 ---- (unsigned long) fb_vinfo.transp.length, (unsigned long) fb_vinfo.transp.msb_right); ! printf(FBDEV "nonstd: %u\n", fb_vinfo.nonstd); if (verbose > 1) { ! printf(FBDEV "activate: %u\n", fb_vinfo.activate); ! printf(FBDEV "height: %u\n", fb_vinfo.height); ! printf(FBDEV "width: %u\n", fb_vinfo.width); ! printf(FBDEV "accel_flags: %u\n", fb_vinfo.accel_flags); printf(FBDEV "timing:\n"); ! printf(FBDEV "pixclock: %u\n", fb_vinfo.pixclock); ! printf(FBDEV "left_margin: %u\n", fb_vinfo.left_margin); ! printf(FBDEV "right_margin: %u\n", fb_vinfo.right_margin); ! printf(FBDEV "upper_margin: %u\n", fb_vinfo.upper_margin); ! printf(FBDEV "lower_margin: %u\n", fb_vinfo.lower_margin); ! printf(FBDEV "hsync_len: %u\n", fb_vinfo.hsync_len); ! printf(FBDEV "vsync_len: %u\n", fb_vinfo.vsync_len); ! printf(FBDEV "sync: %u\n", fb_vinfo.sync); ! printf(FBDEV "vmode: %u\n", fb_vinfo.vmode); } } *************** *** 811,815 **** printf(FBDEV "smem_start: %p\n", (void *) fb_finfo.smem_start); } ! printf(FBDEV "framebuffer size: %d bytes\n", fb_size); printf(FBDEV "type: %lu\n", (unsigned long) fb_finfo.type); printf(FBDEV "type_aux: %lu\n", (unsigned long) fb_finfo.type_aux); --- 847,851 ---- printf(FBDEV "smem_start: %p\n", (void *) fb_finfo.smem_start); } ! printf(FBDEV "framebuffer size: %d bytes\n", fb_finfo.smem_len); printf(FBDEV "type: %lu\n", (unsigned long) fb_finfo.type); printf(FBDEV "type_aux: %lu\n", (unsigned long) fb_finfo.type_aux); *************** *** 823,828 **** if (verbose > 1) { printf(FBDEV "mmio_start: %p\n", (void *) fb_finfo.mmio_start); ! printf(FBDEV "mmio_len: %ul bytes\n", fb_finfo.mmio_len); ! printf(FBDEV "accel: %ul\n", fb_finfo.accel); } } --- 859,864 ---- if (verbose > 1) { printf(FBDEV "mmio_start: %p\n", (void *) fb_finfo.mmio_start); ! printf(FBDEV "mmio_len: %u bytes\n", fb_finfo.mmio_len); ! printf(FBDEV "accel: %u\n", fb_finfo.accel); } } *************** *** 892,904 **** return 1; } - left_band_width = (out_width - in_width) / 2; - right_band_width = (out_width - in_width + 1) / 2; - upper_band_height = (out_height - in_height) / 2; - lower_band_height = (out_height - in_height + 1) / 2; - if (left_band_width || right_band_width || upper_band_height || - lower_band_height) - put_frame = put_frame_with_bands; - else - put_frame = put_frame_without_bands; fb_pixel_size = fb_vinfo.bits_per_pixel / 8; --- 928,931 ---- *************** *** 916,924 **** return 1; } if (verbose > 0) { printf(FBDEV "other:\n"); ! if (verbose > 1) printf(FBDEV "frame_buffer @ %p\n", frame_buffer); printf(FBDEV "fb_bpp: %d\n", fb_bpp); printf(FBDEV "fb_real_bpp: %d\n", fb_real_bpp); --- 943,955 ---- return 1; } + L123123875 = frame_buffer + (out_width - in_width) * fb_pixel_size / + 2 + (out_height - in_height) * fb_screen_width / 2; if (verbose > 0) { printf(FBDEV "other:\n"); ! if (verbose > 1) { printf(FBDEV "frame_buffer @ %p\n", frame_buffer); + printf(FBDEV "L123123875 @ %p\n", L123123875); + } printf(FBDEV "fb_bpp: %d\n", fb_bpp); printf(FBDEV "fb_real_bpp: %d\n", fb_real_bpp); *************** *** 934,937 **** --- 965,969 ---- if (format == IMGFMT_YV12) yuv2rgb_init(fb_bpp, MODE_RGB); + clear_bg(); return 0; } *************** *** 939,942 **** --- 971,976 ---- static uint32_t query_format(uint32_t format) { + int ret = 0x4; /* osd/sub supported on all bpp */ + if (!fb_preinit_done) if (fb_preinit()) *************** *** 945,962 **** return 0; - if (verbose > 0) - printf(FBDEV "query_format(%#lx(%.4s))\n",(unsigned long) format, - (char *) &format); if ((format & IMGFMT_BGR_MASK) == IMGFMT_BGR) { int bpp = format & 0xff; if (bpp == fb_bpp) ! return 1; else if (bpp == 15 && fb_bpp == 16) ! return 1; else if (bpp == 24 && fb_bpp == 32) ! return 1; } if (format == IMGFMT_YV12) ! return 1; return 0; } --- 979,994 ---- return 0; if ((format & IMGFMT_BGR_MASK) == IMGFMT_BGR) { int bpp = format & 0xff; + if (bpp == fb_bpp) ! return ret|0x2; else if (bpp == 15 && fb_bpp == 16) ! return ret|0x1; else if (bpp == 24 && fb_bpp == 32) ! return ret|0x1; } if (format == IMGFMT_YV12) ! return ret|0x2; return 0; } *************** *** 986,990 **** int dstride = in_width * fb_pixel_size; ! switch (fb_real_bpp) { case 24: vo_draw_alpha_rgb24(w, h, src, srca, stride, dst, dstride); --- 1018,1022 ---- int dstride = in_width * fb_pixel_size; ! switch (fb_bpp) { case 24: vo_draw_alpha_rgb24(w, h, src, srca, stride, dst, dstride); *************** *** 1047,1056 **** } ! static void put_frame_without_bands(void) { int i, out_offset = 0, in_offset = 0; for (i = 0; i < in_height; i++) { ! memcpy(frame_buffer + out_offset, next_frame + in_offset, in_width * fb_pixel_size); out_offset += fb_screen_width; --- 1079,1088 ---- } ! static void put_frame(void) { int i, out_offset = 0, in_offset = 0; for (i = 0; i < in_height; i++) { ! memcpy(L123123875 + out_offset, next_frame + in_offset, in_width * fb_pixel_size); out_offset += fb_screen_width; *************** *** 1059,1096 **** } - static void put_frame_with_bands(void) - { - int i, out_offset = 0, in_offset = 0, w, bw, tmp; - - if (upper_band_height) { - out_offset = upper_band_height * out_width * fb_pixel_size; - memset(frame_buffer, 0x00, out_offset); - } - if (left_band_width) { - tmp = left_band_width * fb_pixel_size; - memset(frame_buffer + out_offset, 0x00, tmp); - out_offset += tmp; - } - w = in_width * fb_pixel_size; - bw = (left_band_width + right_band_width) * fb_pixel_size; - for (i = 0; i < in_height - 1; i++) { - memcpy(frame_buffer + out_offset, next_frame + in_offset, w); - if (bw) - memset(frame_buffer + out_offset + w, 0x00, bw); - out_offset += fb_screen_width; - in_offset += w; - } - memcpy(frame_buffer + out_offset, next_frame + in_offset, w); - out_offset += w; - if (right_band_width) { - tmp = right_band_width * fb_pixel_size; - memset(frame_buffer + out_offset, 0x00, tmp); - out_offset += tmp; - } - if (lower_band_height) - memset(frame_buffer + out_offset, 0x00, lower_band_height * - out_width * fb_pixel_size); - } - extern void vo_draw_text(int dxs, int dys, void (*draw_alpha)(int x0, int y0, int w, int h, unsigned char *src, unsigned char *srca, --- 1091,1094 ---- *************** *** 1101,1105 **** vo_draw_text(in_width, in_height, draw_alpha); check_events(); ! (*put_frame)(); } --- 1099,1103 ---- vo_draw_text(in_width, in_height, draw_alpha); check_events(); ! put_frame(); } *************** *** 1113,1118 **** fb_cmap_changed = 0; } - // memset(next_frame, '\0', in_height * in_width * fb_pixel_size); - // put_frame(); free(next_frame); if (ioctl(fb_dev_fd, FBIOGET_VSCREENINFO, &fb_vinfo)) --- 1111,1114 ---- _______________________________________________ Mplayer-cvslog mailing list Mplayer-cvslog@lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog
participants (1)
-
Szabolcs Berecz