Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2/drm Iterate over connectors differentl...
details: https://anonhg.NetBSD.org/src/rev/9f16c7d7f823
branches: trunk
changeset: 1028233:9f16c7d7f823
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 09:53:06 2021 +0000
description:
Iterate over connectors differently (i.e. in a way that compiles)
Author: Maya Rashish <maya%NetBSD.org@localhost>
diffstat:
sys/external/bsd/drm2/drm/drmfb.c | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
diffs (85 lines):
diff -r d480cdd01eb1 -r 9f16c7d7f823 sys/external/bsd/drm2/drm/drmfb.c
--- a/sys/external/bsd/drm2/drm/drmfb.c Sun Dec 19 09:52:59 2021 +0000
+++ b/sys/external/bsd/drm2/drm/drmfb.c Sun Dec 19 09:53:06 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drmfb.c,v 1.8 2020/06/27 13:41:44 jmcneill Exp $ */
+/* $NetBSD: drmfb.c,v 1.9 2021/12/19 09:53:06 riastradh Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drmfb.c,v 1.8 2020/06/27 13:41:44 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drmfb.c,v 1.9 2021/12/19 09:53:06 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "vga.h"
@@ -84,6 +84,8 @@
drmfb_attach(struct drmfb_softc *sc, const struct drmfb_attach_args *da)
{
const struct drm_fb_helper_surface_size *const sizes = da->da_fb_sizes;
+ struct drm_connector_list_iter conn_iter;
+ struct drm_connector *connector;
const prop_dictionary_t dict = device_properties(da->da_dev);
#if NVGA > 0
struct drm_device *const dev = da->da_fb_helper->dev;
@@ -92,7 +94,7 @@
struct genfb_ops genfb_ops = zero_genfb_ops;
enum { CONS_VGA, CONS_GENFB, CONS_NONE } what_was_cons;
bool is_console;
- int error, n;
+ int error;
/* genfb requires this. */
KASSERTMSG((void *)&sc->sc_genfb == device_private(da->da_dev),
@@ -136,9 +138,8 @@
}
/* Make the first EDID we find available to wsfb */
- for (n = 0; n < da->da_fb_helper->connector_count; n++) {
- struct drm_connector *connector =
- da->da_fb_helper->connector_info[n]->connector;
+ drm_connector_list_iter_begin(da->da_fb_helper->dev, &conn_iter);
+ drm_client_for_each_connector_iter(connector, &conn_iter) {
struct drm_property_blob *edid = connector->edid_blob_ptr;
if (edid && edid->length) {
prop_dictionary_set_data(dict, "EDID", edid->data,
@@ -146,6 +147,7 @@
break;
}
}
+ drm_connector_list_iter_end(&conn_iter);
sc->sc_genfb.sc_dev = sc->sc_da.da_dev;
genfb_init(&sc->sc_genfb);
@@ -194,6 +196,8 @@
struct genfb_softc *const genfb = v;
struct drmfb_softc *const sc = container_of(genfb, struct drmfb_softc,
sc_genfb);
+ struct drm_connector_list_iter conn_iter;
+ struct drm_connector *connector;
int error;
if (sc->sc_da.da_params->dp_ioctl) {
@@ -224,16 +228,15 @@
const int dpms_mode = on? DRM_MODE_DPMS_ON : DRM_MODE_DPMS_OFF;
struct drm_fb_helper *const fb_helper = sc->sc_da.da_fb_helper;
struct drm_device *const dev = fb_helper->dev;
- unsigned i;
drm_modeset_lock_all(dev);
- for (i = 0; i < fb_helper->connector_count; i++) {
- struct drm_connector *const connector =
- fb_helper->connector_info[i]->connector;
+ drm_connector_list_iter_begin(fb_helper->dev, &conn_iter);
+ drm_client_for_each_connector_iter(connector, &conn_iter) {
(*connector->funcs->dpms)(connector, dpms_mode);
drm_object_property_set_value(&connector->base,
dev->mode_config.dpms_property, dpms_mode);
}
+ drm_connector_list_iter_end(&conn_iter);
drm_modeset_unlock_all(dev);
return 0;
Home |
Main Index |
Thread Index |
Old Index