dptx: Update to use common video driver.

Signed-off-by: Andrei-Liviu Simion <andrei.simion@xilinx.com>
This commit is contained in:
Andrei-Liviu Simion 2015-01-22 23:02:31 -08:00 committed by Nava kishore Manne
parent 1a280fdfc7
commit 1d05464884
4 changed files with 32 additions and 28 deletions

View file

@ -287,7 +287,7 @@ static void Dptx_StartVideoStream(XDptx *InstancePtr)
* *
* 2) Use a standard video timing mode (see mode_table.h): * 2) Use a standard video timing mode (see mode_table.h):
* XDptx_CfgMsaUseStandardVideoMode(InstancePtr, XDPTX_STREAM_ID0, * XDptx_CfgMsaUseStandardVideoMode(InstancePtr, XDPTX_STREAM_ID0,
XDPTX_VM_640x480_60_P); XVIDC_VM_640x480_60_P);
* *
* 3) Use a custom configuration for the main stream attributes (MSA): * 3) Use a custom configuration for the main stream attributes (MSA):
* XDptx_MainStreamAttributes MsaConfigCustom; * XDptx_MainStreamAttributes MsaConfigCustom;
@ -317,7 +317,7 @@ static void Dptx_StartVideoStream(XDptx *InstancePtr)
} }
else { else {
XDptx_CfgMsaUseStandardVideoMode(InstancePtr, XDPTX_STREAM_ID0, XDptx_CfgMsaUseStandardVideoMode(InstancePtr, XDPTX_STREAM_ID0,
XDPTX_VM_640x480_60_P); XVIDC_VM_640x480_60_P);
} }
/* Disable MST for this example. */ /* Disable MST for this example. */

View file

@ -85,7 +85,7 @@
/* The video resolution from the display mode timings (DMT) table to use for /* The video resolution from the display mode timings (DMT) table to use for
* each stream. */ * each stream. */
#define USE_VIDEO_MODE XDPTX_VM_1920x1080_60_P #define USE_VIDEO_MODE XVIDC_VM_1920x1080_60_P
/* The color depth (bits per color component) to use for each stream. */ /* The color depth (bits per color component) to use for each stream. */
#define USE_BPC 8 #define USE_BPC 8

View file

