GVT currently relies on display internals through register macros and
helpers like for_each_pipe(). This tight coupling makes modularization
difficult because GVT should not access struct intel_display directly.
Add an API for GVT code to expose DISPLAY_RUNTIME_INFO()->pipe_mask.
This series introduces changes to make GVT independent of display internals
while keeping existing macros usable:

- Abstract offset calculations in display using
  INTEL_DISPLAY_DEVICE_*_OFFSET() macros.
- Add APIs for GVT to compute offsets and pipe mask via functions.
- Update GVT to use these APIs by overriding helper macros and
  for_each_pipe().

Rev2:
- Remove conflicting headers and get rid of #ifdefs/#undefs in last
  patch.
- Wrap macro arguments in paranthesis.
- Rename for_each_pipe to gvt_for_each_pipe.

PS: I have not yet addressed the question about whether we need to start
    using _MMIO_TRANS2() instead of_MMIO_PIPE2() in TRANSCONF() macro.
    That likely needs a separate patch and discussion.
    For now, I have kept the patch#4 to deal with the
    -Werror=enum-conversion:
     - drm/i915/gvt/display_helpers: Cast argument to enum pipe for
       pipe-offset macro

Rev3:
 - Squash patch to cast arg to enum pipe for the pipe-offset macro.
 - Add FIXME comment about the cast.
 - Add intel_gvt_api.o to Makefile only when CONFIG_DRM_I915_GVT is enabled.
 - Export GVT-facing helpers using EXPORT_SYMBOL_NS_GPL(..., "I915_GVT") to
   limit exposure.

Ankit Nautiyal (6):
  drm/i915/display: Abstract pipe/trans/cursor offset calculation
  drm/i915/display: Add APIs to be used by gvt to get the register
    offsets
  drm/i915/gvt: Add header to use display offset functions in macros
  drm/i915/gvt: Change for_each_pipe to use pipe_valid API
  drm/i915/gvt: Use the appropriate header for the DPLL macro
  drm/i915/gvt/display_helper: Get rid of #ifdef/#undefs

 drivers/gpu/drm/i915/Makefile                 |  3 ++
 .../drm/i915/display/intel_display_device.h   | 17 ++++++++
 .../drm/i915/display/intel_display_limits.c   |  0
 .../drm/i915/display/intel_display_reg_defs.h | 15 ++-----
 drivers/gpu/drm/i915/display/intel_gvt_api.c  | 43 +++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_gvt_api.h  | 21 +++++++++
 drivers/gpu/drm/i915/gvt/cmd_parser.c         |  2 +-
 drivers/gpu/drm/i915/gvt/display.c            | 13 +++---
 drivers/gpu/drm/i915/gvt/display_helpers.h    | 37 ++++++++++++++++
 drivers/gpu/drm/i915/gvt/fb_decoder.c         |  2 +-
 drivers/gpu/drm/i915/gvt/handlers.c           |  2 +-
 11 files changed, 135 insertions(+), 20 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/intel_display_limits.c
 create mode 100644 drivers/gpu/drm/i915/display/intel_gvt_api.c
 create mode 100644 drivers/gpu/drm/i915/display/intel_gvt_api.h
 create mode 100644 drivers/gpu/drm/i915/gvt/display_helpers.h

-- 
2.45.2

Reply via email to