Commit 1336926f authored by Alvin lee's avatar Alvin lee Committed by Alex Deucher

drm/amd/display: Enable Stereo in Dal3

- program infoframe for Stereo
- program stereo flip control registers properly

v2: Add missing license headers
Signed-off-by: default avatarAlvin lee <alvin.lee3@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarHarry Wentland <harry.wentland@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 27e2e207
...@@ -31,11 +31,12 @@ subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/inc/hw ...@@ -31,11 +31,12 @@ subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/inc/hw
subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/inc subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/inc
subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/freesync subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/freesync
subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/color subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/color
subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/info_packet
#TODO: remove when Timing Sync feature is complete #TODO: remove when Timing Sync feature is complete
subdir-ccflags-y += -DBUILD_FEATURE_TIMING_SYNC=0 subdir-ccflags-y += -DBUILD_FEATURE_TIMING_SYNC=0
DAL_LIBS = amdgpu_dm dc modules/freesync modules/color DAL_LIBS = amdgpu_dm dc modules/freesync modules/color modules/info_packet
AMD_DAL = $(addsuffix /Makefile, $(addprefix $(FULL_AMD_DISPLAY_PATH)/,$(DAL_LIBS))) AMD_DAL = $(addsuffix /Makefile, $(addprefix $(FULL_AMD_DISPLAY_PATH)/,$(DAL_LIBS)))
......
...@@ -1578,6 +1578,20 @@ static bool is_hdr_static_meta_changed(struct dc_stream_state *cur_stream, ...@@ -1578,6 +1578,20 @@ static bool is_hdr_static_meta_changed(struct dc_stream_state *cur_stream,
return false; return false;
} }
static bool is_vsc_info_packet_changed(struct dc_stream_state *cur_stream,
struct dc_stream_state *new_stream)
{
if (cur_stream == NULL)
return true;
if (memcmp(&cur_stream->vsc_infopacket,
&new_stream->vsc_infopacket,
sizeof(struct dc_info_packet)) != 0)
return true;
return false;
}
static bool is_timing_changed(struct dc_stream_state *cur_stream, static bool is_timing_changed(struct dc_stream_state *cur_stream,
struct dc_stream_state *new_stream) struct dc_stream_state *new_stream)
{ {
...@@ -1618,6 +1632,9 @@ static bool are_stream_backends_same( ...@@ -1618,6 +1632,9 @@ static bool are_stream_backends_same(
if (stream_a->dpms_off != stream_b->dpms_off) if (stream_a->dpms_off != stream_b->dpms_off)
return false; return false;
if (is_vsc_info_packet_changed(stream_a, stream_b))
return false;
return true; return true;
} }
...@@ -2504,43 +2521,10 @@ static void set_vsc_info_packet( ...@@ -2504,43 +2521,10 @@ static void set_vsc_info_packet(
struct dc_info_packet *info_packet, struct dc_info_packet *info_packet,
struct dc_stream_state *stream) struct dc_stream_state *stream)
{ {
unsigned int vscPacketRevision = 0; if (!stream->vsc_infopacket.valid)
unsigned int i;
/*VSC packet set to 2 when DP revision >= 1.2*/
if (stream->psr_version != 0) {
vscPacketRevision = 2;
}
/* VSC packet not needed based on the features
* supported by this DP display
*/
if (vscPacketRevision == 0)
return; return;
if (vscPacketRevision == 0x2) { *info_packet = stream->vsc_infopacket;
/* Secondary-data Packet ID = 0*/
info_packet->hb0 = 0x00;
/* 07h - Packet Type Value indicating Video
* Stream Configuration packet
*/
info_packet->hb1 = 0x07;
/* 02h = VSC SDP supporting 3D stereo and PSR
* (applies to eDP v1.3 or higher).
*/
info_packet->hb2 = 0x02;
/* 08h = VSC packet supporting 3D stereo + PSR
* (HB2 = 02h).
*/
info_packet->hb3 = 0x08;
for (i = 0; i < 28; i++)
info_packet->sb[i] = 0;
info_packet->valid = true;
}
/*TODO: stereo 3D support and extend pixel encoding colorimetry*/
} }
void dc_resource_state_destruct(struct dc_state *context) void dc_resource_state_destruct(struct dc_state *context)
...@@ -2722,6 +2706,9 @@ bool pipe_need_reprogram( ...@@ -2722,6 +2706,9 @@ bool pipe_need_reprogram(
if (pipe_ctx_old->stream->dpms_off != pipe_ctx->stream->dpms_off) if (pipe_ctx_old->stream->dpms_off != pipe_ctx->stream->dpms_off)
return true; return true;
if (is_vsc_info_packet_changed(pipe_ctx_old->stream, pipe_ctx->stream))
return true;
return false; return false;
} }
......
...@@ -55,6 +55,7 @@ struct dc_stream_state { ...@@ -55,6 +55,7 @@ struct dc_stream_state {
struct dc_crtc_timing timing; struct dc_crtc_timing timing;
struct dc_crtc_timing_adjust adjust; struct dc_crtc_timing_adjust adjust;
struct dc_info_packet vrr_infopacket; struct dc_info_packet vrr_infopacket;
struct dc_info_packet vsc_infopacket;
struct rect src; /* composition area */ struct rect src; /* composition area */
struct rect dst; /* stream addressable area */ struct rect dst; /* stream addressable area */
......
...@@ -313,10 +313,24 @@ bool hubp1_program_surface_flip_and_addr( ...@@ -313,10 +313,24 @@ bool hubp1_program_surface_flip_and_addr(
{ {
struct dcn10_hubp *hubp1 = TO_DCN10_HUBP(hubp); struct dcn10_hubp *hubp1 = TO_DCN10_HUBP(hubp);
/* program flip type */
REG_SET(DCSURF_FLIP_CONTROL, 0, //program flip type
REG_UPDATE(DCSURF_FLIP_CONTROL,
SURFACE_FLIP_TYPE, flip_immediate); SURFACE_FLIP_TYPE, flip_immediate);
if (address->type == PLN_ADDR_TYPE_GRPH_STEREO) {
REG_UPDATE(DCSURF_FLIP_CONTROL, SURFACE_FLIP_MODE_FOR_STEREOSYNC, 0x1);
REG_UPDATE(DCSURF_FLIP_CONTROL, SURFACE_FLIP_IN_STEREOSYNC, 0x1);
} else {
// turn off stereo if not in stereo
REG_UPDATE(DCSURF_FLIP_CONTROL, SURFACE_FLIP_MODE_FOR_STEREOSYNC, 0x0);
REG_UPDATE(DCSURF_FLIP_CONTROL, SURFACE_FLIP_IN_STEREOSYNC, 0x0);
}
/* HW automatically latch rest of address register on write to /* HW automatically latch rest of address register on write to
* DCSURF_PRIMARY_SURFACE_ADDRESS if SURFACE_UPDATE_LOCK is not used * DCSURF_PRIMARY_SURFACE_ADDRESS if SURFACE_UPDATE_LOCK is not used
* *
......
...@@ -270,6 +270,8 @@ ...@@ -270,6 +270,8 @@
HUBP_SF(HUBPREQ0_DCSURF_SURFACE_PITCH_C, META_PITCH_C, mask_sh),\ HUBP_SF(HUBPREQ0_DCSURF_SURFACE_PITCH_C, META_PITCH_C, mask_sh),\
HUBP_SF(HUBP0_DCSURF_SURFACE_CONFIG, SURFACE_PIXEL_FORMAT, mask_sh),\ HUBP_SF(HUBP0_DCSURF_SURFACE_CONFIG, SURFACE_PIXEL_FORMAT, mask_sh),\
HUBP_SF(HUBPREQ0_DCSURF_FLIP_CONTROL, SURFACE_FLIP_TYPE, mask_sh),\ HUBP_SF(HUBPREQ0_DCSURF_FLIP_CONTROL, SURFACE_FLIP_TYPE, mask_sh),\
HUBP_SF(HUBPREQ0_DCSURF_FLIP_CONTROL, SURFACE_FLIP_MODE_FOR_STEREOSYNC, mask_sh),\
HUBP_SF(HUBPREQ0_DCSURF_FLIP_CONTROL, SURFACE_FLIP_IN_STEREOSYNC, mask_sh),\
HUBP_SF(HUBPREQ0_DCSURF_FLIP_CONTROL, SURFACE_FLIP_PENDING, mask_sh),\ HUBP_SF(HUBPREQ0_DCSURF_FLIP_CONTROL, SURFACE_FLIP_PENDING, mask_sh),\
HUBP_SF(HUBPREQ0_DCSURF_FLIP_CONTROL, SURFACE_UPDATE_LOCK, mask_sh),\ HUBP_SF(HUBPREQ0_DCSURF_FLIP_CONTROL, SURFACE_UPDATE_LOCK, mask_sh),\
HUBP_SF(HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_WIDTH, mask_sh),\ HUBP_SF(HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_WIDTH, mask_sh),\
...@@ -451,6 +453,8 @@ ...@@ -451,6 +453,8 @@
type H_MIRROR_EN;\ type H_MIRROR_EN;\
type SURFACE_PIXEL_FORMAT;\ type SURFACE_PIXEL_FORMAT;\
type SURFACE_FLIP_TYPE;\ type SURFACE_FLIP_TYPE;\
type SURFACE_FLIP_MODE_FOR_STEREOSYNC;\
type SURFACE_FLIP_IN_STEREOSYNC;\
type SURFACE_UPDATE_LOCK;\ type SURFACE_UPDATE_LOCK;\
type SURFACE_FLIP_PENDING;\ type SURFACE_FLIP_PENDING;\
type PRI_VIEWPORT_WIDTH; \ type PRI_VIEWPORT_WIDTH; \
......
/*
* Copyright 2018 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#ifndef MOD_INFO_PACKET_H_
#define MOD_INFO_PACKET_H_
struct info_packet_inputs {
const struct dc_stream_state *pStream;
};
struct info_packets {
struct dc_info_packet *pVscInfoPacket;
};
void mod_build_infopackets(struct info_packet_inputs *inputs,
struct info_packets *info_packets);
#endif
#
# Copyright 2017 Advanced Micro Devices, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
#
# Makefile for the 'info_packet' sub-module of DAL.
#
INFO_PACKET = info_packet.o
AMD_DAL_INFO_PACKET = $(addprefix $(AMDDALPATH)/modules/info_packet/,$(INFO_PACKET))
#$(info ************ DAL INFO_PACKET MODULE MAKEFILE ************)
AMD_DISPLAY_FILES += $(AMD_DAL_INFO_PACKET)
/*
* Copyright 2018 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#include "mod_info_packet.h"
#include "core_types.h"
static void mod_build_vsc_infopacket(const struct dc_stream_state *stream,
struct dc_info_packet *info_packet)
{
unsigned int vscPacketRevision = 0;
unsigned int i;
if (stream->timing.timing_3d_format != TIMING_3D_FORMAT_NONE && stream->view_format != VIEW_3D_FORMAT_NONE)
vscPacketRevision = 1;
/*VSC packet set to 2 when DP revision >= 1.2*/
if (stream->psr_version != 0)
vscPacketRevision = 2;
/* VSC packet not needed based on the features
* supported by this DP display
*/
if (vscPacketRevision == 0)
return;
if (vscPacketRevision == 0x2) {
/* Secondary-data Packet ID = 0*/
info_packet->hb0 = 0x00;
/* 07h - Packet Type Value indicating Video
* Stream Configuration packet
*/
info_packet->hb1 = 0x07;
/* 02h = VSC SDP supporting 3D stereo and PSR
* (applies to eDP v1.3 or higher).
*/
info_packet->hb2 = 0x02;
/* 08h = VSC packet supporting 3D stereo + PSR
* (HB2 = 02h).
*/
info_packet->hb3 = 0x08;
for (i = 0; i < 28; i++)
info_packet->sb[i] = 0;
info_packet->valid = true;
}
if (vscPacketRevision == 0x1) {
info_packet->hb0 = 0x00; // Secondary-data Packet ID = 0
info_packet->hb1 = 0x07; // 07h = Packet Type Value indicating Video Stream Configuration packet
info_packet->hb2 = 0x01; // 01h = Revision number. VSC SDP supporting 3D stereo only
info_packet->hb3 = 0x01; // 01h = VSC SDP supporting 3D stereo only (HB2 = 01h).
if (stream->timing.timing_3d_format == TIMING_3D_FORMAT_INBAND_FA)
info_packet->sb[0] = 0x1;
info_packet->valid = true;
}
}
void mod_build_infopackets(struct info_packet_inputs *inputs,
struct info_packets *info_packets)
{
if (info_packets->pVscInfoPacket != NULL)
mod_build_vsc_infopacket(inputs->pStream, info_packets->pVscInfoPacket);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment