On Tue, Jun 19, 2018 at 5:10 PM, Harry Wentland <harry.wentland at amd.com> wrote: > From: Alvin lee <alvin.lee3 at amd.com> > > - program infoframe for Stereo > - program stereo flip control registers properly > > Change-Id: If547e2677b72709359b3a8602357b80961f1bfce > Signed-off-by: Alvin lee <alvin.lee3 at amd.com> > Reviewed-by: Tony Cheng <Tony.Cheng at amd.com> > Acked-by: Harry Wentland <harry.wentland at amd.com> > --- > drivers/gpu/drm/amd/display/Makefile | 3 +- > .../gpu/drm/amd/display/dc/core/dc_resource.c | 57 ++++++-------- > drivers/gpu/drm/amd/display/dc/dc_stream.h | 1 + > .../gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c | 18 ++++- > .../gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h | 4 + > .../amd/display/modules/inc/mod_info_packet.h | 15 ++++ > .../amd/display/modules/info_packet/Makefile | 31 ++++++++ > .../display/modules/info_packet/info_packet.c | 74 +++++++++++++++++++ > 8 files changed, 165 insertions(+), 38 deletions(-) > create mode 100644 drivers/gpu/drm/amd/display/modules/inc/mod_info_packet.h > create mode 100644 drivers/gpu/drm/amd/display/modules/info_packet/Makefile > create mode 100644 drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c > > diff --git a/drivers/gpu/drm/amd/display/Makefile b/drivers/gpu/drm/amd/display/Makefile > index a2c5be493555..c97dc9613325 100644 > --- a/drivers/gpu/drm/amd/display/Makefile > +++ b/drivers/gpu/drm/amd/display/Makefile > @@ -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/freesync > 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 > 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))) > > diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c > index 72f233963748..41562ffa1c62 100644 > --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c > +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c > @@ -1488,6 +1488,20 @@ static bool is_hdr_static_meta_changed(struct dc_stream_state *cur_stream, > 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, > struct dc_stream_state *new_stream) > { > @@ -1528,6 +1542,9 @@ static bool are_stream_backends_same( > if (stream_a->dpms_off != stream_b->dpms_off) > return false; > > + if (is_vsc_info_packet_changed(stream_a, stream_b)) > + return false; > + > return true; > } > > @@ -2414,43 +2431,10 @@ static void set_vsc_info_packet( > struct dc_info_packet *info_packet, > struct dc_stream_state *stream) > { > - unsigned int vscPacketRevision = 0; > - 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) > + if (!stream->vsc_infopacket.valid) > 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; > - } > - > - /*TODO: stereo 3D support and extend pixel encoding colorimetry*/ > + *info_packet = stream->vsc_infopacket; > } > > void dc_resource_state_destruct(struct dc_state *context) > @@ -2632,6 +2616,9 @@ bool pipe_need_reprogram( > if (pipe_ctx_old->stream->dpms_off != pipe_ctx->stream->dpms_off) > return true; > > + if (is_vsc_info_packet_changed(pipe_ctx_old->stream, pipe_ctx->stream)) > + return true; > + > return false; > } > > diff --git a/drivers/gpu/drm/amd/display/dc/dc_stream.h b/drivers/gpu/drm/amd/display/dc/dc_stream.h > index 584c56b94937..bc496906b695 100644 > --- a/drivers/gpu/drm/amd/display/dc/dc_stream.h > +++ b/drivers/gpu/drm/amd/display/dc/dc_stream.h > @@ -55,6 +55,7 @@ struct dc_stream_state { > struct dc_crtc_timing timing; > struct dc_crtc_timing_adjust adjust; > struct dc_info_packet vrr_infopacket; > + struct dc_info_packet vsc_infopacket; > > struct rect src; /* composition area */ > struct rect dst; /* stream addressable area */ > diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c > index 93f52c58bc69..8b124948c3d0 100644 > --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c > +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.c > @@ -302,10 +302,24 @@ bool hubp1_program_surface_flip_and_addr( > { > 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); > > + > + 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 > * DCSURF_PRIMARY_SURFACE_ADDRESS if SURFACE_UPDATE_LOCK is not used > * > diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h > index d901d5092969..e2f5238b8c11 100644 > --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h > +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubp.h > @@ -272,6 +272,8 @@ > HUBP_SF(HUBP0_DCSURF_SURFACE_CONFIG, H_MIRROR_EN, 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_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_UPDATE_LOCK, mask_sh),\ > HUBP_SF(HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION, PRI_VIEWPORT_WIDTH, mask_sh),\ > @@ -451,6 +453,8 @@ > type H_MIRROR_EN;\ > type SURFACE_PIXEL_FORMAT;\ > type SURFACE_FLIP_TYPE;\ > + type SURFACE_FLIP_MODE_FOR_STEREOSYNC;\ > + type SURFACE_FLIP_IN_STEREOSYNC;\ > type SURFACE_UPDATE_LOCK;\ > type SURFACE_FLIP_PENDING;\ > type PRI_VIEWPORT_WIDTH; \ > diff --git a/drivers/gpu/drm/amd/display/modules/inc/mod_info_packet.h b/drivers/gpu/drm/amd/display/modules/inc/mod_info_packet.h > new file mode 100644 > index 000000000000..18bbf8ad5b5f > --- /dev/null > +++ b/drivers/gpu/drm/amd/display/modules/inc/mod_info_packet.h > @@ -0,0 +1,15 @@ > +#ifndef MOD_INFO_PACKET_H_ > +#define MOD_INFO_PACKET_H_ Please add a proper license to this file. > + > +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 > diff --git a/drivers/gpu/drm/amd/display/modules/info_packet/Makefile b/drivers/gpu/drm/amd/display/modules/info_packet/Makefile > new file mode 100644 > index 000000000000..4c382d728536 > --- /dev/null > +++ b/drivers/gpu/drm/amd/display/modules/info_packet/Makefile > @@ -0,0 +1,31 @@ > +# > +# 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) > diff --git a/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c b/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c > new file mode 100644 > index 000000000000..5d7186f07df8 > --- /dev/null > +++ b/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c > @@ -0,0 +1,74 @@ > +/* > + * info_packet.c > + * > + * Created on: Jun 6, 2018 > + * > + */ Please add a proper license to this file. Alex > + > +#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); > +} > + > -- > 2.17.1 > > _______________________________________________ > amd-gfx mailing list > amd-gfx at lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/amd-gfx