Skip to content
  1. Jun 18, 2016
    • Zhi Wang's avatar
      drm/i915: gvt: Introduce the basic architecture of GVT-g · 0ad35fed
      Zhi Wang authored
      
      
      This patch introduces the very basic framework of GVT-g device model,
      includes basic prototypes, definitions, initialization.
      
      v12:
      - Call intel_gvt_init() in driver early initialization stage. (Chris)
      
      v8:
      - Remove the GVT idr and mutex in intel_gvt_host. (Joonas)
      
      v7:
      - Refine the URL link in Kconfig. (Joonas)
      - Refine the introduction of GVT-g host support in Kconfig. (Joonas)
      - Remove the macro GVT_ALIGN(), use round_down() instead. (Joonas)
      - Make "struct intel_gvt" a data member in struct drm_i915_private.(Joonas)
      	- Remove {alloc, free}_gvt_device()
      	- Rename intel_gvt_{create, destroy}_gvt_device()
      	- Expost intel_gvt_init_host()
      - Remove the dummy "struct intel_gvt" declaration in intel_gvt.h (Joonas)
      
      v6:
      - Refine introduction in Kconfig. (Chris)
      - The exposed API functions will take struct intel_gvt * instead of
      void *. (Chris/Tvrtko)
      - Remove most memebers of strct intel_gvt_device_info. Will add them
      in the device model patches.(Chris)
      - Remove gvt_info() and gvt_err() in debug.h. (Chris)
      - Move GVT kernel parameter into i915_params. (Chris)
      - Remove include/drm/i915_gvt.h, as GVT-g will be built within i915.
      - Remove the redundant struct i915_gvt *, as the functions in i915
      will directly take struct intel_gvt *.
      - Add more comments for reviewer.
      
      v5:
      Take Tvrtko's comments:
      - Fix the misspelled words in Kconfig
      - Let functions take drm_i915_private * instead of struct drm_device *
      - Remove redundant prints/local varible initialization
      
      v3:
      Take Joonas' comments:
      - Change file name i915_gvt.* to intel_gvt.*
      - Move GVT kernel parameter into intel_gvt.c
      - Remove redundant debug macros
      - Change error handling style
      - Add introductions for some stub functions
      - Introduce drm/i915_gvt.h.
      
      Take Kevin's comments:
      - Move GVT-g host/guest check into intel_vgt_balloon in i915_gem_gtt.c
      
      v2:
      - Introduce i915_gvt.c.
      It's necessary to introduce the stubs between i915 driver and GVT-g host,
      as GVT-g components is configurable in kernel config. When disabled, the
      stubs here do nothing.
      
      Take Joonas' comments:
      - Replace boolean return value with int.
      - Replace customized info/warn/debug macros with DRM macros.
      - Document all non-static functions like i915.
      - Remove empty and unused functions.
      - Replace magic number with marcos.
      - Set GVT-g in kernel config to "n" by default.
      
      Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
      Cc: Kevin Tian <kevin.tian@intel.com>
      Signed-off-by: default avatarZhi Wang <zhi.a.wang@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1466078825-6662-5-git-send-email-zhi.a.wang@intel.com
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      0ad35fed
    • Zhi Wang's avatar
      drm/i915: Fold vGPU active check into inner functions · b02d22a3
      Zhi Wang authored
      
      
      v5:
      - Let functions take struct drm_i915_private *. (Tvrtko)
      
      - Fold vGPU related active check into the inner functions. (Kevin)
      
      Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
      Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Suggested-by: default avatarKevin Tian <kevin.tian@intel.com>
      Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Kevin Tian <kevin.tian@intel.com>
      Signed-off-by: default avatarZhi Wang <zhi.a.wang@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1466078825-6662-4-git-send-email-zhi.a.wang@intel.com
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      b02d22a3
    • Zhi Wang's avatar
      drm/i915: Use offsetof() to calculate the offset of members in PVINFO page · b2a5d1e7
      Zhi Wang authored
      
      
      To get the offset of the members in PVINFO page, offsetof() looks much
      better than the tricky approach in current code.
      
      v7:
      
      - Move "offsetof()" modification into a dedicated patch. (Joonas)
      
      Suggested-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Signed-off-by: default avatarZhi Wang <zhi.a.wang@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1466078825-6662-3-git-send-email-zhi.a.wang@intel.com
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      b2a5d1e7
    • Zhi Wang's avatar
      drm/i915: Factor out i915_pvinfo.h · 87da603c
      Zhi Wang authored
      
      
      As the PVINFO page definition is used by both GVT-g guest (vGPU) and GVT-g
      host (GVT-g kernel device model), factor it out for better code structure.
      
      v7:
      - Split the "offsetof" modification into a dedicated patch. (Joonas)
      
      v3:
      - Use offsetof to calculate the member offset of PVINFO structure (Joonas)
      
      Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Signed-off-by: default avatarZhi Wang <zhi.a.wang@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1466078825-6662-2-git-send-email-zhi.a.wang@intel.com
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      87da603c
  2. Jun 17, 2016
    • Chris Wilson's avatar
      drm/i915: Serialise presentation with imported dmabufs · c37efb99
      Chris Wilson authored
      
      
      obj->base.dma_buf represents a dma-buf exported from this object (for
      use by others). On the contrary, obj->base.import_attach represents the
      source dma-buf that was used to create this object (if any). When
      serialising with third parties, we need to wait on their rendering via
      the import attachment as well as their rendering on our exported
      dma-buf.
      
      v2: Wait on both import and export.
      v3: Rebase
      
      Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Cc: Alex Goins <agoins@nvidia.com>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
      Tested-by: default avatarAlex Goins <agoins@nvidia.com>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/1466148527-10891-1-git-send-email-chris@chris-wilson.co.uk
      c37efb99
  3. Jun 16, 2016
    • Daniel Vetter's avatar
      drm/i915: Use atomic commits for legacy page_flips · ee042aa4
      Daniel Vetter authored
      
      
      Note that I didn't start garbage collecting all the legacy flip code
      yet, to make it easier to revert this. But there will be _lots_ of
      code that can be removed once this is tested on all platforms.
      
      v2: Use __maybe_unused (Maarten).
      
      Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/1465827229-1704-5-git-send-email-daniel.vetter@ffwll.ch
      ee042aa4
    • Daniel Vetter's avatar
      drm/i915: Move fb_bits updating later in atomic_commit · 6c9c1b38
      Daniel Vetter authored
      
      
      Currently it's part of prepare_fb, still in the first phase of
      atomic_commit which might fail. Which means that we need to have some
      heuristics in cleanup_fb to figure out whether things failed, or
      whether we just clean up the old fbs.
      
      That's fragile, and worse, once we start pipelining commits gets
      confused: While the last commit is still getting cleanup up we already
      hammer in the new one, and fb_bits aren't refcounted, resulting in
      lost bits and WARN_ON galore. We could instead try to make cleanup_fb
      more clever, but a simpler fix is to postpone the fb_bits tracking
      past the point of no return, where we commit all the software state.
      
      That also makes conceptually more sense, since fb_bits must be updated
      synchronously from the ioctl (they track usage from userspace pov, not
      from the hw pov), right before we're fully committed to the updated.
      
      This fixes WARNING splats from track_fb with page_flip implemented
      through atomic_commit.
      
      Testcase: igt/kms_flip/flip-vs-rmfb
      Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1465827229-1704-4-git-send-email-daniel.vetter@ffwll.ch
      6c9c1b38
    • Daniel Vetter's avatar
      drm/i915: nonblocking commit · 94f05024
      Daniel Vetter authored
      
      
      Simply split intel_atomic_commit in half and place the new
      nonblocking commit helpers at the right spots.
      
      NOTE: There's still trouble with obj->frontbuffer bits getting mangled
      when pipelining atomic commits.
      
      v2:
      - Remove the check for nonblocking which returned -EINVAL.
      - Do wait for requests in the worker thread before committing
        hw state.
      
      v3: Move hw_done after the optimize_wm/post_plane_update step, plus
      add FIXME comment how to fix that up again properly.
      
      v4: Update FIXME for intel_atomic_commit - more stuff works now.
      
      v5: Still reject nonblocking modeset commits (Maarten).
      
      v6: Use intel_state->modeset (Maarten).
      
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1465920060-6388-1-git-send-email-daniel.vetter@ffwll.ch
      94f05024
    • Maarten Lankhorst's avatar
      Reapply "drm/i915: Pass atomic states to fbc update, functions." · faf68d92
      Maarten Lankhorst authored
      
      
      The patch was reverted as part of the original nonblocking commit
      support, but is required for any kind of nonblocking commit.
      
      This is required to let fbc updates run async. It has a lot of
      checks whether certain locks are taken, which can be removed when
      the relevant states are passed in as pointers.
      
      Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1463490484-19540-17-git-send-email-maarten.lankhorst@linux.intel.com
      Reviewed-by: default avatarPatrik Jakobsson <patrik.jakobsson@linux.intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/28208c38-8738-abdf-0cce-8d8f266b9c28@linux.intel.com
      faf68d92
    • Daniel Vetter's avatar
      drm/i915: Roll out the helper nonblock tracking · ea0000f0
      Daniel Vetter authored
      
      
      Right now still all blocking, no worker anywhere to be seen.
      
      Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      Link: http://patchwork.freedesktop.org/patch/msgid/1465827229-1704-2-git-send-email-daniel.vetter@ffwll.ch
      ea0000f0
    • Daniel Vetter's avatar
      drm/i915: Signal drm events for atomic · 1f7528c4
      Daniel Vetter authored
      
      
      This is part of what atomic must implement. And it's also required
      to be able to use the helper nonblocking support.
      
      v2: Always send out the drm event, remove the planes_changed check.
      
      Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/1465827229-1704-1-git-send-email-daniel.vetter@ffwll.ch
      1f7528c4
    • Daniel Vetter's avatar
      Merge remote-tracking branch 'airlied/drm-next' into drm-intel-next-queued · c1994121
      Daniel Vetter authored
      
      
      Backmerge drm-next to get at the nonblocking atomic helpers, needed to
      merge the i915 conversion.
      
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      c1994121
    • Dave Airlie's avatar
      Merge tag 'topic/drm-misc-2016-06-15' of git://anongit.freedesktop.org/drm-intel into drm-next · a0877f52
      Dave Airlie authored
      - best_encoder cleanup from Boris.
      - drm_simple_display_pipe helpers from Noralf. Looks really neat imo, and
        there's 2-3 in-flight drivers which look like they could/should use it.
        Anyway, with this we have now helpers and everything in place to write
        drivers for simple hw with fewer complexity in the driver than what
        fbdev would need. That was the last complaint I've heard from embedded
        folks after we made atomic happen. Mission accomplished!
      - nonblocking commit helpers for atomic, plus a bunch of driver patches
        for that.
      - Prep patch from Laurent for cleaned up pixel format functions.
      - More of Gustavo's cleanup for drm vblank functions.
      - and a few oddball things in between
      
      Plus the merge of docs-next to prep the docbook->sphinx conversion as
      discussed. Jon cc'ed as fyi.
      
      * tag 'topic/drm-misc-2016-06-15' of git://anongit.freedesktop.org/drm-intel: (108 commits)
        drm/atomic-helpers: Clear up cleanup_done a bit
        drm/atomic-helpers: Stall on the right commit
        drm/vmwgfx: use *_32_bits() macros
        drm/virtio: Don't reinvent a flipping wheel
        drm/i915: Fix missing unlock on error in i915_ppgtt_info()
        drm/gma500: use drm_crtc_vblank_{on,off}()
        drm/radeon: use crtc directly in drm_crtc_vblank_put()
        drm/amdgpu: use crtc directly in drm_crtc_vblank_put()
        drm/radeon: use drm_crtc_vblank_{on,off}()
        drm/amdgpu: use drm_crtc_vblank_{on,off}()
        drm: make drm_vblank_{get,put}() static
        drm: remove legacy drm_arm_vblank_event()
        drm: remove legacy drm_send_vblank_event()
        drm/nouveau: replace legacy vblank helpers
        drm/prime: fix error path deadlock fail
        drm/dsi: Add uevent callback
        drm: fb: cma: fix memory leak
        drm: i915: Rely on the default ->best_encoder() behavior where appropriate
        drm: Add helper for simple display pipeline
        drm/bridge: dw-hdmi: Use drm_atomic_helper_best_encoder()
        ...
      a0877f52
  4. Jun 15, 2016
    • Daniel Vetter's avatar
      drm/atomic-helpers: Clear up cleanup_done a bit · 7deef7f1
      Daniel Vetter authored
      
      
      It's not obvious at first sight that this is a fastpath, make that
      clearer with a goto. Fallout from a discussion with Liviu on irc.
      
      v2: Drop bogus hunks that crept in.
      
      v3: Make it compile.
      
      Cc: Liviu.Dudau@arm.com
      Acked-by: default avatar <Liviu.Dudau@arm.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/1465986266-2831-1-git-send-email-daniel.vetter@ffwll.ch
      7deef7f1
    • Daniel Vetter's avatar
      drm/atomic-helpers: Stall on the right commit · 723c3e55
      Daniel Vetter authored
      
      
      stall_checks carefully picked out the right commit to stall on, then
      promptly used the wrong variable. Due to the break in the next loop
      iteration this could be the 3rd commit, or if the list only has 2
      entries commit would now point into the struct drm_crtc itself, at
      some offset. Hilarity eventually ensues.
      
      For added safety, also break right away instead of iterating once
      more, but the real fix is waiting on stall_commit instead of commit.
      
      Reported-and-tested-by: default avatarLiviu Dudau <Liviu.Dudau@arm.com>
      Cc: Liviu Dudau <Liviu.Dudau@arm.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      Reviewed-by: default avatarLiviu Dudau <Liviu.Dudau@arm.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/1465926658-10110-1-git-send-email-daniel.vetter@ffwll.ch
      723c3e55
    • Paul Bolle's avatar
      drm/vmwgfx: use *_32_bits() macros · 0e7c875d
      Paul Bolle authored
      
      
      Use the upper_32_bits() macro instead of the four line equivalent that
      triggers a GCC warning on 32 bits x86:
          drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c: In function 'vmw_cmdbuf_header_submit':
          drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c:297:25: warning: right shift count >= width of type [-Wshift-count-overflow]
             val = (header->handle >> 32);
                                   ^
      
      And use the lower_32_bits() macro instead of and-ing with a 32 bits
      mask.
      
      Signed-off-by: default avatarPaul Bolle <pebolle@tiscali.nl>
      Acked-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/1457000770-2317-1-git-send-email-pebolle@tiscali.nl
      0e7c875d
    • Lyude's avatar
      drm/i915/ilk: Don't disable SSC source if it's in use · 1c1a24d2
      Lyude authored
      
      
      Thanks to Ville Syrjälä for pointing me towards the cause of this issue.
      
      Unfortunately one of the sideaffects of having the refclk for a DPLL set
      to SSC is that as long as it's set to SSC, the GPU will prevent us from
      powering down any of the pipes or transcoders using it. A couple of
      BIOSes enable SSC in both PCH_DREF_CONTROL and in the DPLL
      configurations. This causes issues on the first modeset, since we don't
      expect SSC to be left on and as a result, can't successfully power down
      the pipes or the transcoders using it. Here's an example from this Dell
      OptiPlex 990:
      
      [drm:intel_modeset_init] SSC enabled by BIOS, overriding VBT which says disabled
      [drm:intel_modeset_init] 2 display pipes available.
      [drm:intel_update_cdclk] Current CD clock rate: 400000 kHz
      [drm:intel_update_max_cdclk] Max CD clock rate: 400000 kHz
      [drm:intel_update_max_cdclk] Max dotclock rate: 360000 kHz
      vgaarb: device changed decodes: PCI:0000:00:02.0,olddecodes=io+mem,decodes=io+mem:owns=io+mem
      [drm:intel_crt_reset] crt adpa set to 0xf40000
      [drm:intel_dp_init_connector] Adding DP connector on port C
      [drm:intel_dp_aux_init] registering DPDDC-C bus for card0-DP-1
      [drm:ironlake_init_pch_refclk] has_panel 0 has_lvds 0 has_ck505 0
      [drm:ironlake_init_pch_refclk] Disabling SSC entirely
      … later we try committing the first modeset …
      [drm:intel_dump_pipe_config] [CRTC:26][modeset] config ffff88041b02e800 for pipe A
      [drm:intel_dump_pipe_config] cpu_transcoder: A
      …
      [drm:intel_dump_pipe_config] dpll_hw_state: dpll: 0xc4016001, dpll_md: 0x0, fp0: 0x20e08, fp1: 0x30d07
      [drm:intel_dump_pipe_config] planes on this crtc
      [drm:intel_dump_pipe_config] STANDARD PLANE:23 plane: 0.0 idx: 0 enabled
      [drm:intel_dump_pipe_config]     FB:42, fb = 800x600 format = 0x34325258
      [drm:intel_dump_pipe_config]     scaler:0 src (0, 0) 800x600 dst (0, 0) 800x600
      [drm:intel_dump_pipe_config] CURSOR PLANE:25 plane: 0.1 idx: 1 disabled, scaler_id = 0
      [drm:intel_dump_pipe_config] STANDARD PLANE:27 plane: 0.1 idx: 2 disabled, scaler_id = 0
      [drm:intel_get_shared_dpll] CRTC:26 allocated PCH DPLL A
      [drm:intel_get_shared_dpll] using PCH DPLL A for pipe A
      [drm:ilk_audio_codec_disable] Disable audio codec on port C, pipe A
      [drm:intel_disable_pipe] disabling pipe A
      ------------[ cut here ]------------
      WARNING: CPU: 1 PID: 130 at drivers/gpu/drm/i915/intel_display.c:1146 intel_disable_pipe+0x297/0x2d0 [i915]
      pipe_off wait timed out
      …
      ---[ end trace 94fc8aa03ae139e8 ]---
      [drm:intel_dp_link_down]
      [drm:ironlake_crtc_disable [i915]] *ERROR* failed to disable transcoder A
      
      Later modesets succeed since they reset the DPLL's configuration anyway,
      but this is enough to get stuck with a big fat warning in dmesg.
      
      A better solution would be to add refcounts for the SSC source, but for
      now leaving the source clock on should suffice.
      
      Changes since v4:
       - Fix calculation of final for systems with LVDS panels (fixes BUG() on
         CI test suite)
      Changes since v3:
       - Move temp variable into loop
       - Move checks for using_ssc_source to after we've figured out has_ck505
       - Add using_ssc_source to debug output
      Changes since v2:
       - Fix debug output for when we disable the CPU source
      Changes since v1:
       - Leave the SSC source clock on instead of just shutting it off on all
         of the DPLL configurations.
      
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: default avatarLyude <cpaul@redhat.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: http://patchwork.freedesktop.org/patch/msgid/1465916649-10228-1-git-send-email-cpaul@redhat.com
      1c1a24d2
    • Daniel Vetter's avatar
      Merge tag 'sphinx-4.8' of git://git.lwn.net/linux into topic/drm-misc · db5dfef7
      Daniel Vetter authored
      
      
      Stable tag for sphinx work
      
      Pull current state of the sphinx rework from Jonathan into drm-misc so
      that we can start converting gpu.tmpl.
      
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      db5dfef7
  5. Jun 14, 2016