1. 25 2月, 2015 7 次提交
    • B
      drm/i915: Create page table allocators · 06fda602
      Ben Widawsky 提交于
      As we move toward dynamic page table allocation, it becomes much easier
      to manage our data structures if break do things less coarsely by
      breaking up all of our actions into individual tasks.  This makes the
      code easier to write, read, and verify.
      
      Aside from the dissection of the allocation functions, the patch
      statically allocates the page table structures without a page directory.
      This remains the same for all platforms,
      
      The patch itself should not have much functional difference. The primary
      noticeable difference is the fact that page tables are no longer
      allocated, but rather statically declared as part of the page directory.
      This has non-zero overhead, but things gain additional complexity as a
      result.
      
      This patch exists for a few reasons:
      1. Splitting out the functions allows easily combining GEN6 and GEN8
      code. Page tables have no difference based on GEN8. As we'll see in a
      future patch when we add the DMA mappings to the allocations, it
      requires only one small change to make work, and error handling should
      just fall into place.
      
      2. Unless we always want to allocate all page tables under a given PDE,
      we'll have to eventually break this up into an array of pointers (or
      pointer to pointer).
      
      3. Having the discrete functions is easier to review, and understand.
      All allocations and frees now take place in just a couple of locations.
      Reviewing, and catching leaks should be easy.
      
      4. Less important: the GFP flags are confined to one location, which
      makes playing around with such things trivial.
      
      v2: Updated commit message to explain why this patch exists
      
      v3: For lrc, s/pdp.page_directory[i].daddr/pdp.page_directory[i]->daddr/
      
      v4: Renamed free_pt/pd_single functions to unmap_and_free_pt/pd (Daniel)
      
      v5: Added additional safety checks in gen8 clear/free/unmap.
      
      v6: Use WARN_ON and return -EINVAL in alloc_pt_range (Mika).
      
      v7: Make err_out loop symmetrical to the way we allocate in
      alloc_pt_range. Also s/page_tables/page_table and correct commit
      message (Mika)
      
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: Michel Thierry <michel.thierry@intel.com> (v3+)
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      06fda602
    • B
      drm/i915: Complete page table structures · 7324cc04
      Ben Widawsky 提交于
      Move the remaining members over to the new page table structures.
      
      This can be squashed with the previous commit if desire. The reasoning
      is the same as that patch. I simply felt it is easier to review if split.
      
      v2: In lrc: s/ppgtt->pd_dma_addr[i]/ppgtt->pdp.page_directory[i].daddr/
      v3: Rebase.
      v4: Rebased after s/page_tables/page_table/.
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: Michel Thierry <michel.thierry@intel.com> (v2+)
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      7324cc04
    • B
      drm/i915: page table abstractions · d7b3de91
      Ben Widawsky 提交于
      When we move to dynamic page allocation, keeping page_directory and pagetabs as
      separate structures will help to break actions into simpler tasks.
      
      To help transition the code nicely there is some wasted space in gen6/7.
      This will be ameliorated shortly.
      
      Following the x86 pagetable terminology:
      PDPE = struct i915_page_directory_pointer_entry.
      PDE = struct i915_page_directory_entry [page_directory].
      PTE = struct i915_page_table_entry [page_tables].
      
      v2: fixed mismatches after clean-up/rebase.
      
      v3: Clarify the names of the multiple levels of page tables (Daniel)
      
      v4: Addressing Mika's review comments.
      s/gen8_free_page_directories/gen8_free_page_directory and free the
      page tables for the directory there.
      In gen8_ppgtt_allocate_page_directories, do not leak previously allocated
      pt in case the page_directory alloc fails.
      Update error return handling in gen8_ppgtt_alloc.
      
      v5: Do not leak pt on error in gen6_ppgtt_allocate_page_tables. (Mika)
      
      v6: s/page_tables/page_table/. (Mika)
      
      Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
      Signed-off-by: NBen Widawsky <ben@bwidawsk.net>
      Signed-off-by: Michel Thierry <michel.thierry@intel.com> (v2+)
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      d7b3de91
    • S
      drm/i915/skl: Add support for edp1.4 low vswing · 7ad14a29
      Sonika Jindal 提交于
      Based upon vbt's vswing preemph settings value select the appropriate
      translations for edp.
      
      v2: Incorporating bspec changes for vswing and preemph levels, adding edp
      translation table. Removed HSW from selection 9 which is specific to skl and
      correcting the returning of level2 from max pre emph (Damien)
      
      v3: Rebasing on top of renaming patches. Adding level(3,0) since level(2,2) as
      mentioned in bspec is invalid as per edp spec. Also changed the determining of
      size of the table selected (Satheesh).
      
      v4: Adding level 3 in max voltage selection if low vswing is selected (Satheesh)
      
      v5: Add a comment stating that skl_ddi_translations_edp is for eDP 1.4
          low vswing panels.
      
      v6: Updating recommended DDI translation table for edp 1.4
      
      Reviewed-by: Satheeshakrishna M <satheeshakrishna.m@intel.com> (v4)
      Reviewed-by: Damien Lespiau <damien.lespiau@intel.com> (v6)
      Signed-off-by: NSonika Jindal <sonika.jindal@intel.com>
      Signed-off-by: NDamien Lespiau <damien.lespiau@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      7ad14a29
    • S
      drm/i915/skl: Support for edp low_vswing param in vbt · 9a57f5bb
      Sonika Jindal 提交于
      v2: Adding VBT version check for low_vswing field, and correcting parsing
      
      v3: (Damien)
       - Restrain the scope of the 'vswing' variable
       - Use the more idiomatic "ev_priv->vbt.edp_low_vswing = vswing == 0;"
        instead of if (foo) var = true; else var = false;
       - Shorten edp_vswing_premph_setting to edp_vswing_premph to fit in 80 chars
       - Add the version from which the edp_vswing_premph field is valid in the
        struct definition
      
      Reviewed-by: Satheeshakrishna M <satheeshakrishna.m@intel.com> (v2)
      Signed-off-by: NSonika Jindal <sonika.jindal@intel.com>
      Signed-off-by: NDamien Lespiau <damien.lespiau@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      9a57f5bb
    • D
      drm/i915: cleanup some indenting · ba0635ff
      Dan Carpenter 提交于
      Static checkers complain that we should probably add curly braces
      because, from the indenting, it looks like seq_printf() should be inside
      the list_for_each_entry() loop.  But the code is actually correct, it's
      just the indenting which is off.
      
      Besides fixing the indenting on seq_printf(), I did add curly braces,
      because generally mult-line indents should have curly braces to make
      them more readable.
      
      The unintended indent was left behind and not unindented in
      
      commit d7f46fc4
      Author: Ben Widawsky <benjamin.widawsky@intel.com>
      Date:   Fri Dec 6 14:10:55 2013 -0800
      
          drm/i915: Make pin count per VMA
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: NJani Nikula <jani.nikula@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      ba0635ff
    • D
      drm/i915/skl: Make sure to allocate mininum sizes in the DDB · 80958155
      Damien Lespiau 提交于
      I overlooked the fact that we need to allocate a minimum 8 blocks and
      that just allocating the planes depending on how much they need to fetch
      from the DDB in proportion of how much memory bw is necessary for the
      whole display can lead to cases where we don't respect those minima (and
      thus overrun).
      
      So, instead, start by allocating 8 blocks to each active display plane
      and then allocate the remaining blocks like before.
      
      v2: Rebase on top of -nightly
      
      Cc: Mahesh Kumar <mahesh1.kumar@intel.com>
      Signed-off-by: NDamien Lespiau <damien.lespiau@intel.com>
      Reviewed-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      80958155
  2. 24 2月, 2015 20 次提交
  3. 23 2月, 2015 7 次提交
    • D
      drm/i915: FIFO space query code refactor · c32e3788
      Dave Gordon 提交于
      When querying the GTFIFOCTL register to check the FIFO space, the read value
      must be masked. The operation is repeated explicitly in several places. This
      change refactors the read-and-mask code into a function call.
      
      v2: rebased on top of Mika's forcewake patch set, specifically:
      	[PATCH 8/8] drm/i915: Enum forcewake domains and domain identifiers
      
      Change-Id: Id1a9f3785cb20b82d4caa330c37b31e4e384a3ef
      Signed-off-by: NDave Gordon <david.s.gordon@intel.com>
      Reviewed-by: NMika Kuoppala <mika.kuoppala@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      c32e3788
    • D
      drm: WARN if drm_handle_vblank is called errornously · ee3c7795
      Daniel Vetter 提交于
      KMS drivers are in full control of their irq and vblank handling, if
      they get a vblank interrupt before drm_vblank_init or after
      drm_vblank_cleanup that's just a driver bug.
      
      For ums driver there's only r128 and radeon which support vblank, and
      they call drm_vblank_init in their driver load functions. Which again
      means that userspace can do whatever it wants with interrupt, vblank
      structures will always be there.
      
      So this should never happen, let's catch driver issues with a WARN_ON.
      Motivated by some discussions with Imre.
      
      v2: Use WARN_ON_ONCE as suggested by Imre.
      
      Cc: Imre Deak <imre.deak@intel.com>
      Reviewed-by: NImre Deak <imre.deak@intel.com>
      Acked-by: NDave Airlie <airlied@redhat.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      ee3c7795
    • D
      drm/irq: Don't call ->get_vblank_counter directly from irq_uninstall/cleanup · 3bff93d6
      Daniel Vetter 提交于
      The pipe might already have been shut down, and then it's not a good
      idea to call hw accessor functions. Instead use the same logic as
      drm_vblank_off which has all the necessary checks to avoid troubles or
      inconsistency.
      
      Noticed by Imre while reviewing my patches to remove some sanity
      checks from ->get_vblank_counter.
      
      v2: Try harder. disable_and_save can still access the vblank stuff
      when vblank->enabled isn't set. It has to, since vlbank irq could be
      disable but the pipe is still on when being called from
      drm_vblank_off. But we still want to use that code for more code
      sharing. So add a check for vblank->enabled on top - if that's not set
      we shouldn't have anyone waiting for the vblank. If we have that's a
      pretty serious bug.
      
      The other issue that Imre spotted is drm_vblank_cleanup. That code
      again calls disable_and_save and so suffers from the same issues. But
      really drm_irq_uninstall should have cleaned that all up, so replace
      the code with WARN_ON. Note that we can't delete the timer cleanup
      since drivers aren't required to use drm_irq_install/uninstall, but
      can do their own irq handling.
      
      v3: Make it clear that all that gunk in drm_irq_uninstall is really
      just bandaids for UMS races between the irq/vblank code. In UMS
      userspace is in control of enabling/disabling interrupts in general
      and vblanks specifically.
      
      v4: Imre observed that KMS drivers all call drm_vblank_cleanup before
      drm_irq_uninstall (as they should), so again the code in there is dead
      for KMS (due to dev->num_crtcs == 0 after drm_vblank_cleanup). Or
      should be, so only WARN for KMS - with UMS userspace could try to do
      evil things.
      
      v5: After more discussion on irc we've gone back to v3: the
      del_timer_sync is required in all cases in drm_vblank_cleanup, but
      let's restrict the WARN_ON to kms drivers only. Imre was also
      concerned that bad things could happen without the disable_and_save
      call. But we immediately free vblank structures afterwards which makes
      the save useless. And drm_handle_vblank has a check for dev->num_crtcs
      to avoid surprises with ums.
      
      Cc: Imre Deak <imre.deak@intel.com>
      Reviewed-by: NImre Deak <imre.deak@intel.com>
      Acked-by: NDave Airlie <airlied@redhat.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      3bff93d6
    • D
      drm/i915: Switch to drm_crtc variants of vblank functions · 1e3feefd
      Daniel Vetter 提交于
      Where possible right now. Just a small step towards nirvana ...
      
      v2: git add. Uggh. Noticed by Imre.
      
      Cc: Imre Deak <imre.deak@intel.com>
      Reviewed-by: NImre Deak <imre.deak@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      1e3feefd
    • D
      drm/i915: Flatten DRIVER_MODESET checks in i915_irq.c · f3a5c3f6
      Daniel Vetter 提交于
      UMS is no more!
      
      Cc: Imre Deak <imre.deak@intel.com>
      Reviewed-by: NImre Deak <imre.deak@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      f3a5c3f6
    • D
      drm/i915: Drop pipe_enable checks in vblank funcs · 1efa2e35
      Daniel Vetter 提交于
      With Ville's rework to use drm_crtc_vblank_on/off the core will take
      care of rejecting drm_vblank_get calls when the pipe is off. Also the
      core won't call the get_vblank_counter hooks in that case either. And
      since we've dropped ums support recently we can now remove these
      hacks, yay!
      
      Noticed while trying to answer questions Laurent had about how the new
      atomic helpers work.
      
      Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Reviewed-by: NImre Deak <imre.deak@intel.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      1efa2e35
    • D
      drm/irq: Add drm_crtc_vblank_reset · 9625604c
      Daniel Vetter 提交于
      At driver load we need to tell the vblank code about the state of the
      pipes, so that the logic around reject vblank_get when the pipe is off
      works correctly.
      
      Thus far i915 used drm_vblank_off, but one of the side-effects of it
      is that it also saves the vblank counter. And for that it calls down
      into the ->get_vblank_counter hook. Which isn't really a good idea
      when the pipe is off for a few reasons:
      - With runtime pm the register might not respond.
      - If the pipe is off some datastructures might not be around or
        unitialized.
      
      The later is what blew up on gen3: We look at intel_crtc->config to
      compute the vblank counter, and for a disabled pipe at boot-up that's
      just not there. Thus far this was papered over by a check for
      intel_crtc->active, but I want to get rid of that (since it's fairly
      race, vblank hooks are called from all kinds of places).
      
      So prep for that by adding a _reset functions which only does what we
      really need to be done at driver load: Mark the vblank pipe as off,
      but don't do any vblank counter saving or event flushing - neither of
      that is required.
      
      v2: Clarify the code flow slightly as suggested by Ville.
      
      v3: Fix kerneldoc spelling, spotted by Laurent.
      
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Cc: Imre Deak <imre.deak@intel.com>
      Reviewed-by: Imre Deak <imre.deak@intel.com> (v2)
      Acked-by: NDave Airlie <airlied@redhat.com>
      Acked-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@intel.com>
      9625604c
  4. 14 2月, 2015 6 次提交