@@ -109,6 +109,7 @@ struct vidcap_deltacast_dvi_state {
109109#define VHD_DV_MODE_DVI_D VHD_DVI_MODE_DVI_D
110110#define VHD_DV_MODE_DVI_A VHD_DVI_MODE_DVI_A
111111#define VHD_DV_MODE_HDMI VHD_DVI_MODE_HDMI
112+ #define VHD_DV_MODE_DISPLAYPORT NB_VHD_DV_MODES
112113#define VHD_DV_SP_MODE VHD_DVI_SP_MODE
113114#define VHD_DV_SP_DISABLE_EDID_AUTO_LOAD VHD_DVI_SP_DISABLE_EDID_AUTO_LOAD
114115#define VHD_DV_DVI_A_STANDARD VHD_DVI_A_STANDARD
@@ -335,56 +336,9 @@ static bool wait_for_channel_locked(struct vidcap_deltacast_dvi_state *s, bool h
335336 return false ;
336337 }
337338 }
338- else if (DviMode == VHD_DV_MODE_DVI_D)
339+ else
339340 {
340341 int Dual_B = FALSE ;
341- /* Get auto-detected resolution */
342- Result = VHD_GetStreamProperty (s->StreamHandle ,VHD_DV_SP_ACTIVE_WIDTH,&Width);
343- if (Result == VHDERR_NOERROR)
344- Result = VHD_GetStreamProperty (s->StreamHandle ,VHD_DV_SP_ACTIVE_HEIGHT,&Height);
345- else
346- printf (" ERROR : Cannot detect incoming active width from RX0. "
347- " Result = 0x%08" PRIX_ULONG " \n " , Result);
348- if (Result == VHDERR_NOERROR)
349- Result = VHD_GetStreamProperty (s->StreamHandle ,VHD_DV_SP_INTERLACED,(ULONG*)&Interlaced_B);
350- else
351- printf (" ERROR : Cannot detect incoming active height from RX0. "
352- " Result = 0x%08" PRIX_ULONG " \n " , Result);
353- if (Result == VHDERR_NOERROR)
354- Result = VHD_GetStreamProperty (s->StreamHandle ,VHD_DV_SP_REFRESH_RATE,&RefreshRate);
355- else
356- printf (" ERROR : Cannot detect if incoming stream from RX0 is "
357- " interlaced or progressive. Result = 0x%08" PRIX_ULONG " \n " , Result);
358- if (Result == VHDERR_NOERROR)
359- Result = VHD_GetStreamProperty (s->StreamHandle ,VHD_DV_SP_DUAL_LINK,(ULONG*)&Dual_B);
360- else
361- printf (" ERROR : Cannot detect incoming refresh rate from RX0. "
362- " Result = 0x%08" PRIX_ULONG " \n " , Result);
363-
364- if (Result == VHDERR_NOERROR)
365- 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" );
366- else
367- printf (" ERROR : Cannot detect if incoming stream from RX0 is dual or simple link. Result = 0x%08" PRIX_ULONG " \n " , Result);
368-
369- if (Result != VHDERR_NOERROR) {
370- return false ;
371- }
372-
373- /* Configure stream. Only VHD_DVI_SP_ACTIVE_WIDTH, VHD_DVI_SP_ACTIVE_HEIGHT and
374- VHD_DVI_SP_INTERLACED properties are required for DVI-D.
375- VHD_DVI_SP_REFRESH_RATE,VHD_DVI_SP_DUAL_LINK are optional
376- VHD_DVI_SP_PIXEL_CLOCK, VHD_DVI_SP_TOTAL_WIDTH, VHD_DVI_SP_TOTAL_HEIGHT,
377- VHD_DVI_SP_H_SYNC, VHD_DVI_SP_H_FRONT_PORCH, VHD_DVI_SP_V_SYNC and
378- VHD_DVI_SP_V_FRONT_PORCH properties are not applicable for DVI-D */
379-
380- VHD_SetStreamProperty (s->StreamHandle ,VHD_DV_SP_ACTIVE_WIDTH,Width);
381- VHD_SetStreamProperty (s->StreamHandle ,VHD_DV_SP_ACTIVE_HEIGHT,Height);
382- VHD_SetStreamProperty (s->StreamHandle ,VHD_DV_SP_INTERLACED,Interlaced_B);
383- VHD_SetStreamProperty (s->StreamHandle ,VHD_DV_SP_REFRESH_RATE,RefreshRate);
384- VHD_SetStreamProperty (s->StreamHandle ,VHD_DV_SP_DUAL_LINK,Dual_B);
385- }
386- else if (DviMode == VHD_DV_MODE_HDMI || DviMode == VHD_DV_MODE_ANALOG_COMPONENT_VIDEO)
387- {
388342 VHD_DV_CS InputCS;
389343 ULONG PxlClk = 0 ;
390344 /* Get auto-detected resolution */
@@ -408,7 +362,7 @@ static bool wait_for_channel_locked(struct vidcap_deltacast_dvi_state *s, bool h
408362 return false ;
409363 }
410364
411- if (s-> BoardType == VHD_BOARDTYPE_HDMI ) {
365+ if (DviMode == VHD_DV_MODE_HDMI || DviMode == VHD_DV_MODE_DISPLAYPORT ) {
412366 if ((Result = VHD_GetStreamProperty (s->StreamHandle ,VHD_DV_SP_INPUT_CS,(ULONG*)&InputCS)) != VHDERR_NOERROR) {
413367 printf (" ERROR : Cannot detect incoming color space from RX0. Result = 0x%08" PRIX_ULONG " (%s)\n " , Result,
414368 delta_get_error_description (Result));
@@ -417,11 +371,17 @@ static bool wait_for_channel_locked(struct vidcap_deltacast_dvi_state *s, bool h
417371 if ((Result = VHD_GetStreamProperty (s->StreamHandle ,VHD_DV_SP_PIXEL_CLOCK,&PxlClk)) != VHDERR_NOERROR) {
418372 printf (" ERROR : Cannot detect incoming pixel clock from RX0. Result = 0x%08" PRIX_ULONG " (%s)\n " , Result,
419373 delta_get_error_description (Result));
420- return false
374+ return false ;
375+ }
376+ }
377+ if (DviMode == VHD_DV_MODE_DVI_D) {
378+ if ((Result = VHD_GetStreamProperty (s->StreamHandle ,VHD_DV_SP_DUAL_LINK,(ULONG*)&Dual_B)) != VHDERR_NOERROR) {
379+ printf (" ERROR : Cannot detect if incoming stream from RX0 is dual or simple link. Result = 0x%08" PRIX_ULONG " \n " , Result);
380+ return false ;
421381 }
422382 }
423383
424- printf (" \n Incoming graphic resolution : %" PRIu_ULONG " x%" PRIu_ULONG " @%" PRIu_ULONG " Hz (%s)\n " , Width, Height, RefreshRate, Interlaced_B ? " Interlaced" : " Progressive" );
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 " );
425385
426386 /* Configure stream. Only VHD_DVI_SP_ACTIVE_WIDTH, VHD_DVI_SP_ACTIVE_HEIGHT and
427387 VHD_DVI_SP_INTERLACED properties are required for HDMI and Component
@@ -433,10 +393,13 @@ static bool wait_for_channel_locked(struct vidcap_deltacast_dvi_state *s, bool h
433393 VHD_SetStreamProperty (s->StreamHandle ,VHD_DV_SP_ACTIVE_HEIGHT,Height);
434394 VHD_SetStreamProperty (s->StreamHandle ,VHD_DV_SP_INTERLACED,Interlaced_B);
435395 VHD_SetStreamProperty (s->StreamHandle ,VHD_DV_SP_REFRESH_RATE, RefreshRate);
436- if (s-> BoardType == VHD_BOARDTYPE_HDMI ) {
396+ if (DviMode == VHD_DV_MODE_HDMI || DviMode == VHD_DV_MODE_DISPLAYPORT ) {
437397 VHD_SetStreamProperty (s->StreamHandle ,VHD_DV_SP_INPUT_CS, InputCS);
438398 VHD_SetStreamProperty (s->StreamHandle ,VHD_DV_SP_PIXEL_CLOCK, PxlClk);
439399 }
400+ if (DviMode == VHD_DV_MODE_DVI_D) {
401+ VHD_SetStreamProperty (s->StreamHandle ,VHD_DV_SP_DUAL_LINK,Dual_B);
402+ }
440403 }
441404
442405 Result = VHD_StartStream (s->StreamHandle );
0 commit comments