33 * @author Martin Piatka <[email protected] > 44 * @author Martin Pulec <[email protected] > 55 *
6- * code is written by DELTACAST's VideoMaster SDK example Sample_RX_DVI
6+ * Code is written by DELTACAST's VideoMaster SDK example Sample_RX_DVI
7+ * (later SAMPLE_RX_DVI_D). Consulted also VHD 6.32 Sample_RX_DisplayPort
8+ * sample.
79 *
810 * @sa deltacast_common.hpp for common DELTACAST information
911 */
@@ -127,6 +129,20 @@ struct vidcap_deltacast_dvi_state {
127129#define VHD_DV_BT_VIDEO VHD_DVI_BT_VIDEO
128130#define NB_VHD_DV_EEDID_PRESET NB_VHD_EEDID
129131#define NB_VHD_DV_MODES NB_VHD_DVI_MODES
132+ #define NB_VHD_DV_STREAMPROPERTIES NB_VHD_DVI_STREAMPROPERTIES
133+ #endif
134+
135+ #if !defined VHD_MIN_6_19
136+ #define VHD_DV_SAMPLING ULONG
137+ #endif
138+
139+ #if !defined VHD_MIN_6_30
140+ #define VHD_DV_SP_CABLE_BIT_SAMPLING NB_VHD_DV_STREAMPROPERTIES
141+ #endif
142+
143+ #if !defined HAVE_VHD_STRING
144+ #define VHD_DV_SAMPLING_ToString (x ) " UNKNOWN"
145+ #define VHD_DV_CS_ToString (x ) " UNKNOWN"
130146#endif
131147
132148#if defined VHD_MIN_6_14
@@ -282,6 +298,9 @@ static bool wait_for_channel_locked(struct vidcap_deltacast_dvi_state *s, bool h
282298 }
283299
284300 printf (" \n Incoming Dvi mode detected: " );
301+ #ifdef HAVE_VHD_STRING
302+ puts (VHD_DV_MODE_ToPrettyString (DviMode));
303+ #else
285304 switch (DviMode)
286305 {
287306 case VHD_DV_MODE_DVI_D : printf (" DVI-D\n " );break ;
@@ -290,6 +309,7 @@ static bool wait_for_channel_locked(struct vidcap_deltacast_dvi_state *s, bool h
290309 case VHD_DV_MODE_HDMI : printf (" HDMI\n " );break ;
291310 default : break ;
292311 }
312+ #endif
293313
294314 /* Disable EDID auto load */
295315 Result = VHD_SetStreamProperty (s->StreamHandle ,VHD_DV_SP_DISABLE_EDID_AUTO_LOAD,TRUE );
@@ -341,6 +361,8 @@ static bool wait_for_channel_locked(struct vidcap_deltacast_dvi_state *s, bool h
341361 int Dual_B = FALSE ;
342362 VHD_DV_CS InputCS;
343363 ULONG PxlClk = 0 ;
364+ VHD_DV_SAMPLING CableBitSampling;
365+
344366 /* Get auto-detected resolution */
345367 if ((Result = VHD_GetStreamProperty (s->StreamHandle ,VHD_DV_SP_ACTIVE_WIDTH,&Width)) != VHDERR_NOERROR) {
346368 printf (" ERROR : Cannot detect incoming active width from RX0. "
@@ -381,7 +403,15 @@ static bool wait_for_channel_locked(struct vidcap_deltacast_dvi_state *s, bool h
381403 }
382404 }
383405
384- printf (" \n Incoming graphic resolution : %" PRIu_ULONG " x%" PRIu_ULONG " @%" PRIu_ULONG " Hz (%s) %s link\n " , Width, Height, RefreshRate, Interlaced_B ? " Interlaced" : " Progressive" , Dual_B ? " Dual" : " Single" );
406+ if (DviMode == VHD_DV_MODE_DISPLAYPORT) {
407+ if ((Result = VHD_GetStreamProperty (s->StreamHandle ,VHD_DV_SP_CABLE_BIT_SAMPLING,(ULONG*)&CableBitSampling)) != VHDERR_NOERROR) {
408+ DELTA_PRINT_ERROR (Result, " ERROR : Cannot detect incoming cable bit sampling from RX0." );
409+ return false ;
410+ }
411+ }
412+
413+ printf (" Incoming graphic resolution : %ux%u (%s)\n " , Width, Height, Interlaced_B ? " Interlaced" : " Progressive" );
414+ printf (" Refresh rate : %u\n " , RefreshRate);
385415
386416 /* Configure stream. Only VHD_DVI_SP_ACTIVE_WIDTH, VHD_DVI_SP_ACTIVE_HEIGHT and
387417 VHD_DVI_SP_INTERLACED properties are required for HDMI and Component
@@ -393,13 +423,21 @@ static bool wait_for_channel_locked(struct vidcap_deltacast_dvi_state *s, bool h
393423 VHD_SetStreamProperty (s->StreamHandle ,VHD_DV_SP_ACTIVE_HEIGHT,Height);
394424 VHD_SetStreamProperty (s->StreamHandle ,VHD_DV_SP_INTERLACED,Interlaced_B);
395425 VHD_SetStreamProperty (s->StreamHandle ,VHD_DV_SP_REFRESH_RATE, RefreshRate);
426+ if (DviMode == VHD_DV_MODE_DVI_D) {
427+ VHD_SetStreamProperty (s->StreamHandle ,VHD_DV_SP_DUAL_LINK,Dual_B);
428+ printf (" %s link\n " , Dual_B ? " Dual" : " Single" );
429+ }
396430 if (DviMode == VHD_DV_MODE_HDMI || DviMode == VHD_DV_MODE_DISPLAYPORT) {
397431 VHD_SetStreamProperty (s->StreamHandle ,VHD_DV_SP_INPUT_CS, InputCS);
398432 VHD_SetStreamProperty (s->StreamHandle ,VHD_DV_SP_PIXEL_CLOCK, PxlClk);
433+ printf (" Input CS : %s\n " , VHD_DV_CS_ToString (InputCS));
434+ printf (" Pixel clock : %u\n " , PxlClk);
399435 }
400- if (DviMode == VHD_DV_MODE_DVI_D) {
401- VHD_SetStreamProperty (s->StreamHandle ,VHD_DV_SP_DUAL_LINK,Dual_B);
436+ if (DviMode == VHD_DV_MODE_DISPLAYPORT) {
437+ VHD_SetStreamProperty (s->StreamHandle , VHD_DV_SP_CABLE_BIT_SAMPLING, CableBitSampling);
438+ printf (" Cable bit sampling: %s\n " , VHD_DV_SAMPLING_ToString (CableBitSampling));
402439 }
440+
403441 }
404442
405443 Result = VHD_StartStream (s->StreamHandle );
@@ -574,8 +612,11 @@ vidcap_deltacast_dvi_init(struct vidcap_params *params, void **state)
574612 goto error;
575613 }
576614 VHD_GetBoardProperty (s->BoardHandle , VHD_CORE_BP_BOARD_TYPE, &s->BoardType );
577- if (s->BoardType != VHD_BOARDTYPE_DVI && s->BoardType != VHD_BOARDTYPE_HDMI) {
578- log_msg (LOG_LEVEL_ERROR, " [DELTACAST] ERROR : The selected board is not an DVI or HDMI one\n " );
615+ if (not delta_board_type_is_dv ((VHD_BOARDTYPE) s->BoardType , true )) {
616+ MSG (ERROR,
617+ " ERROR : The selected board is not a DVI, HDMI or DP "
618+ " (flex) one, have: %s\n " ,
619+ delta_get_board_type_name (s->BoardType ));
579620 goto bad_channel;
580621 }
581622
@@ -584,8 +625,10 @@ vidcap_deltacast_dvi_init(struct vidcap_params *params, void **state)
584625 goto no_stream;
585626 }
586627 Result = VHD_OpenStreamHandle (s->BoardHandle , ChannelId,
587- s->BoardType == VHD_BOARDTYPE_HDMI ? VHD_DV_STPROC_JOINED : VHD_DV_STPROC_DEFAULT,
588- NULL , &s->StreamHandle , NULL );
628+ s->BoardType == VHD_BOARDTYPE_DVI
629+ ? VHD_DV_STPROC_DEFAULT
630+ : VHD_DV_STPROC_JOINED,
631+ nullptr , &s->StreamHandle , nullptr );
589632 if (Result != VHDERR_NOERROR)
590633 {
591634 log_msg (LOG_LEVEL_ERROR, " ERROR : Cannot open RX0 stream on DELTA-DVI board handle. "
0 commit comments