diff options
author | Dave Airlie <airlied@redhat.com> | 2023-03-14 05:17:27 +0300 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2023-03-14 05:18:54 +0300 |
commit | faf0d83e103e38e8bf7cc4e56da1a2edb9dfdf74 (patch) | |
tree | 5b0b838b0a7ac085d408e68207fe2748e2360357 /drivers/video/cmdline.c | |
parent | eeac8ede17557680855031c6f305ece2378af326 (diff) | |
parent | 9228742caf899fa72230dd8da19ca4c7528badb8 (diff) | |
download | linux-faf0d83e103e38e8bf7cc4e56da1a2edb9dfdf74.tar.xz |
Merge tag 'drm-misc-next-2023-03-07' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
drm-misc-next for v6.4-rc1:
Note: Only changes since pull request from 2023-02-23 are included here.
UAPI Changes:
- Convert rockchip bindings to YAML.
- Constify kobj_type structure in dma-buf.
- FBDEV cmdline parser fixes, and other small fbdev fixes for mode
parsing.
Cross-subsystem Changes:
- Add Neil Armstrong as linaro maintainer.
- Actually signal the private stub dma-fence.
Core Changes:
- Add function for adding syncobj dep to sched_job and use it in panfrost, v3d.
- Improve DisplayID 2.0 topology parsing and EDID parsing in general.
- Add a gem eviction function and callback for generic GEM shrinker
purposes.
- Prepare to convert shmem helper to use the GEM reservation lock instead of own
locking. (Actual commit itself got reverted for now)
- Move the suballocator from radeon and amdgpu drivers to core in preparation
for Xe.
- Assorted small fixes and documentation.
- Fixes to HPD polling.
- Assorted small fixes in simpledrm, bridge, accel, shmem-helper,
and the selftest of format-helper.
- Remove dummy resource when ttm bo is created, and during pipelined
gutting. Fix all drivers to accept a NULL ttm_bo->resource.
- Handle pinned BO moving prevention in ttm core.
- Set drm panel-bridge orientation before connector is registered.
- Remove dumb_destroy callback.
- Add documentation to GEM_CLOSE, PRIME_HANDLE_TO_FD, PRIME_FD_TO_HANDLE, GETFB2 ioctl's.
- Add atomic enable_plane callback, use it in ast, mgag200, tidss.
Driver Changes:
- Use drm_gem_objects_lookup in vc4.
- Assorted small fixes to virtio, ast, bridge/tc358762, meson, nouveau.
- Allow virtio KMS to be disabled and compiled out.
- Add Radxa 8/10HD, Samsung AMS495QA01 panels.
- Fix ivpu compiler errors.
- Assorted fixes to drm/panel, malidp, rockchip, ivpu, amdgpu, vgem,
nouveau, vc4.
- Assorted cleanups, simplifications and fixes to vmwgfx.
Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/ac1f5186-54bb-02f4-ac56-907f5b76f3de@linux.intel.com
Diffstat (limited to 'drivers/video/cmdline.c')
-rw-r--r-- | drivers/video/cmdline.c | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/drivers/video/cmdline.c b/drivers/video/cmdline.c new file mode 100644 index 000000000000..d3d257489c3d --- /dev/null +++ b/drivers/video/cmdline.c @@ -0,0 +1,133 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Based on the fbdev code in drivers/video/fbdev/core/fb_cmdline: + * + * Copyright (C) 2014 Intel Corp + * Copyright (C) 1994 Martin Schaller + * + * 2001 - Documented with DocBook + * - Brad Douglas <brad@neruo.com> + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file COPYING in the main directory of this archive + * for more details. + * + * Authors: + * Daniel Vetter <daniel.vetter@ffwll.ch> + */ + +#include <linux/fb.h> /* for FB_MAX */ +#include <linux/init.h> + +#include <video/cmdline.h> + +/* + * FB_MAX is the maximum number of framebuffer devices and also + * the maximum number of video= parameters. Although not directly + * related to each other, it makes sense to keep it that way. + */ +static const char *video_options[FB_MAX] __read_mostly; +static const char *video_option __read_mostly; +static int video_of_only __read_mostly; + +static const char *__video_get_option_string(const char *name) +{ + const char *options = NULL; + size_t name_len = 0; + + if (name) + name_len = strlen(name); + + if (name_len) { + unsigned int i; + const char *opt; + + for (i = 0; i < ARRAY_SIZE(video_options); ++i) { + if (!video_options[i]) + continue; + if (video_options[i][0] == '\0') + continue; + opt = video_options[i]; + if (!strncmp(opt, name, name_len) && opt[name_len] == ':') + options = opt + name_len + 1; + } + } + + /* No match, return global options */ + if (!options) + options = video_option; + + return options; +} + +/** + * video_get_options - get kernel boot parameters + * @name: name of the output as it would appear in the boot parameter + * line (video=<name>:<options>) + * + * Looks up the video= options for the given name. Names are connector + * names with DRM, or driver names with fbdev. If no video option for + * the name has been specified, the function returns the global video= + * setting. A @name of NULL always returns the global video setting. + * + * Returns: + * The string of video options for the given name, or NULL if no video + * option has been specified. + */ +const char *video_get_options(const char *name) +{ + return __video_get_option_string(name); +} +EXPORT_SYMBOL(video_get_options); + +bool __video_get_options(const char *name, const char **options, bool is_of) +{ + bool enabled = true; + const char *opt = NULL; + + if (video_of_only && !is_of) + enabled = false; + + opt = __video_get_option_string(name); + + if (options) + *options = opt; + + return enabled; +} +EXPORT_SYMBOL(__video_get_options); + +/* + * Process command line options for video adapters. This function is + * a __setup and __init function. It only stores the options. Drivers + * have to call video_get_options() as necessary. + */ +static int __init video_setup(char *options) +{ + if (!options || !*options) + goto out; + + if (!strncmp(options, "ofonly", 6)) { + video_of_only = true; + goto out; + } + + if (strchr(options, ':')) { + /* named */ + size_t i; + + for (i = 0; i < ARRAY_SIZE(video_options); i++) { + if (!video_options[i]) { + video_options[i] = options; + break; + } + } + } else { + /* global */ + video_option = options; + } + +out: + return 1; +} +__setup("video=", video_setup); |