@ -229,7 +229,7 @@
#include "xdptx_hw.h" #include "xdptx_hw.h"
#include "xil_assert.h" #include "xil_assert.h"
#include "xil_types.h" #include "xil_types.h"
#include "xvid.h" #include "xvidc.h"
/****************************** Type Definitions ******************************/ /****************************** Type Definitions ******************************/
@ -323,7 +323,9 @@ typedef struct {
* video will be displayed. * video will be displayed.
*/ */
typedef struct { typedef struct {
XVid_VideoTimingMode Vtm; /**< The video timing. */ XVidC_VideoTimingMode Vtm; /**< The video timing. */
u32 PixelClkHz; /**< The pixel clock of the stream (in
Hz). */
u32 HClkTotal; /**< Horizontal total time (in u32 HClkTotal; /**< Horizontal total time (in
pixels). */ pixels). */
u32 VClkTotal; /**< Vertical total time (in pixels). */ u32 VClkTotal; /**< Vertical total time (in pixels). */
@ -664,7 +666,7 @@ void XDptx_SetUserTimerHandler(XDptx *InstancePtr,
/* xdptx_spm.c: Stream policy maker functions. */ /* xdptx_spm.c: Stream policy maker functions. */
void XDptx_CfgMsaRecalculate(XDptx *InstancePtr, u8 Stream); void XDptx_CfgMsaRecalculate(XDptx *InstancePtr, u8 Stream);
void XDptx_CfgMsaUseStandardVideoMode(XDptx *InstancePtr, u8 Stream, void XDptx_CfgMsaUseStandardVideoMode(XDptx *InstancePtr, u8 Stream,
XVid_VideoMode VideoMode); XVidC_VideoMode VideoMode);
void XDptx_CfgMsaUseEdidPreferredTiming(XDptx *InstancePtr, u8 Stream, void XDptx_CfgMsaUseEdidPreferredTiming(XDptx *InstancePtr, u8 Stream,
u8 *Edid); u8 *Edid);
void XDptx_CfgMsaUseCustom(XDptx *InstancePtr, u8 Stream, void XDptx_CfgMsaUseCustom(XDptx *InstancePtr, u8 Stream,

View file

@ -144,11 +144,11 @@ void XDptx_CfgMsaRecalculate(XDptx *InstancePtr, u8 Stream)
/* Set the user pixel width to handle clocks that exceed the /* Set the user pixel width to handle clocks that exceed the
* capabilities of the DisplayPort TX core. */ * capabilities of the DisplayPort TX core. */
if (MsaConfig->OverrideUserPixelWidth == 0) { if (MsaConfig->OverrideUserPixelWidth == 0) {
if ((MsaConfig->Vtm.PixelClkKhz > 300000) && if ((MsaConfig->PixelClkHz > 300000000) &&
(LinkConfig->LaneCount == XDPTX_LANE_COUNT_SET_4)) { (LinkConfig->LaneCount == XDPTX_LANE_COUNT_SET_4)) {
MsaConfig->UserPixelWidth = 4; MsaConfig->UserPixelWidth = 4;
} }
else if ((MsaConfig->Vtm.PixelClkKhz > 75000) && else if ((MsaConfig->PixelClkHz > 75000000) &&
(LinkConfig->LaneCount != XDPTX_LANE_COUNT_SET_1)) { (LinkConfig->LaneCount != XDPTX_LANE_COUNT_SET_1)) {
MsaConfig->UserPixelWidth = 2; MsaConfig->UserPixelWidth = 2;
} }
@ -238,7 +238,7 @@ void XDptx_CfgMsaRecalculate(XDptx *InstancePtr, u8 Stream)
/* Calculate the average number of bytes per transfer unit. /* Calculate the average number of bytes per transfer unit.
* Note: Both the integer and the fractional part is stored in * Note: Both the integer and the fractional part is stored in
* AvgBytesPerTU. */ * AvgBytesPerTU. */
VideoBw = (MsaConfig->Vtm.PixelClkKhz * BitsPerPixel) / 8; VideoBw = (MsaConfig->PixelClkHz * BitsPerPixel) / 8000;
LinkBw = (LinkConfig->LaneCount * LinkConfig->LinkRate * 27); LinkBw = (LinkConfig->LaneCount * LinkConfig->LinkRate * 27);
MsaConfig->AvgBytesPerTU = (VideoBw * MsaConfig->AvgBytesPerTU = (VideoBw *
MsaConfig->TransferUnitSize) / LinkBw; MsaConfig->TransferUnitSize) / LinkBw;
@ -276,13 +276,13 @@ void XDptx_CfgMsaRecalculate(XDptx *InstancePtr, u8 Stream)
* *
*******************************************************************************/ *******************************************************************************/
void XDptx_CfgMsaUseStandardVideoMode(XDptx *InstancePtr, u8 Stream, void XDptx_CfgMsaUseStandardVideoMode(XDptx *InstancePtr, u8 Stream,
XVid_VideoMode VideoMode) XVidC_VideoMode VideoMode)
{ {
XDptx_MainStreamAttributes *MsaConfig; XDptx_MainStreamAttributes *MsaConfig;
/* Verify arguments. */ /* Verify arguments. */
Xil_AssertVoid(InstancePtr != NULL); Xil_AssertVoid(InstancePtr != NULL);
Xil_AssertVoid(VideoMode < XVID_VM_NUM_SUPPORT); Xil_AssertVoid(VideoMode < XVIDC_VM_NUM_SUPPORTED);
Xil_AssertVoid((Stream == XDPTX_STREAM_ID1) || Xil_AssertVoid((Stream == XDPTX_STREAM_ID1) ||
(Stream == XDPTX_STREAM_ID2) || (Stream == XDPTX_STREAM_ID3) || (Stream == XDPTX_STREAM_ID2) || (Stream == XDPTX_STREAM_ID3) ||
(Stream == XDPTX_STREAM_ID4)); (Stream == XDPTX_STREAM_ID4));
@ -290,28 +290,30 @@ void XDptx_CfgMsaUseStandardVideoMode(XDptx *InstancePtr, u8 Stream,
MsaConfig = &InstancePtr->MsaConfig[Stream - 1]; MsaConfig = &InstancePtr->MsaConfig[Stream - 1];
/* Configure the MSA values from the display monitor DMT table. */ /* Configure the MSA values from the display monitor DMT table. */
MsaConfig->Vtm.PixelClkKhz =
XVid_VideoTimingModes[VideoMode].PixelClkKhz;
MsaConfig->Vtm.Timing.HActive = MsaConfig->Vtm.Timing.HActive =
XVid_VideoTimingModes[VideoMode].Timing.HActive; XVidC_VideoTimingModes[VideoMode].Timing.HActive;
MsaConfig->Vtm.Timing.VActive = MsaConfig->Vtm.Timing.VActive =
XVid_VideoTimingModes[VideoMode].Timing.VActive; XVidC_VideoTimingModes[VideoMode].Timing.VActive;
MsaConfig->Vtm.Timing.HSyncPolarity = MsaConfig->Vtm.Timing.HSyncPolarity =
XVid_VideoTimingModes[VideoMode].Timing.HSyncPolarity; XVidC_VideoTimingModes[VideoMode].Timing.HSyncPolarity;
MsaConfig->Vtm.Timing.VSyncPolarity = MsaConfig->Vtm.Timing.VSyncPolarity =
XVid_VideoTimingModes[VideoMode].Timing.VSyncPolarity; XVidC_VideoTimingModes[VideoMode].Timing.VSyncPolarity;
MsaConfig->Vtm.Timing.HFrontPorch = MsaConfig->Vtm.Timing.HFrontPorch =
XVid_VideoTimingModes[VideoMode].Timing.HFrontPorch; XVidC_VideoTimingModes[VideoMode].Timing.HFrontPorch;
MsaConfig->Vtm.Timing.HSyncWidth = MsaConfig->Vtm.Timing.HSyncWidth =
XVid_VideoTimingModes[VideoMode].Timing.HSyncWidth; XVidC_VideoTimingModes[VideoMode].Timing.HSyncWidth;
MsaConfig->Vtm.Timing.HBackPorch = MsaConfig->Vtm.Timing.HBackPorch =
XVid_VideoTimingModes[VideoMode].Timing.HBackPorch; XVidC_VideoTimingModes[VideoMode].Timing.HBackPorch;
MsaConfig->Vtm.Timing.F0PVFrontPorch = MsaConfig->Vtm.Timing.F0PVFrontPorch =
XVid_VideoTimingModes[VideoMode].Timing.F0PVFrontPorch; XVidC_VideoTimingModes[VideoMode].Timing.F0PVFrontPorch;
MsaConfig->Vtm.Timing.F0PVSyncWidth = MsaConfig->Vtm.Timing.F0PVSyncWidth =
XVid_VideoTimingModes[VideoMode].Timing.F0PVSyncWidth; XVidC_VideoTimingModes[VideoMode].Timing.F0PVSyncWidth;
MsaConfig->Vtm.Timing.F0PVBackPorch = MsaConfig->Vtm.Timing.F0PVBackPorch =
XVid_VideoTimingModes[VideoMode].Timing.F0PVBackPorch; XVidC_VideoTimingModes[VideoMode].Timing.F0PVBackPorch;
/* Calculate the pixel clock frequency. */
MsaConfig->PixelClkHz =
XVidC_GetPixelClockHzByVmId(MsaConfig->Vtm.VmId);
/* Calculate the rest of the MSA values. */ /* Calculate the rest of the MSA values. */
XDptx_CfgMsaRecalculate(InstancePtr, Stream); XDptx_CfgMsaRecalculate(InstancePtr, Stream);
@ -376,8 +378,8 @@ void XDptx_CfgMsaUseEdidPreferredTiming(XDptx *InstancePtr, u8 Stream, u8 *Edid)
XDPTX_EDID_DTD_XRES_XBLANK_U4_XRES_SHIFT) << 8) | XDPTX_EDID_DTD_XRES_XBLANK_U4_XRES_SHIFT) << 8) |
Ptm[XDPTX_EDID_DTD_VRES_LSB]; Ptm[XDPTX_EDID_DTD_VRES_LSB];
MsaConfig->Vtm.PixelClkKhz = ((Ptm[XDPTX_EDID_DTD_PIXEL_CLK_KHZ_MSB] << MsaConfig->PixelClkHz = ((Ptm[XDPTX_EDID_DTD_PIXEL_CLK_KHZ_MSB] <<
8) | Ptm[XDPTX_EDID_DTD_PIXEL_CLK_KHZ_LSB]) * 10; 8) | Ptm[XDPTX_EDID_DTD_PIXEL_CLK_KHZ_LSB]) * 10000;
MsaConfig->Vtm.Timing.HFrontPorch = MsaConfig->Vtm.Timing.HFrontPorch =
(((Ptm[XDPTX_EDID_DTD_XFPORCH_XSPW_U2] & (((Ptm[XDPTX_EDID_DTD_XFPORCH_XSPW_U2] &
@ -469,7 +471,7 @@ void XDptx_CfgMsaUseCustom(XDptx *InstancePtr, u8 Stream,
MsaConfigCustom->Vtm.Timing.HActive; MsaConfigCustom->Vtm.Timing.HActive;
MsaConfig->Vtm.Timing.VActive = MsaConfig->Vtm.Timing.VActive =
MsaConfigCustom->Vtm.Timing.VActive; MsaConfigCustom->Vtm.Timing.VActive;
MsaConfig->Vtm.PixelClkKhz = MsaConfigCustom->Vtm.PixelClkKhz; MsaConfig->PixelClkHz = MsaConfigCustom->PixelClkHz;
MsaConfig->Vtm.Timing.HSyncPolarity = MsaConfig->Vtm.Timing.HSyncPolarity =
MsaConfigCustom->Vtm.Timing.HSyncPolarity; MsaConfigCustom->Vtm.Timing.HSyncPolarity;
MsaConfig->Vtm.Timing.VSyncPolarity = MsaConfig->Vtm.Timing.VSyncPolarity =
@ -738,7 +740,7 @@ void XDptx_SetMsaValues(XDptx *InstancePtr, u8 Stream)
XDptx_WriteReg(Config->BaseAddr, XDPTX_MAIN_STREAM_MISC1 + XDptx_WriteReg(Config->BaseAddr, XDPTX_MAIN_STREAM_MISC1 +
StreamOffset[Stream - 1], MsaConfig->Misc1); StreamOffset[Stream - 1], MsaConfig->Misc1);
XDptx_WriteReg(Config->BaseAddr, XDPTX_M_VID + XDptx_WriteReg(Config->BaseAddr, XDPTX_M_VID +
StreamOffset[Stream - 1], MsaConfig->Vtm.PixelClkKhz); StreamOffset[Stream - 1], MsaConfig->PixelClkHz / 1000);
XDptx_WriteReg(Config->BaseAddr, XDPTX_N_VID + XDptx_WriteReg(Config->BaseAddr, XDPTX_N_VID +
StreamOffset[Stream - 1], MsaConfig->NVid); StreamOffset[Stream - 1], MsaConfig->NVid);
XDptx_WriteReg(Config->BaseAddr, XDPTX_USER_PIXEL_WIDTH + XDptx_WriteReg(Config->BaseAddr, XDPTX_USER_PIXEL_WIDTH +
@ -795,7 +797,7 @@ static void XDptx_CalculateTs(XDptx *InstancePtr, u8 Stream, u8 BitsPerPixel)
u32 TsInt; u32 TsInt;
u32 TsFrac; u32 TsFrac;
PeakPixelBw = ((double)MsaConfig->Vtm.PixelClkKhz / 1000) * PeakPixelBw = ((double)MsaConfig->PixelClkHz) *
((double)BitsPerPixel / 8); ((double)BitsPerPixel / 8);
LinkBw = (LinkConfig->LaneCount * LinkConfig->LinkRate * 27); LinkBw = (LinkConfig->LaneCount * LinkConfig->LinkRate * 27);