• Archit Taneja's avatar
    OMAPDSS: APPLY: Don't treat an overlay's channel out as shadow bits · 02b5ff1a
    Archit Taneja authored
    An overlay's channel out field isn't a shadow register. The TRM says that it's
    taken into effect immediately. This understanding was missing and channel out
    was treated as a shadow parameter, and in overlay's private data as extra info.
    
    Program channel out bits directly in dss_ovl_set_manager(). In order to do this
    safely, we need to be totally sure that the overlay is disabled in hardware. For
    auto update managers, we can assume that the overlay was truly disabled at
    dss_ovl_unset_manager() through the wait_pending_extra_info_updates() call.
    However, when unsetting manager for an overlay that was previously connected to
    a manager in manual update, we can't be sure if the overlay is truly disabled.
    That is, op->enabled might not reflect the actual state of the overlay in
    hardware. The older manager may require a manual update transfer to truly
    disable the overlay. We expect the user of OMAPDSS to take care of this, in
    OMAPDSS, we make sure that an overlay's manager isn't unset if there if
    extra_info is still dirty for that overlay.
    
    The wrong understanding of channel out bits also explains the reason why we see
    sync lost when changing an overlay's manager which was previously connected to a
    manual update manager. The following sequence of events caused this:
    
    - When we disable the overlay, no register writes are actually done since the
      manager is manual update, op->enabled is set to false, and the
      extra_info_dirty flag is set. However, in hardware, the overlay is still
      enabled in both shadow and working registers.
    
    - When we unset the manager, the software just configures the overlay's manager
      to point to NULL.
    
    - When we set the overlay to a new manager(which is in auto update) through
      dss_ovl_set_manager, the check  for op->enabled passes, the channel field in
      extra info is set to the new manager. When we do an apply on this manager,
      the new channel out field is set in the hardware immediately, and since the
      overlay enable bit is still set in hardware, the new manager sees that the
      overlay is enabled, and tries to retrieve pixels from it, this leads to sync
      lost as it might be in the middle of processing a frame when we set the
      channel out bit.
    
    The solution to this was to ensure that user space does another update after
    disabling the overlay, this actually worked because the overlay was now truly
    disabled, and an immediate write to channel out didn't impact since the manager
    saw the new overlay as disabled, and doesn't try to retrieve pixels from it.
    
    Remove channel as an extra_info field. Make dss_ovl_unset_manager more strict
    about the overlay being disabled when detaching the manager. For overlays
    connected to a manual update manager, unset_manager fails if we need another
    update to disable the overlay.
    
    We still need to a manual update to ensure the overlay is disabled to get change
    the overlay's manager. We could work on doing a dummy update by using DISPC's
    capability to gate the different video port signals. This is left for later.
    
    Remove the comment about the sync lost issue.
    Signed-off-by: default avatarArchit Taneja <archit@ti.com>
    Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
    02b5ff1a
apply.c 29.2 KB