1. 31 3月, 2021 4 次提交
  2. 19 1月, 2021 1 次提交
  3. 22 12月, 2020 2 次提交
  4. 18 12月, 2020 1 次提交
    • L
      drm/edid: fix objtool warning in drm_cvt_modes() · d652d5f1
      Linus Torvalds 提交于
      Commit 991fcb77 ("drm/edid: Fix uninitialized variable in
      drm_cvt_modes()") just replaced one warning with another.
      
      The original warning about a possibly uninitialized variable was due to
      the compiler not being smart enough to see that the case statement
      actually enumerated all possible cases.  And the initial fix was just to
      add a "default" case that had a single "unreachable()", just to tell the
      compiler that that situation cannot happen.
      
      However, that doesn't actually fix the fundamental reason for the
      problem: the compiler still doesn't see that the existing case
      statements enumerate all possibilities, so the compiler will still
      generate code to jump to that unreachable case statement.  It just won't
      complain about an uninitialized variable any more.
      
      So now the compiler generates code to our inline asm marker that we told
      it would not fall through, and end end result is basically random.  We
      have created a bridge to nowhere.
      
      And then, depending on the random details of just exactly what the
      compiler ends up doing, 'objtool' might end up complaining about the
      conditional branches (for conditions that cannot happen, and that thus
      will never be taken - but if the compiler was not smart enough to figure
      that out, we can't expect objtool to do so) going off in the weeds.
      
      So depending on how the compiler has laid out the result, you might see
      something like this:
      
          drivers/gpu/drm/drm_edid.o: warning: objtool: do_cvt_mode() falls through to next function drm_mode_detailed.isra.0()
      
      and now you have a truly inscrutable warning that makes no sense at all
      unless you start looking at whatever random code the compiler happened
      to generate for our bare "unreachable()" statement.
      
      IOW, don't use "unreachable()" unless you have an _active_ operation
      that generates code that actually makes it obvious that something is not
      reachable (ie an UD instruction or similar).
      
      Solve the "compiler isn't smart enough" problem by just marking one of
      the cases as "default", so that even when the compiler doesn't otherwise
      see that we've enumerated all cases, the compiler will feel happy and
      safe about there always being a valid case that initializes the 'width'
      variable.
      
      This also generates better code, since now the compiler doesn't generate
      comparisons for five different possibilities (the four real ones and the
      one that can't happen), but just for the three real ones and "the rest"
      (which is that last one).
      
      A smart enough compiler that sees that we cover all the cases won't care.
      
      Cc: Lyude Paul <lyude@redhat.com>
      Cc: Ilia Mirkin <imirkin@alum.mit.edu>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d652d5f1
  5. 07 11月, 2020 1 次提交
  6. 30 10月, 2020 1 次提交
  7. 27 10月, 2020 1 次提交
  8. 23 9月, 2020 1 次提交
  9. 17 9月, 2020 1 次提交
  10. 20 7月, 2020 1 次提交
    • S
      drm: core: Convert device logging to drm_* functions. · 6d45fff5
      Suraj Upadhyay 提交于
      Convert device logging with dev_* functions into drm_* functions.
      
      The patch has been generated with the coccinelle script below.
      The script focuses on instances of dev_* functions where the drm device
      context is clearly visible in its arguments.
      
      @@expression E1; expression list E2; @@
      -dev_warn(E1->dev, E2)
      +drm_warn(E1, E2)
      
      @@expression E1; expression list E2; @@
      -dev_info(E1->dev, E2)
      +drm_info(E1, E2)
      
      @@expression E1; expression list E2; @@
      -dev_err(E1->dev, E2)
      +drm_err(E1, E2)
      
      @@expression E1; expression list E2; @@
      -dev_info_once(E1->dev, E2)
      +drm_info_once(E1, E2)
      
      @@expression E1; expression list E2; @@
      -dev_notice_once(E1->dev, E2)
      +drm_notice_once(E1, E2)
      
      @@expression E1; expression list E2; @@
      -dev_warn_once(E1->dev, E2)
      +drm_warn_once(E1, E2)
      
      @@expression E1; expression list E2; @@
      -dev_err_once(E1->dev, E2)
      +drm_err_once(E1, E2)
      
      @@expression E1; expression list E2; @@
      -dev_err_ratelimited(E1->dev, E2)
      +drm_err_ratelimited(E1, E2)
      
      @@expression E1; expression list E2; @@
      -dev_dbg(E1->dev, E2)
      +drm_dbg(E1, E2)
      Signed-off-by: NSuraj Upadhyay <usuraj35@gmail.com>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200718150955.GA23103@blackclown
      6d45fff5
  11. 17 7月, 2020 1 次提交
  12. 10 7月, 2020 3 次提交
  13. 02 7月, 2020 1 次提交
  14. 30 6月, 2020 2 次提交
  15. 24 6月, 2020 1 次提交
  16. 27 5月, 2020 1 次提交
    • V
      drm: Nuke mode->vrefresh · 0425662f
      Ville Syrjälä 提交于
      Get rid of mode->vrefresh and just calculate it on demand. Saves
      a bit of space and avoids the cached value getting out of sync
      with reality.
      
      Mostly done with cocci, with the following manual fixups:
      - Remove the now empty loop in drm_helper_probe_single_connector_modes()
      - Fix __MODE() macro in ch7006_mode.c
      - Fix DRM_MODE_ARG() macro in drm_modes.h
      - Remove leftover comment from samsung_s6d16d0_mode
      - Drop the TODO
      
      @@
      @@
      struct drm_display_mode {
      	...
      -	int vrefresh;
      	...
      };
      
      @@
      identifier N;
      expression E;
      @@
      struct drm_display_mode N = {
      -	.vrefresh = E
      };
      
      @@
      identifier N;
      expression E;
      @@
      struct drm_display_mode N[...] = {
      ...,
      {
      -	.vrefresh = E
      }
      ,...
      };
      
      @@
      expression E;
      @@
      {
      	DRM_MODE(...),
      -	.vrefresh = E,
      }
      
      @@
      identifier M, R;
      @@
      int drm_mode_vrefresh(const struct drm_display_mode *M)
      {
        ...
      - if (M->vrefresh > 0)
      - 	R = M->vrefresh;
      - else
        if (...) {
        ...
        }
        ...
      }
      
      @@
      struct drm_display_mode *p;
      expression E;
      @@
      (
      - p->vrefresh = E;
      |
      - p->vrefresh
      + drm_mode_vrefresh(p)
      )
      
      @@
      struct drm_display_mode s;
      expression E;
      @@
      (
      - s.vrefresh = E;
      |
      - s.vrefresh
      + drm_mode_vrefresh(&s)
      )
      
      @@
      expression E;
      @@
      - drm_mode_vrefresh(E) ? drm_mode_vrefresh(E) : drm_mode_vrefresh(E)
      + drm_mode_vrefresh(E)
      
      @find_substruct@
      identifier X;
      identifier S;
      @@
      struct X {
      ...
      	struct drm_display_mode S;
      ...
      };
      
      @@
      identifier find_substruct.S;
      expression E;
      identifier I;
      @@
      {
      .S = {
      -	.vrefresh = E
      }
      }
      
      @@
      identifier find_substruct.S;
      identifier find_substruct.X;
      expression E;
      identifier I;
      @@
      struct X I[...] = {
      ...,
      .S = {
      -	.vrefresh = E
      }
      ,...
      };
      
      v2: Drop TODO
      v3: Rebase
      v4: Rebase
      
      Cc: Andrzej Hajda <a.hajda@samsung.com>
      Cc: Neil Armstrong <narmstrong@baylibre.com>
      Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
      Cc: Jonas Karlman <jonas@kwiboo.se>
      Cc: Jernej Skrabec <jernej.skrabec@siol.net>
      Cc: Inki Dae <inki.dae@samsung.com>
      Cc: Joonyoung Shim <jy0922.shim@samsung.com>
      Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
      Cc: Kyungmin Park <kyungmin.park@samsung.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: CK Hu <ck.hu@mediatek.com>
      Cc: Philipp Zabel <p.zabel@pengutronix.de>
      Cc: Ben Skeggs <bskeggs@redhat.com>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Jerry Han <hanxu5@huaqin.corp-partner.google.com>
      Cc: Icenowy Zheng <icenowy@aosc.io>
      Cc: Jagan Teki <jagan@amarulasolutions.com>
      Cc: Stefan Mavrodiev <stefan@olimex.com>
      Cc: Robert Chiras <robert.chiras@nxp.com>
      Cc: "Guido Günther" <agx@sigxcpu.org>
      Cc: Purism Kernel Team <kernel@puri.sm>
      Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
      Cc: Vincent Abriou <vincent.abriou@st.com>
      Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
      Cc: Thomas Hellstrom <thellstrom@vmware.com>
      Cc: linux-amlogic@lists.infradead.org
      Cc: nouveau@lists.freedesktop.org
      Reviewed-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Reviewed-by: NEmil Velikov <emil.velikov@collabora.com>
      Reviewed-by: NSam Ravnborg <sam@ravnborg.org>
      Acked-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200428171940.19552-4-ville.syrjala@linux.intel.com
      0425662f
  17. 20 5月, 2020 1 次提交
  18. 29 4月, 2020 1 次提交
  19. 24 4月, 2020 1 次提交
  20. 18 3月, 2020 7 次提交
  21. 16 3月, 2020 1 次提交
    • K
      drm/edid: Distribute switch variables for initialization · deec222e
      Kees Cook 提交于
      Variables declared in a switch statement before any case statements
      cannot be automatically initialized with compiler instrumentation (as
      they are not part of any execution flow). With GCC's proposed automatic
      stack variable initialization feature, this triggers a warning (and they
      don't get initialized). Clang's automatic stack variable initialization
      (via CONFIG_INIT_STACK_ALL=y) doesn't throw a warning, but it also
      doesn't initialize such variables[1]. Note that these warnings (or silent
      skipping) happen before the dead-store elimination optimization phase,
      so even when the automatic initializations are later elided in favor of
      direct initializations, the warnings remain.
      
      To avoid these problems, lift such variables up into the next code
      block.
      
      drivers/gpu/drm/drm_edid.c: In function ‘drm_edid_to_eld’:
      drivers/gpu/drm/drm_edid.c:4395:9: warning: statement will never be
      executed [-Wswitch-unreachable]
       4395 |     int sad_count;
            |         ^~~~~~~~~
      
      [1] https://bugs.llvm.org/show_bug.cgi?id=44916
      
      v2: move into function block instead being switch-local (Ville Syrjälä)
      Signed-off-by: NKees Cook <keescook@chromium.org>
      [danvet: keep the changelog]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/202003060930.DDCCB6659@keescook
      deec222e
  22. 12 3月, 2020 1 次提交
    • M
      drm/edid: Add function to parse EDID descriptors for monitor range · a1d11d1e
      Manasi Navare 提交于
      Adaptive Sync is a VESA feature so add a DRM core helper to parse
      the EDID's detailed descritors to obtain the adaptive sync monitor range.
      Store this info as part fo drm_display_info so it can be used
      across all drivers.
      This part of the code is stripped out of amdgpu's function
      amdgpu_dm_update_freesync_caps() to make it generic and be used
      across all DRM drivers
      
      v6:
      * Call it monitor_range (Ville)
      v5:
      * Use the renamed flags
      v4:
      * Use is_display_descriptor() (Ville)
      * Name the monitor range flags (Ville)
      v3:
      * Remove the edid parsing restriction for just DP (Nicholas)
      * Use drm_for_each_detailed_block (Ville)
      * Make the drm_get_adaptive_sync_range function static (Harry, Jani)
      v2:
      * Change vmin and vmax to use u8 (Ville)
      * Dont store pixel clock since that is just a max dotclock
      and not related to VRR mode (Manasi)
      
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Harry Wentland <harry.wentland@amd.com>
      Cc: Clinton A Taylor <clinton.a.taylor@intel.com>
      Cc: Kazlauskas Nicholas <Nicholas.Kazlauskas@amd.com>
      Signed-off-by: NManasi Navare <manasi.d.navare@intel.com>
      Reviewed-by: NNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20200310231651.13841-2-manasi.d.navare@intel.com
      a1d11d1e
  23. 26 2月, 2020 2 次提交
  24. 15 2月, 2020 3 次提交