Jani Nikula
f6e8dc9edf
drm: include drm_print.h where needed
...
There are a gazillion files that depend on drm_print.h being indirectly
included via drm_buddy.h, drm_mm.h, or ttm/ttm_resource.h. In
preparation for removing those includes, explicitly include drm_print.h
where needed.
Cc: Thomas Zimmermann <tzimmermann@suse.de >
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de >
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
Link: https://lore.kernel.org/r/5fe67395907be33eb5199ea6d540e29fddee71c8.1761734313.git.jani.nikula@intel.com
2025-10-31 10:34:52 +02:00
Jani Nikula
f985e105ce
drm/i915/display: add intel_display_device_present()
...
Add a proper function for display && HAS_DISPLAY(display) to hide
indirect struct intel_display access via the macro from a number of
places outside of display. This makes struct intel_display * an opaque
pointer in these places. All HAS_DISPLAY() usage is now constrained
within display.
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Link: https://lore.kernel.org/r/20250903090408.3492875-1-jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
2025-09-09 09:32:01 +03:00
Jani Nikula
1d409b0a77
drm/i915/switcheroo: check for NULL before dereferencing
...
Both i915_switcheroo_set_state() and i915_switcheroo_can_switch() check
for i915 == NULL. Commit d2e184f8e1 ("drm/i915/switcheroo: pass
display to HAS_DISPLAY()") started dereferencing it before the NULL
check. Fix it.
Fixes: d2e184f8e1 ("drm/i915/switcheroo: pass display to HAS_DISPLAY()")
Reported-by: kernel test robot <lkp@intel.com >
Reported-by: Dan Carpenter <dan.carpenter@linaro.org >
Closes: https://lore.kernel.org/r/202508160035.hmzuKiww-lkp@intel.com/
Cc: Gustavo Sousa <gustavo.sousa@intel.com >
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com >
Link: https://lore.kernel.org/r/20250818071605.2541523-1-jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
2025-08-19 11:17:52 +03:00
Jani Nikula
d2e184f8e1
drm/i915/switcheroo: pass display to HAS_DISPLAY()
...
Underneath, HAS_DISPLAY() really expects a struct intel_display. Switch
to it in preparation for removing the transitional __to_intel_display()
macro.
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com >
Link: https://lore.kernel.org/r/c9828991eb8870c45271141bf0912880a3a65c44.1754499175.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
2025-08-14 13:12:23 +03:00
Jani Nikula
62384da2a0
drm/i915: stop including display/intel_display_{core, limits}.h from i915_drv.h
...
Make i915->display pointer opaque to most of core i915 driver. Lots of
places now need explicit include of intel_display_core.h, or a more
specific header.
With this dependency broken, changes in display should cause radically
less recompilation of i915.
Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com >
Link: https://lore.kernel.org/r/b381b59acb7e4f600e0282935a68aedf77768109.1747907216.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
2025-05-27 11:25:53 +03:00
Thomas Zimmermann
a273e95721
drm/i915: Allow switching away via vga-switcheroo if uninitialized
...
Always allow switching away via vga-switcheroo if the display is
uninitalized. Instead prevent switching to i915 if the device has
not been initialized.
This issue was introduced by commit 5df7bd1308 ("drm/i915: skip
display initialization when there is no display") protected, which
protects code paths from being executed on uninitialized devices.
In the case of vga-switcheroo, we want to allow a switch away from
i915's device. So run vga_switcheroo_process_delayed_switch() and
test in the switcheroo callbacks if the i915 device is available.
Fixes: 5df7bd1308 ("drm/i915: skip display initialization when there is no display")
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Cc: Radhakrishna Sripada <radhakrishna.sripada@intel.com >
Cc: Lucas De Marchi <lucas.demarchi@intel.com >
Cc: José Roberto de Souza <jose.souza@intel.com >
Cc: Jani Nikula <jani.nikula@intel.com >
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com >
Cc: Jani Nikula <jani.nikula@linux.intel.com >
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com >
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com >
Cc: "Ville Syrjälä" <ville.syrjala@linux.intel.com >
Cc: Manasi Navare <manasi.d.navare@intel.com >
Cc: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com >
Cc: Imre Deak <imre.deak@intel.com >
Cc: "Jouni Högander" <jouni.hogander@intel.com >
Cc: Uma Shankar <uma.shankar@intel.com >
Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com >
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com >
Cc: Matt Roper <matthew.d.roper@intel.com >
Cc: Ramalingam C <ramalingam.c@intel.com >
Cc: Thomas Zimmermann <tzimmermann@suse.de >
Cc: Andi Shyti <andi.shyti@linux.intel.com >
Cc: Andrzej Hajda <andrzej.hajda@intel.com >
Cc: "José Roberto de Souza" <jose.souza@intel.com >
Cc: Julia Lawall <Julia.Lawall@inria.fr >
Cc: intel-gfx@lists.freedesktop.org
Cc: <stable@vger.kernel.org > # v5.14+
Link: https://patchwork.freedesktop.org/patch/msgid/20230116115425.13484-2-tzimmermann@suse.de
2023-01-18 17:12:23 +01:00
Jani Nikula
b8d65b8a5a
drm/i915/driver: add i915_driver_ prefix to functions
...
Add the i915_driver_ prefix to the switcheroo functions in
i915_driver.[ch].
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: https://patchwork.freedesktop.org/patch/msgid/20211111101304.13094-3-jani.nikula@intel.com
2021-11-17 11:47:55 +02:00
Jani Nikula
58471f6384
drm/i915/driver: rename i915_drv.c to i915_driver.c
...
This is more about trimming i915_drv.h than the renamed
i915_driver.[ch]. Split out i915_driver.[ch] out of i915_drv.h as a
feasible thing to do.
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: https://patchwork.freedesktop.org/patch/msgid/20211111101304.13094-1-jani.nikula@intel.com
2021-11-17 11:46:58 +02:00
Thomas Zimmermann
8ff5446a7c
drm/i915: Remove references to struct drm_device.pdev
...
Using struct drm_device.pdev is deprecated. Convert i915 to struct
drm_device.dev. No functional changes.
v6:
* also remove assignment in selftests/ in a later patch (Chris)
v5:
* remove assignment in later patch (Chris)
v3:
* rebased
v2:
* move gt/ and gvt/ changes into separate patches
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de >
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk >
Cc: Jani Nikula <jani.nikula@linux.intel.com >
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com >
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com >
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20210128133127.2311-2-tzimmermann@suse.de
2021-02-02 13:58:42 +02:00
Jani Nikula
f54efb6ad0
drm/i915/switcheroo: use struct drm_device based logging
...
Convert all the pr_* logging macros to the struct drm_device based
macros to provide device specific logging.
No functional changes.
Cc: Wambui Karuga <wambui.karugax@gmail.com >
Reviewed-by: Wambui Karuga <wambui.karugax@gmail.com >
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200402114819.17232-9-jani.nikula@intel.com
2020-04-08 13:49:35 +03:00
Chris Wilson
7e13ad8964
drm: Avoid drm_global_mutex for simple inc/dec of dev->open_count
...
Since drm_global_mutex is a true global mutex across devices, we don't
want to acquire it unless absolutely necessary. For maintaining the
device local open_count, we can use atomic operations on the counter
itself, except when making the transition to/from 0. Here, we tackle the
easy portion of delaying acquiring the drm_global_mutex for the final
release by using atomic_dec_and_mutex_lock(), leaving the global
serialisation across the device opens.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk >
Cc: Thomas Hellström (VMware) <thomas_os@shipmail.org >
Reviewed-by: Thomas Hellström <thellstrom@vmware.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200124130107.125404-1-chris@chris-wilson.co.uk
2020-01-24 17:41:34 +00:00
Jani Nikula
63bf8301aa
drm/i915: split out i915_switcheroo.[ch] from i915_drv.c
...
Split out code related to vga switcheroo register/unregister and state
handling from i915_drv.c into new i915_switcheroo.[ch] files.
It's a bit difficult to draw the line how much to move to the new file
from i915_drv.c, but it seemed to me keeping i915_suspend_switcheroo()
and i915_resume_switcheroo() in place was the cleanest.
No functional changes.
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com >
Cc: Chris Wilson <chris@chris-wilson.co.uk >
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com >
Signed-off-by: Jani Nikula <jani.nikula@intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20191004122019.12009-2-jani.nikula@intel.com
2019-10-06 11:25:00 +03:00