Lines Matching +full:v +full:- +full:blanking
1 /* $NetBSD: vesagtf.c,v 1.2 2013/09/15 15:56:07 martin Exp $ */
3 /*-
43 * This has required the use of 64-bit integers in a few places, but
89 * Copyright (c) 1994, 1995, 1996 - Video Electronics Standards
120 * surrounding the addressable video); on most non-overscan type
170 /* C' and M' are part of the Blanking Duty Cycle computation */
172 * #define C_PRIME (((C - J) * K/256.0) + J)
180 #define C_PRIME256(p) (((p->C - p->J) * p->K) + (p->J * 256))
181 #define M_PRIME256(p) (p->K * p->M)
186 * print_value() - print the result of the named computation; this is
195 printf("%2d: %-27s: %u\n", n, name, val); in print_value()
202 * vert_refresh() - as defined by the GTF Timing Standard, compute the
264 * [V LINES RND] = IF([INT RQD?]="y", ROUND([V LINES]/2,0), in vesagtf_mode_params()
265 * ROUND([V LINES],0)) in vesagtf_mode_params()
270 print_value(2, "[V LINES RND]", v_lines); in vesagtf_mode_params()
275 * [V FIELD RATE RQD] = IF([INT RQD?]="y", [I/P FREQ RQD]*2, in vesagtf_mode_params()
281 print_value(3, "[V FIELD RATE RQD]", v_field_rqd); in vesagtf_mode_params()
288 * ROUND(([MARGIN%]/100*[V LINES RND]),0), in vesagtf_mode_params()
296 DIVIDE(v_lines * params->margin_ppt, 1000) : 0; in vesagtf_mode_params()
317 * [H PERIOD EST] = ((1/[V FIELD RATE RQD]) - [MIN VSYNC+BP]/1000000) / in vesagtf_mode_params()
318 * ([V LINES RND] + (2*[TOP MARGIN (LINES)]) + in vesagtf_mode_params()
321 * To make it integer friendly, we pre-multiply the 1000000 to get to in vesagtf_mode_params()
324 * [H PERIOD EST] = ((1000000/[V FIELD RATE RQD]) - [MIN VSYNC+BP]) / in vesagtf_mode_params()
325 * ([V LINES RND] + (2 * [TOP MARGIN (LINES)]) + in vesagtf_mode_params()
335 * [H PERIOD EST] = ((2*((1000000/[V FIELD RATE RQD]) - [MIN VSYNC+BP])) / in vesagtf_mode_params()
336 * (2*([V LINES RND] + (2*[TOP MARGIN (LINES)]) + in vesagtf_mode_params()
344 h_period_est = DIVIDE(((DIVIDE(2000000000000ULL, v_field_rqd)) - in vesagtf_mode_params()
345 (2000000 * params->min_vsbp)), in vesagtf_mode_params()
346 ((2 * (v_lines + (2 * top_margin) + params->min_porch)) + interlace)); in vesagtf_mode_params()
351 /* 8. Find the number of lines in V sync + back porch: in vesagtf_mode_params()
353 * [V SYNC+BP] = ROUND(([MIN VSYNC+BP]/[H PERIOD EST]),0) in vesagtf_mode_params()
358 vsync_plus_bp = DIVIDE(params->min_vsbp * 1000000, h_period_est); in vesagtf_mode_params()
360 print_value(8, "[V SYNC+BP]", vsync_plus_bp); in vesagtf_mode_params()
363 /* 9. Find the number of lines in V back porch alone: in vesagtf_mode_params()
365 * [V BACK PORCH] = [V SYNC+BP] - [V SYNC RND] in vesagtf_mode_params()
367 * XXX is "[V SYNC RND]" a typo? should be [V SYNC RQD]? in vesagtf_mode_params()
370 v_back_porch = vsync_plus_bp - params->vsync_rqd; in vesagtf_mode_params()
372 print_value(9, "[V BACK PORCH]", v_back_porch); in vesagtf_mode_params()
377 * [TOTAL V LINES] = [V LINES RND] + [TOP MARGIN (LINES)] + in vesagtf_mode_params()
378 * [BOT MARGIN (LINES)] + [V SYNC+BP] + [INTERLACE] + in vesagtf_mode_params()
383 interlace + params->min_porch; in vesagtf_mode_params()
385 print_value(10, "[TOTAL V LINES]", total_v_lines); in vesagtf_mode_params()
390 * [V FIELD RATE EST] = 1 / [H PERIOD EST] / [TOTAL V LINES] * 1000000 in vesagtf_mode_params()
397 * [V FIELD RATE EST] = 1000000000 / [H PERIOD EST] / [TOTAL V LINES] in vesagtf_mode_params()
405 print_value(11, "[V FIELD RATE EST(uHz)]", v_field_est); in vesagtf_mode_params()
410 * [H PERIOD] = [H PERIOD EST] / ([V FIELD RATE RQD] / [V FIELD RATE EST]) in vesagtf_mode_params()
420 * [V FIELD RATE] = 1 / [H PERIOD] / [TOTAL V LINES] * 1000000 in vesagtf_mode_params()
424 * [V FIELD RATE] = 1000000 / [H PERIOD] / [TOTAL V LINES] in vesagtf_mode_params()
431 print_value(13, "[V FIELD RATE]", v_field_rate); in vesagtf_mode_params()
436 * [V FRAME RATE] = (IF([INT RQD?]="y", [V FIELD RATE]/2, [V FIELD RATE])) in vesagtf_mode_params()
444 print_value(14, "[V FRAME RATE]", v_frame_rate); in vesagtf_mode_params()
460 DIVIDE(DIVIDE(h_pixels * params->margin_ppt, 1000), in vesagtf_mode_params()
479 /* 18. Find the ideal blanking duty cycle from the blanking duty cycle in vesagtf_mode_params()
482 * [IDEAL DUTY CYCLE] = [C'] - ([M']*[H PERIOD]/1000) in vesagtf_mode_params()
497 ((C_PRIME256(params) * 1000) - in vesagtf_mode_params()
503 /* 19. Find the number of pixels in the blanking time to the nearest in vesagtf_mode_params()
508 * (100-[IDEAL DUTY CYCLE]) / in vesagtf_mode_params()
516 (256000 * 100ULL) - ideal_duty_cycle), in vesagtf_mode_params()
581 h_sync = DIVIDE(((params->hsync_pct * total_pixels) / 100), CELL_GRAN) * in vesagtf_mode_params()
589 * [H FRONT PORCH (PIXELS)] = ([H BLANK (PIXELS)]/2)-[H SYNC (PIXELS)] in vesagtf_mode_params()
595 h_front_porch = (h_blank / 2) - h_sync; in vesagtf_mode_params()
602 * [V ODD FRONT PORCH(LINES)]=([MIN PORCH RND]+[INTERLACE]) in vesagtf_mode_params()
606 * [V ODD FRONT PORCH(LINES)]=(([MIN PORCH RND] * 2) + [2*INTERLACE]) / 2 in vesagtf_mode_params()
609 v_odd_front_porch_lines = ((2 * params->min_porch) + interlace) / 2; in vesagtf_mode_params()
611 print_value(36, "[V ODD FRONT PORCH(LINES)]", v_odd_front_porch_lines); in vesagtf_mode_params()
616 vmp->hsync_start = h_pixels + h_front_porch; in vesagtf_mode_params()
617 vmp->hsync_end = vmp->hsync_start + h_sync; in vesagtf_mode_params()
618 vmp->htotal = total_pixels; in vesagtf_mode_params()
619 vmp->hdisplay = h_pixels; in vesagtf_mode_params()
621 vmp->vsync_start = v_lines + v_odd_front_porch_lines; in vesagtf_mode_params()
622 vmp->vsync_end = vmp->vsync_start + params->vsync_rqd; in vesagtf_mode_params()
623 vmp->vtotal = total_v_lines; in vesagtf_mode_params()
624 vmp->vdisplay = v_lines; in vesagtf_mode_params()
626 vmp->dot_clock = pixel_freq; in vesagtf_mode_params()
655 /* print_xf86_mode() - print the XFree86 modeline, given mode timings. */
663 hf = 1000.0 * vmp->dot_clock / vmp->htotal; in print_xf86_mode()
664 vf = 1.0 * hf / vmp->vtotal; in print_xf86_mode()
668 vmp->hdisplay, vmp->vdisplay, vf, hf, vmp->dot_clock / 1000.0); in print_xf86_mode()
673 " -HSync +Vsync\n\n", in print_xf86_mode()
674 vmp->hdisplay, vmp->vdisplay, vf, (vmp->dot_clock / 1000.0), in print_xf86_mode()
675 vmp->hdisplay, vmp->hsync_start, vmp->hsync_end, vmp->htotal, in print_xf86_mode()
676 vmp->vdisplay, vmp->vsync_start, vmp->vsync_end, vmp->vtotal); in print_xf86_mode()