dptx: Optimized some video calculations.
Signed-off-by: Andrei-Liviu Simion <andrei.simion@xilinx.com>
This commit is contained in:
parent
a22e5d1367
commit
1ae5c266b8
1 changed files with 19 additions and 19 deletions
|
@ -105,6 +105,8 @@ static void XDptx_CalculateTs(XDptx *InstancePtr, u8 Stream, u8 BitsPerPixel);
|
||||||
void XDptx_CfgMsaRecalculate(XDptx *InstancePtr, u8 Stream)
|
void XDptx_CfgMsaRecalculate(XDptx *InstancePtr, u8 Stream)
|
||||||
{
|
{
|
||||||
u32 VideoBw;
|
u32 VideoBw;
|
||||||
|
u32 LinkBw;
|
||||||
|
u32 WordsPerLine;
|
||||||
u8 BitsPerPixel;
|
u8 BitsPerPixel;
|
||||||
XDptx_MainStreamAttributes *MsaConfig;
|
XDptx_MainStreamAttributes *MsaConfig;
|
||||||
XDptx_LinkConfig *LinkConfig;
|
XDptx_LinkConfig *LinkConfig;
|
||||||
|
@ -207,11 +209,19 @@ void XDptx_CfgMsaRecalculate(XDptx *InstancePtr, u8 Stream)
|
||||||
BitsPerPixel = MsaConfig->BitsPerColor * 3;
|
BitsPerPixel = MsaConfig->BitsPerColor * 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Calculate the data per lane. */
|
||||||
|
WordsPerLine = (MsaConfig->Vtm.Timing.HActive * BitsPerPixel);
|
||||||
|
if ((WordsPerLine % 16) != 0) {
|
||||||
|
WordsPerLine += 16;
|
||||||
|
}
|
||||||
|
WordsPerLine /= 16;
|
||||||
|
|
||||||
|
MsaConfig->DataPerLane = WordsPerLine - LinkConfig->LaneCount;
|
||||||
|
if ((WordsPerLine % LinkConfig->LaneCount) != 0) {
|
||||||
|
MsaConfig->DataPerLane += (WordsPerLine % LinkConfig->LaneCount);
|
||||||
|
}
|
||||||
|
|
||||||
if (InstancePtr->MstEnable == 1) {
|
if (InstancePtr->MstEnable == 1) {
|
||||||
MsaConfig->DataPerLane = (MsaConfig->Vtm.Timing.HActive *
|
|
||||||
MsaConfig->BitsPerColor * 3 / 16) - 4;
|
|
||||||
|
|
||||||
/* Do time slot (and payload bandwidth number) calculations for
|
/* Do time slot (and payload bandwidth number) calculations for
|
||||||
* MST. */
|
* MST. */
|
||||||
XDptx_CalculateTs(InstancePtr, Stream, BitsPerPixel);
|
XDptx_CalculateTs(InstancePtr, Stream, BitsPerPixel);
|
||||||
|
@ -219,10 +229,6 @@ void XDptx_CfgMsaRecalculate(XDptx *InstancePtr, u8 Stream)
|
||||||
MsaConfig->InitWait = 0;
|
MsaConfig->InitWait = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MsaConfig->DataPerLane = (MsaConfig->Vtm.Timing.HActive *
|
|
||||||
MsaConfig->BitsPerColor * 3 / 16) -
|
|
||||||
LinkConfig->LaneCount;
|
|
||||||
|
|
||||||
/* Allocate a fixed size for single-stream transport (SST)
|
/* Allocate a fixed size for single-stream transport (SST)
|
||||||
* operation. */
|
* operation. */
|
||||||
MsaConfig->TransferUnitSize = 64;
|
MsaConfig->TransferUnitSize = 64;
|
||||||
|
@ -231,25 +237,19 @@ void XDptx_CfgMsaRecalculate(XDptx *InstancePtr, u8 Stream)
|
||||||
* 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->Vtm.PixelClkKhz * BitsPerPixel) / 8;
|
||||||
|
LinkBw = (LinkConfig->LaneCount * LinkConfig->LinkRate * 27);
|
||||||
MsaConfig->AvgBytesPerTU = (VideoBw *
|
MsaConfig->AvgBytesPerTU = (VideoBw *
|
||||||
MsaConfig->TransferUnitSize) /
|
MsaConfig->TransferUnitSize) / LinkBw;
|
||||||
(LinkConfig->LaneCount *
|
|
||||||
(MsaConfig->NVid / 1000));
|
|
||||||
|
|
||||||
/* The number of initial wait cycles at the start of a new line
|
/* The number of initial wait cycles at the start of a new line
|
||||||
* by the framing logic. This allows enough data to be buffered
|
* by the framing logic. This allows enough data to be buffered
|
||||||
* in the input FIFO before video is sent. */
|
* in the input FIFO before video is sent. */
|
||||||
MsaConfig->InitWait = (MsaConfig->TransferUnitSize -
|
if ((MsaConfig->AvgBytesPerTU / 1000) <= 4) {
|
||||||
(MsaConfig->AvgBytesPerTU / 1000));
|
MsaConfig->InitWait = 64;
|
||||||
if ((MsaConfig->AvgBytesPerTU / 1000) >
|
|
||||||
MsaConfig->TransferUnitSize) {
|
|
||||||
MsaConfig->InitWait = 0;
|
|
||||||
}
|
|
||||||
else if (MsaConfig->InitWait > 10) {
|
|
||||||
MsaConfig->InitWait -= 10;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MsaConfig->InitWait = 0;
|
MsaConfig->InitWait = MsaConfig->TransferUnitSize -
|
||||||
|
(MsaConfig->AvgBytesPerTU / 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue