Re: [Intel-gfx] [PATCH] drm/ttm: Fix ttm_bo_move_memcpy() for subclassed struct ttm_resource
On Mon, 30 Aug 2021 at 17:48, Thomas Hellström wrote: > > The code was making a copy of a struct ttm_resource. However, > recently the struct ttm_resources were allowed to be subclassed and > also were allowed to be malloced, hence the driver could end up assuming > the copy we handed it was subclassed and worse, the original could have > been freed at this point. > > Fix this by using the original struct ttm_resource before it is > potentially freed in ttm_bo_move_sync_cleanup() > > Reported-by: Ben Skeggs > Reported-by: Dave Airlie > Cc: Christian König > Fixes: 3bf3710e3718 ("drm/ttm: Add a generic TTM memcpy move for page-based > iomem") > Signed-off-by: Thomas Hellström That's basically identical to what I came up with locally, so: Reviewed-by: Ben Skeggs > --- > drivers/gpu/drm/ttm/ttm_bo_util.c | 6 ++ > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c > b/drivers/gpu/drm/ttm/ttm_bo_util.c > index 5c20d0541cc3..c893c3db2623 100644 > --- a/drivers/gpu/drm/ttm/ttm_bo_util.c > +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c > @@ -139,7 +139,6 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, > struct ttm_resource *src_mem = bo->resource; > struct ttm_resource_manager *src_man = > ttm_manager_type(bdev, src_mem->mem_type); > - struct ttm_resource src_copy = *src_mem; > union { > struct ttm_kmap_iter_tt tt; > struct ttm_kmap_iter_linear_io io; > @@ -173,11 +172,10 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, > if (!(clear && ttm && !(ttm->page_flags & TTM_PAGE_FLAG_ZERO_ALLOC))) > ttm_move_memcpy(clear, dst_mem->num_pages, dst_iter, > src_iter); > > - src_copy = *src_mem; > + if (!src_iter->ops->maps_tt) > + ttm_kmap_iter_linear_io_fini(&_src_iter.io, bdev, src_mem); > ttm_bo_move_sync_cleanup(bo, dst_mem); > > - if (!src_iter->ops->maps_tt) > - ttm_kmap_iter_linear_io_fini(&_src_iter.io, bdev, _copy); > out_src_iter: > if (!dst_iter->ops->maps_tt) > ttm_kmap_iter_linear_io_fini(&_dst_iter.io, bdev, dst_mem); > -- > 2.31.1 >
Re: [Intel-gfx] [RFC 17/20] drm/nouveau/kms/nv50-: Add support for DP_SINK_COUNT
On Wed, 12 Aug 2020 at 06:06, Lyude Paul wrote: > > This is another bit that we never implemented for nouveau: dongle > detection. When a "dongle", e.g. an active display adaptor, is hooked up > to the system and causes an HPD to be fired, we don't actually know > whether or not there's anything plugged into the dongle without checking > the sink count. As a result, plugging in a dongle without anything > plugged into it currently results in a bogus EDID retrieval error in the > kernel log. > > Additionally, most dongles won't send another long HPD signal if the > user suddenly plugs something in, they'll only send a short HPD IRQ with > the expectation that the source will check the sink count and reprobe > the connector if it's changed - something we don't actually do. As a > result, nothing will happen if the user plugs the dongle in before > plugging something into the dongle. > > So, let's fix this by checking the sink count in both > nouveau_dp_probe_dpcd() and nouveau_dp_irq(), and reprobing the > connector if things change. > > Signed-off-by: Lyude Paul Reviewed-by: Ben Skeggs > --- > drivers/gpu/drm/nouveau/nouveau_dp.c | 54 --- > drivers/gpu/drm/nouveau/nouveau_encoder.h | 2 + > 2 files changed, 51 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_dp.c > b/drivers/gpu/drm/nouveau/nouveau_dp.c > index f6950a62138ca..f41fa513023fd 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_dp.c > +++ b/drivers/gpu/drm/nouveau/nouveau_dp.c > @@ -36,12 +36,22 @@ MODULE_PARM_DESC(mst, "Enable DisplayPort multi-stream > (default: enabled)"); > static int nouveau_mst = 1; > module_param_named(mst, nouveau_mst, int, 0400); > > +static bool > +nouveau_dp_has_sink_count(struct drm_connector *connector, > + struct nouveau_encoder *outp) > +{ > + return drm_dp_has_sink_count(connector, outp->dp.dpcd, > +>dp.desc); > +} > + > static enum drm_connector_status > nouveau_dp_probe_dpcd(struct nouveau_connector *nv_connector, > struct nouveau_encoder *outp) > { > + struct drm_connector *connector = _connector->base; > struct drm_dp_aux *aux = _connector->aux; > struct nv50_mstm *mstm = NULL; > + enum drm_connector_status status = connector_status_disconnected; > int ret; > u8 *dpcd = outp->dp.dpcd; > > @@ -50,9 +60,9 @@ nouveau_dp_probe_dpcd(struct nouveau_connector > *nv_connector, > ret = drm_dp_read_desc(aux, >dp.desc, >drm_dp_is_branch(dpcd)); > if (ret < 0) > - return connector_status_disconnected; > + goto out; > } else { > - return connector_status_disconnected; > + goto out; > } > > if (nouveau_mst) { > @@ -61,12 +71,33 @@ nouveau_dp_probe_dpcd(struct nouveau_connector > *nv_connector, > mstm->can_mst = drm_dp_has_mst(aux, dpcd); > } > > + if (nouveau_dp_has_sink_count(connector, outp)) { > + ret = drm_dp_get_sink_count(aux); > + if (ret < 0) > + goto out; > + > + outp->dp.sink_count = ret; > + > + /* > +* Dongle connected, but no display. Don't bother reading > +* downstream port info > +*/ > + if (!outp->dp.sink_count) > + return connector_status_disconnected; > + } > + > ret = drm_dp_downstream_read_info(aux, dpcd, > outp->dp.downstream_ports); > if (ret < 0) > - return connector_status_disconnected; > + goto out; > > - return connector_status_connected; > + status = connector_status_connected; > +out: > + if (status != connector_status_connected) { > + /* Clear any cached info */ > + outp->dp.sink_count = 0; > + } > + return status; > } > > int > @@ -161,6 +192,8 @@ void nouveau_dp_irq(struct nouveau_drm *drm, > struct drm_connector *connector = _connector->base; > struct nouveau_encoder *outp = find_encoder(connector, DCB_OUTPUT_DP); > struct nv50_mstm *mstm; > + int ret; > + bool send_hpd = false; > > if (!outp) > return; > @@ -172,12 +205,23 @@ void nouveau_dp_irq(struct nouveau_drm *drm, > > if (mstm && mstm->
Re: [Intel-gfx] [Nouveau] [RFC 20/20] drm/nouveau/kms: Start using drm_dp_read_dpcd_caps()
On Wed, 12 Aug 2020 at 06:07, Lyude Paul wrote: > > Now that we've extracted i915's code for reading both the normal DPCD > caps and extended DPCD caps into a shared helper, let's start using this > in nouveau to enable us to start checking extended DPCD caps for free. > > Signed-off-by: Lyude Paul Reviewed-by: Ben Skeggs > --- > drivers/gpu/drm/nouveau/nouveau_dp.c | 14 ++ > 1 file changed, 6 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_dp.c > b/drivers/gpu/drm/nouveau/nouveau_dp.c > index f41fa513023fd..a4e07d116972f 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_dp.c > +++ b/drivers/gpu/drm/nouveau/nouveau_dp.c > @@ -55,15 +55,13 @@ nouveau_dp_probe_dpcd(struct nouveau_connector > *nv_connector, > int ret; > u8 *dpcd = outp->dp.dpcd; > > - ret = drm_dp_dpcd_read(aux, DP_DPCD_REV, dpcd, DP_RECEIVER_CAP_SIZE); > - if (ret == DP_RECEIVER_CAP_SIZE && dpcd[DP_DPCD_REV]) { > - ret = drm_dp_read_desc(aux, >dp.desc, > - drm_dp_is_branch(dpcd)); > - if (ret < 0) > - goto out; > - } else { > + ret = drm_dp_read_dpcd_caps(aux, dpcd); > + if (ret < 0) > + goto out; > + > + ret = drm_dp_read_desc(aux, >dp.desc, drm_dp_is_branch(dpcd)); > + if (ret < 0) > goto out; > - } > > if (nouveau_mst) { > mstm = outp->dp.mstm; > -- > 2.26.2 > > ___ > Nouveau mailing list > nouv...@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/nouveau ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [RFC 10/20] drm/nouveau/kms: Use new drm_dp_has_mst() helper for checking MST caps
On Wed, 12 Aug 2020 at 06:06, Lyude Paul wrote: > > Signed-off-by: Lyude Paul Reviewed-by: Ben Skeggs > --- > drivers/gpu/drm/nouveau/nouveau_dp.c | 16 +++- > 1 file changed, 3 insertions(+), 13 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_dp.c > b/drivers/gpu/drm/nouveau/nouveau_dp.c > index d701f09aea645..bb85d81c25244 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_dp.c > +++ b/drivers/gpu/drm/nouveau/nouveau_dp.c > @@ -44,7 +44,6 @@ nouveau_dp_probe_dpcd(struct nouveau_connector > *nv_connector, > struct nv50_mstm *mstm = NULL; > int ret; > u8 *dpcd = outp->dp.dpcd; > - u8 tmp; > > ret = drm_dp_dpcd_read(aux, DP_DPCD_REV, dpcd, DP_RECEIVER_CAP_SIZE); > if (ret == DP_RECEIVER_CAP_SIZE && dpcd[DP_DPCD_REV]) { > @@ -56,19 +55,10 @@ nouveau_dp_probe_dpcd(struct nouveau_connector > *nv_connector, > return connector_status_disconnected; > } > > - if (nouveau_mst) > + if (nouveau_mst) { > mstm = outp->dp.mstm; > - > - if (mstm) { > - if (dpcd[DP_DPCD_REV] >= DP_DPCD_REV_12) { > - ret = drm_dp_dpcd_readb(aux, DP_MSTM_CAP, ); > - if (ret < 0) > - return connector_status_disconnected; > - > - mstm->can_mst = !!(tmp & DP_MST_CAP); > - } else { > - mstm->can_mst = false; > - } > + if (mstm) > + mstm->can_mst = drm_dp_has_mst(aux, dpcd); > } > > return connector_status_connected; > -- > 2.26.2 > > ___ > dri-devel mailing list > dri-de...@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [RFC 01/20] drm/nouveau/kms: Fix some indenting in nouveau_dp_detect()
On Wed, 12 Aug 2020 at 06:05, Lyude Paul wrote: > > Signed-off-by: Lyude Paul Reviewed-by: Ben Skeggs > --- > drivers/gpu/drm/nouveau/nouveau_dp.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_dp.c > b/drivers/gpu/drm/nouveau/nouveau_dp.c > index 8a0f7994e1aeb..ee778ddc95fae 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_dp.c > +++ b/drivers/gpu/drm/nouveau/nouveau_dp.c > @@ -76,10 +76,10 @@ nouveau_dp_detect(struct nouveau_encoder *nv_encoder) > nv_encoder->dp.link_nr = dpcd[2] & DP_MAX_LANE_COUNT_MASK; > > NV_DEBUG(drm, "display: %dx%d dpcd 0x%02x\n", > -nv_encoder->dp.link_nr, nv_encoder->dp.link_bw, dpcd[0]); > +nv_encoder->dp.link_nr, nv_encoder->dp.link_bw, dpcd[0]); > NV_DEBUG(drm, "encoder: %dx%d\n", > -nv_encoder->dcb->dpconf.link_nr, > -nv_encoder->dcb->dpconf.link_bw); > +nv_encoder->dcb->dpconf.link_nr, > +nv_encoder->dcb->dpconf.link_bw); > > if (nv_encoder->dcb->dpconf.link_nr < nv_encoder->dp.link_nr) > nv_encoder->dp.link_nr = nv_encoder->dcb->dpconf.link_nr; > @@ -87,7 +87,7 @@ nouveau_dp_detect(struct nouveau_encoder *nv_encoder) > nv_encoder->dp.link_bw = nv_encoder->dcb->dpconf.link_bw; > > NV_DEBUG(drm, "maximum: %dx%d\n", > -nv_encoder->dp.link_nr, nv_encoder->dp.link_bw); > +nv_encoder->dp.link_nr, nv_encoder->dp.link_bw); > > nouveau_dp_probe_oui(dev, aux, dpcd); > > -- > 2.26.2 > > ___ > dri-devel mailing list > dri-de...@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH v4 09/22] drm/nouveau: Convert to CRTC VBLANK callbacks
On Fri, 24 Jan 2020 at 00:00, Thomas Zimmermann wrote: > > VBLANK callbacks in struct drm_driver are deprecated in favor of > their equivalents in struct drm_crtc_funcs. Convert nouvean over. > > v4: > * add argument names in function declaration > > Signed-off-by: Thomas Zimmermann Reviewed-by: Ben Skeggs > --- > drivers/gpu/drm/nouveau/dispnv04/crtc.c | 3 +++ > drivers/gpu/drm/nouveau/dispnv50/head.c | 4 > drivers/gpu/drm/nouveau/nouveau_display.c | 14 ++ > drivers/gpu/drm/nouveau/nouveau_display.h | 4 ++-- > drivers/gpu/drm/nouveau/nouveau_drm.c | 4 > 5 files changed, 11 insertions(+), 18 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c > b/drivers/gpu/drm/nouveau/dispnv04/crtc.c > index 17e9d1c078a0..1f08de4241e0 100644 > --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c > +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c > @@ -1248,6 +1248,9 @@ static const struct drm_crtc_funcs nv04_crtc_funcs = { > .set_config = drm_crtc_helper_set_config, > .page_flip = nv04_crtc_page_flip, > .destroy = nv_crtc_destroy, > + .enable_vblank = nouveau_display_vblank_enable, > + .disable_vblank = nouveau_display_vblank_disable, > + .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp, > }; > > static const struct drm_crtc_helper_funcs nv04_crtc_helper_funcs = { > diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c > b/drivers/gpu/drm/nouveau/dispnv50/head.c > index 41852dd8fdbd..8f6455697ba7 100644 > --- a/drivers/gpu/drm/nouveau/dispnv50/head.c > +++ b/drivers/gpu/drm/nouveau/dispnv50/head.c > @@ -29,6 +29,7 @@ > > #include > #include > +#include > #include "nouveau_connector.h" > void > nv50_head_flush_clr(struct nv50_head *head, > @@ -482,6 +483,9 @@ nv50_head_func = { > .page_flip = drm_atomic_helper_page_flip, > .atomic_duplicate_state = nv50_head_atomic_duplicate_state, > .atomic_destroy_state = nv50_head_atomic_destroy_state, > + .enable_vblank = nouveau_display_vblank_enable, > + .disable_vblank = nouveau_display_vblank_disable, > + .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp, > }; > > struct nv50_head * > diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c > b/drivers/gpu/drm/nouveau/nouveau_display.c > index 86f99dc8fcef..700817dc4fa0 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_display.c > +++ b/drivers/gpu/drm/nouveau/nouveau_display.c > @@ -54,15 +54,10 @@ nouveau_display_vblank_handler(struct nvif_notify *notify) > } > > int > -nouveau_display_vblank_enable(struct drm_device *dev, unsigned int pipe) > +nouveau_display_vblank_enable(struct drm_crtc *crtc) > { > - struct drm_crtc *crtc; > struct nouveau_crtc *nv_crtc; > > - crtc = drm_crtc_from_index(dev, pipe); > - if (!crtc) > - return -EINVAL; > - > nv_crtc = nouveau_crtc(crtc); > nvif_notify_get(_crtc->vblank); > > @@ -70,15 +65,10 @@ nouveau_display_vblank_enable(struct drm_device *dev, > unsigned int pipe) > } > > void > -nouveau_display_vblank_disable(struct drm_device *dev, unsigned int pipe) > +nouveau_display_vblank_disable(struct drm_crtc *crtc) > { > - struct drm_crtc *crtc; > struct nouveau_crtc *nv_crtc; > > - crtc = drm_crtc_from_index(dev, pipe); > - if (!crtc) > - return; > - > nv_crtc = nouveau_crtc(crtc); > nvif_notify_put(_crtc->vblank); > } > diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h > b/drivers/gpu/drm/nouveau/nouveau_display.h > index 26d34f1a77da..de004018ab5c 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_display.h > +++ b/drivers/gpu/drm/nouveau/nouveau_display.h > @@ -61,8 +61,8 @@ int nouveau_display_init(struct drm_device *dev, bool > resume, bool runtime); > void nouveau_display_fini(struct drm_device *dev, bool suspend, bool > runtime); > int nouveau_display_suspend(struct drm_device *dev, bool runtime); > void nouveau_display_resume(struct drm_device *dev, bool runtime); > -int nouveau_display_vblank_enable(struct drm_device *, unsigned int); > -void nouveau_display_vblank_disable(struct drm_device *, unsigned int); > +int nouveau_display_vblank_enable(struct drm_crtc *crtc); > +void nouveau_display_vblank_disable(struct drm_crtc *crtc); > bool nouveau_display_scanoutpos(struct drm_crtc *crtc, > bool in_vblank_irq, int *vpos, int *hpos, > ktime_t *stime, ktime_t *etime, > diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c > b/drivers/gpu/drm/nouveau/nouveau_drm
Re: [Intel-gfx] [PATCH v4 08/22] drm/nouveau: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
On Fri, 24 Jan 2020 at 00:00, Thomas Zimmermann wrote: > > The callback struct drm_driver.get_scanout_position() is deprecated in > favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert > nouveau over. > > v4: > * add argument names in function declaration > > Signed-off-by: Thomas Zimmermann Reviewed-by: Ben Skeggs > --- > drivers/gpu/drm/nouveau/dispnv04/crtc.c | 1 + > drivers/gpu/drm/nouveau/dispnv50/head.c | 1 + > drivers/gpu/drm/nouveau/nouveau_display.c | 14 +++--- > drivers/gpu/drm/nouveau/nouveau_display.h | 7 --- > drivers/gpu/drm/nouveau/nouveau_drm.c | 1 - > 5 files changed, 9 insertions(+), 15 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c > b/drivers/gpu/drm/nouveau/dispnv04/crtc.c > index 37c50ea8f847..17e9d1c078a0 100644 > --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c > +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c > @@ -1258,6 +1258,7 @@ static const struct drm_crtc_helper_funcs > nv04_crtc_helper_funcs = { > .mode_set_base = nv04_crtc_mode_set_base, > .mode_set_base_atomic = nv04_crtc_mode_set_base_atomic, > .disable = nv_crtc_disable, > + .get_scanout_position = nouveau_display_scanoutpos, > }; > > static const uint32_t modeset_formats[] = { > diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.c > b/drivers/gpu/drm/nouveau/dispnv50/head.c > index d9d64602947d..41852dd8fdbd 100644 > --- a/drivers/gpu/drm/nouveau/dispnv50/head.c > +++ b/drivers/gpu/drm/nouveau/dispnv50/head.c > @@ -413,6 +413,7 @@ nv50_head_atomic_check(struct drm_crtc *crtc, struct > drm_crtc_state *state) > static const struct drm_crtc_helper_funcs > nv50_head_help = { > .atomic_check = nv50_head_atomic_check, > + .get_scanout_position = nouveau_display_scanoutpos, > }; > > static void > diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c > b/drivers/gpu/drm/nouveau/nouveau_display.c > index 53f9bceaf17a..86f99dc8fcef 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_display.c > +++ b/drivers/gpu/drm/nouveau/nouveau_display.c > @@ -136,21 +136,13 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, > int *vpos, int *hpos, > } > > bool > -nouveau_display_scanoutpos(struct drm_device *dev, unsigned int pipe, > +nouveau_display_scanoutpos(struct drm_crtc *crtc, >bool in_vblank_irq, int *vpos, int *hpos, >ktime_t *stime, ktime_t *etime, >const struct drm_display_mode *mode) > { > - struct drm_crtc *crtc; > - > - list_for_each_entry(crtc, >mode_config.crtc_list, head) { > - if (nouveau_crtc(crtc)->index == pipe) { > - return nouveau_display_scanoutpos_head(crtc, vpos, > hpos, > - stime, etime); > - } > - } > - > - return false; > + return nouveau_display_scanoutpos_head(crtc, vpos, hpos, > + stime, etime); > } > > static void > diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h > b/drivers/gpu/drm/nouveau/nouveau_display.h > index 6e8e66882e45..26d34f1a77da 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_display.h > +++ b/drivers/gpu/drm/nouveau/nouveau_display.h > @@ -63,9 +63,10 @@ int nouveau_display_suspend(struct drm_device *dev, bool > runtime); > void nouveau_display_resume(struct drm_device *dev, bool runtime); > int nouveau_display_vblank_enable(struct drm_device *, unsigned int); > void nouveau_display_vblank_disable(struct drm_device *, unsigned int); > -bool nouveau_display_scanoutpos(struct drm_device *, unsigned int, > -bool, int *, int *, ktime_t *, > -ktime_t *, const struct drm_display_mode *); > +bool nouveau_display_scanoutpos(struct drm_crtc *crtc, > + bool in_vblank_irq, int *vpos, int *hpos, > + ktime_t *stime, ktime_t *etime, > + const struct drm_display_mode *mode); > > int nouveau_display_dumb_create(struct drm_file *, struct drm_device *, > struct drm_mode_create_dumb *args); > diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c > b/drivers/gpu/drm/nouveau/nouveau_drm.c > index b65ae817eabf..fcc036a08965 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_drm.c > +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c > @@ -1122,7 +1122,6 @@ driver_stub = { > > .enable_vblank = nouveau_display_vblank_enable, > .disable_vblank = nouveau_display_vblank_disable, > -
Re: [Intel-gfx] [Nouveau] [PATCH v6 08/17] drm/ttm: use gem vma_node
On Wed, 11 Sep 2019 at 07:53, Thierry Reding wrote: > > On Sat, Sep 07, 2019 at 09:58:46PM -0400, Ilia Mirkin wrote: > > On Wed, Aug 21, 2019 at 7:55 AM Thierry Reding > > wrote: > > > > > > On Wed, Aug 21, 2019 at 04:33:58PM +1000, Ben Skeggs wrote: > > > > On Wed, 14 Aug 2019 at 20:14, Gerd Hoffmann wrote: > > > > > > > > > > Hi, > > > > > > > > > > > > Changing the order doesn't look hard. Patch attached (untested, > > > > > > > have no > > > > > > > test hardware). But maybe I missed some detail ... > > > > > > > > > > > > I came up with something very similar by splitting up > > > > > > nouveau_bo_new() > > > > > > into allocation and initialization steps, so that when necessary > > > > > > the GEM > > > > > > object can be initialized in between. I think that's slightly more > > > > > > flexible and easier to understand than a boolean flag. > > > > > > > > > > Yes, that should work too. > > > > > > > > > > Acked-by: Gerd Hoffmann > > > > Acked-by: Ben Skeggs > > > > > > Thanks guys, applied to drm-misc-next. > > > > Hi Thierry, > > > > Initial investigations suggest that this commit currently in drm-next > > > > commit 019cbd4a4feb3aa3a917d78e7110e3011bbff6d5 > > Author: Thierry Reding > > Date: Wed Aug 14 11:00:48 2019 +0200 > > > > drm/nouveau: Initialize GEM object before TTM object > > > > breaks nouveau userspace which tries to allocate GEM objects with a > > non-page-aligned size. Previously nouveau_gem_new would just call > > nouveau_bo_init which would call nouveau_bo_fixup_align before > > initializing the GEM object. With this change, it is done after. What > > do you think -- OK to just move that bit of logic into the new > > nouveau_bo_alloc() (and make size/align be pointers so that they can > > be fixed up?) > > Hi Ilia, > > sorry, got side-tracked earlier and forgot to send this out. I'll turn > this into a proper patch, but if you manage to find the time to test > this while I work out the userspace issues that are preventing me from > testing this more thoroughly, that'd be great. I can confirm both I can reproduce the bug, and that the fix here appears to do the trick nicely. Ben. > > Thierry > > --- >8 --- > diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c > b/drivers/gpu/drm/nouveau/nouveau_bo.c > index e918b437af17..7d5ede756711 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_bo.c > +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c > @@ -186,8 +186,8 @@ nouveau_bo_fixup_align(struct nouveau_bo *nvbo, u32 flags, > } > > struct nouveau_bo * > -nouveau_bo_alloc(struct nouveau_cli *cli, u64 size, u32 flags, u32 tile_mode, > -u32 tile_flags) > +nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 flags, > +u32 tile_mode, u32 tile_flags) > { > struct nouveau_drm *drm = cli->drm; > struct nouveau_bo *nvbo; > @@ -195,8 +195,8 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 size, u32 > flags, u32 tile_mode, > struct nvif_vmm *vmm = cli->svm.cli ? >svm.vmm : >vmm.vmm; > int i, pi = -1; > > - if (!size) { > - NV_WARN(drm, "skipped size %016llx\n", size); > + if (!*size) { > + NV_WARN(drm, "skipped size %016llx\n", *size); > return ERR_PTR(-EINVAL); > } > > @@ -266,7 +266,7 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 size, u32 > flags, u32 tile_mode, > pi = i; > > /* Stop once the buffer is larger than the current page size. > */ > - if (size >= 1ULL << vmm->page[i].shift) > + if (*size >= 1ULL << vmm->page[i].shift) > break; > } > > @@ -281,6 +281,8 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 size, u32 > flags, u32 tile_mode, > } > nvbo->page = vmm->page[pi].shift; > > + nouveau_bo_fixup_align(nvbo, flags, align, size); > + > return nvbo; > } > > @@ -292,12 +294,11 @@ nouveau_bo_init(struct nouveau_bo *nvbo, u64 size, int > align, u32 flags, > size_t acc_size; > int ret; > > - acc_size = ttm_bo_dma_acc_size(nvbo->bo.bdev, size, sizeof(*nvbo)); > - > - nouveau_bo_fixup_align(nvbo, flags, , ); > nvbo->bo.me
Re: [Intel-gfx] [PATCH v7 1/9] drm_dp_cec: add connector info support.
On Fri, Aug 16, 2019 at 4:10 AM Lyude Paul wrote: > > Reviewed-by: Lyude Paul Reviewed-by: Ben Skeggs > > On Wed, 2019-08-14 at 12:44 +0200, Dariusz Marcinkiewicz wrote: > > Pass the connector info to the CEC adapter. This makes it possible > > to associate the CEC adapter with the corresponding drm connector. > > > > Signed-off-by: Dariusz Marcinkiewicz > > Signed-off-by: Hans Verkuil > > Tested-by: Hans Verkuil > > --- > > .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 +- > > drivers/gpu/drm/drm_dp_cec.c | 25 --- > > drivers/gpu/drm/i915/display/intel_dp.c | 4 +-- > > drivers/gpu/drm/nouveau/nouveau_connector.c | 3 +-- > > include/drm/drm_dp_helper.h | 17 ++--- > > 5 files changed, 27 insertions(+), 24 deletions(-) > > > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c > > b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c > > index 16218a202b591..5ec14efd4d8cb 100644 > > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c > > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c > > @@ -416,7 +416,7 @@ void amdgpu_dm_initialize_dp_connector(struct > > amdgpu_display_manager *dm, > > > > drm_dp_aux_register(>dm_dp_aux.aux); > > drm_dp_cec_register_connector(>dm_dp_aux.aux, > > - aconnector->base.name, dm->adev->dev); > > + >base); > > aconnector->mst_mgr.cbs = _mst_cbs; > > drm_dp_mst_topology_mgr_init( > > >mst_mgr, > > diff --git a/drivers/gpu/drm/drm_dp_cec.c b/drivers/gpu/drm/drm_dp_cec.c > > index b15cee85b702b..b457c16c3a8bb 100644 > > --- a/drivers/gpu/drm/drm_dp_cec.c > > +++ b/drivers/gpu/drm/drm_dp_cec.c > > @@ -8,7 +8,9 @@ > > #include > > #include > > #include > > +#include > > #include > > +#include > > #include > > > > /* > > @@ -295,7 +297,10 @@ static void drm_dp_cec_unregister_work(struct > > work_struct > > *work) > > */ > > void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const struct edid *edid) > > { > > - u32 cec_caps = CEC_CAP_DEFAULTS | CEC_CAP_NEEDS_HPD; > > + struct drm_connector *connector = aux->cec.connector; > > + u32 cec_caps = CEC_CAP_DEFAULTS | CEC_CAP_NEEDS_HPD | > > +CEC_CAP_CONNECTOR_INFO; > > + struct cec_connector_info conn_info; > > unsigned int num_las = 1; > > u8 cap; > > > > @@ -344,13 +349,17 @@ void drm_dp_cec_set_edid(struct drm_dp_aux *aux, const > > struct edid *edid) > > > > /* Create a new adapter */ > > aux->cec.adap = cec_allocate_adapter(_dp_cec_adap_ops, > > - aux, aux->cec.name, cec_caps, > > + aux, connector->name, cec_caps, > >num_las); > > if (IS_ERR(aux->cec.adap)) { > > aux->cec.adap = NULL; > > goto unlock; > > } > > - if (cec_register_adapter(aux->cec.adap, aux->cec.parent)) { > > + > > + cec_fill_conn_info_from_drm(_info, connector); > > + cec_s_conn_info(aux->cec.adap, _info); > > + > > + if (cec_register_adapter(aux->cec.adap, connector->dev->dev)) { > > cec_delete_adapter(aux->cec.adap); > > aux->cec.adap = NULL; > > } else { > > @@ -406,22 +415,20 @@ EXPORT_SYMBOL(drm_dp_cec_unset_edid); > > /** > > * drm_dp_cec_register_connector() - register a new connector > > * @aux: DisplayPort AUX channel > > - * @name: name of the CEC device > > - * @parent: parent device > > + * @connector: drm connector > > * > > * A new connector was registered with associated CEC adapter name and > > * CEC adapter parent device. After registering the name and parent > > * drm_dp_cec_set_edid() is called to check if the connector supports > > * CEC and to register a CEC adapter if that is the case. > > */ > > -void drm_dp_cec_register_connector(struct drm_dp_aux *aux, const char > > *name, > > -struct device *parent) > > +void drm_dp_cec_register_connector(struct drm_dp_aux *aux, > > +struct drm_connector *connector) > > { > > WARN_ON(aux->cec.adap); > >
Re: [Intel-gfx] [Nouveau] [PATCH v6 08/17] drm/ttm: use gem vma_node
On Wed, 14 Aug 2019 at 20:14, Gerd Hoffmann wrote: > > Hi, > > > > Changing the order doesn't look hard. Patch attached (untested, have no > > > test hardware). But maybe I missed some detail ... > > > > I came up with something very similar by splitting up nouveau_bo_new() > > into allocation and initialization steps, so that when necessary the GEM > > object can be initialized in between. I think that's slightly more > > flexible and easier to understand than a boolean flag. > > Yes, that should work too. > > Acked-by: Gerd Hoffmann Acked-by: Ben Skeggs > > cheers, > Gerd > > ___ > Nouveau mailing list > nouv...@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/nouveau ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [Nouveau] [PATCH v6 00/20] MST refcounting/atomic helpers cleanup
For the nouveau patches in the series: Reviewed-By: Ben Skeggs On Fri, 11 Jan 2019 at 05:59, Lyude Paul wrote: > > This is the series I've been working on for a while now to get all of > the atomic DRM drivers in the tree to use the atomic MST helpers, and to > make the atomic MST helpers actually idempotent. Turns out it's a lot > more difficult to do that without also fixing how port and branch device > refcounting works so that it actually makes sense, since the current > upstream implementation requires a ton of magic in the atomic helpers to > work around properly and in many situations just plain doesn't work as > intended. > > There's still more cleanup that can be done, but I think this is a good > place to start off for now :). > > Also available on gitlab: > > https://gitlab.freedesktop.org/lyudess/linux/commits/wip/mst-dual-kref-start-v6 > > Lyude Paul (20): > drm/dp_mst: Fix some formatting in drm_dp_add_port() > drm/dp_mst: Fix some formatting in drm_dp_payload_send_msg() > drm/dp_mst: Fix some formatting in drm_dp_mst_allocate_vcpi() > drm/dp_mst: Fix some formatting in drm_dp_mst_deallocate_vcpi() > drm/dp_mst: Rename drm_dp_mst_get_validated_(port|mstb)_ref and > friends > drm/dp_mst: Introduce new refcounting scheme for mstbs and ports > drm/dp_mst: Restart last_connected_port_and_mstb() if topology ref > fails > drm/dp_mst: Stop releasing VCPI when removing ports from topology > drm/dp_mst: Fix payload deallocation on hotplugs using malloc refs > drm/i915: Keep malloc references to MST ports > drm/amdgpu/display: Keep malloc ref to MST port > drm/nouveau: Remove bogus cleanup in nv50_mstm_add_connector() > drm/nouveau: Remove unnecessary VCPI checks in nv50_msto_cleanup() > drm/nouveau: Keep malloc references to MST ports > drm/nouveau: Stop unsetting mstc->port, use malloc refs > drm/nouveau: Grab payload lock in nv50_msto_payload() > drm/dp_mst: Add some atomic state iterator macros > drm/dp_mst: Start tracking per-port VCPI allocations > drm/dp_mst: Check payload count in drm_dp_mst_atomic_check() > drm/nouveau: Use atomic VCPI helpers for MST > > .../gpu/dp-mst/topology-figure-1.dot | 52 + > .../gpu/dp-mst/topology-figure-2.dot | 56 ++ > .../gpu/dp-mst/topology-figure-3.dot | 59 ++ > Documentation/gpu/drm-kms-helpers.rst | 26 +- > .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 11 +- > drivers/gpu/drm/drm_dp_mst_topology.c | 946 ++ > drivers/gpu/drm/i915/intel_connector.c| 4 + > drivers/gpu/drm/i915/intel_display.c | 4 + > drivers/gpu/drm/i915/intel_dp_mst.c | 55 +- > drivers/gpu/drm/nouveau/dispnv50/disp.c | 96 +- > include/drm/drm_dp_mst_helper.h | 151 ++- > 11 files changed, 1204 insertions(+), 256 deletions(-) > create mode 100644 Documentation/gpu/dp-mst/topology-figure-1.dot > create mode 100644 Documentation/gpu/dp-mst/topology-figure-2.dot > create mode 100644 Documentation/gpu/dp-mst/topology-figure-3.dot > > -- > 2.20.1 > > ___ > Nouveau mailing list > nouv...@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/nouveau ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 0/6] Remove all bad dp_mst_port uses and hide struct def
For the series: Acked-by: Ben Skeggs On Sat, 17 Nov 2018 at 10:21, Lyude Paul wrote: > > So we don't ever have to worry about drivers touching drm_dp_mst_port > structs without verifying them and crashing again. > > Lyude Paul (6): > drm/dp_mst: Add drm_dp_get_payload_info() > drm/nouveau: Use drm_dp_get_payload_info() for getting payload/vcpi > drm/nouveau: Stop reading port->mgr in nv50_mstc_get_modes() > drm/nouveau: Stop reading port->mgr in nv50_mstc_detect() > drm/dp_mst: Hide drm_dp_mst_port contents from drivers > drm/i915: Start using struct drm_dp_mst_port again > > drivers/gpu/drm/drm_dp_mst_topology.c | 115 > drivers/gpu/drm/i915/intel_dp_mst.c | 2 +- > drivers/gpu/drm/i915/intel_drv.h| 2 +- > drivers/gpu/drm/nouveau/dispnv50/disp.c | 60 + > include/drm/drm_dp_mst_helper.h | 65 ++ > 5 files changed, 146 insertions(+), 98 deletions(-) > > -- > 2.19.1 > > ___ > dri-devel mailing list > dri-de...@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel ___ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [Intel-gfx] [PATCH 2/2] drm/edid: fix Baseline_ELD_Len field in drm_edid_to_eld()
On Mon, Nov 10, 2014 at 11:39 PM, Daniel Vetter dan...@ffwll.ch wrote: Hi Ben, The below patch from Jani also touches nouveau, can you please take a look at it an ack? The core part + nouveau apply on top of drm-next, the i915 part needs stuff from my next queue. So I'd prefer if we can get this in through drm-intel-next. Hi Dave, Ack on that from your side? Cheers, Daniel On Tue, Oct 28, 2014 at 3:20 PM, Jani Nikula jani.nik...@intel.com wrote: The Baseline_ELD_Len field does not include ELD Header Block size. From High Definition Audio Specification, Revision 1.0a: The header block is a fixed size of 4 bytes. The baseline block is variable size in multiple of 4 bytes, and its size is defined in the header block Baseline_ELD_Len field (in number of DWords). Do not include the header size in Baseline_ELD_Len field. Fix all known users of eld[2]. While at it, switch to DIV_ROUND_UP instead of open coding it. Signed-off-by: Jani Nikula jani.nik...@intel.com Acked-by: Ben Skeggs bske...@redhat.com --- This is based on an audio rework series which is mid-way being merged to i915. I don't think this should be cc: stable worthy, as, AFAICT, we don't use the vendor block, and anyone reading SADs respecting SAD_Count should stop at the same offset regardless of this patch. So I propose this gets eventually merged via i915 without a rush. --- drivers/gpu/drm/drm_edid.c | 7 +-- drivers/gpu/drm/i915/intel_audio.c | 16 drivers/gpu/drm/nouveau/nv50_display.c | 3 ++- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 3bf999134bcc..45aaa6f5ef36 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -3128,9 +3128,12 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) } } eld[5] |= sad_count 4; - eld[2] = (20 + mnl + sad_count * 3 + 3) / 4; - DRM_DEBUG_KMS(ELD size %d, SAD count %d\n, (int)eld[2], sad_count); + eld[DRM_ELD_BASELINE_ELD_LEN] = + DIV_ROUND_UP(drm_eld_calc_baseline_block_size(eld), 4); + + DRM_DEBUG_KMS(ELD size %d, SAD count %d\n, + drm_eld_size(eld), sad_count); } EXPORT_SYMBOL(drm_edid_to_eld); diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c index 20af973d7cba..439fa4afa18b 100644 --- a/drivers/gpu/drm/i915/intel_audio.c +++ b/drivers/gpu/drm/i915/intel_audio.c @@ -107,7 +107,7 @@ static bool intel_eld_uptodate(struct drm_connector *connector, tmp = ~bits_elda; I915_WRITE(reg_elda, tmp); - for (i = 0; i eld[2]; i++) + for (i = 0; i drm_eld_size(eld) / 4; i++) if (I915_READ(reg_edid) != *((uint32_t *)eld + i)) return false; @@ -162,7 +162,7 @@ static void g4x_audio_codec_enable(struct drm_connector *connector, len = (tmp 9) 0x1f;/* ELD buffer size */ I915_WRITE(G4X_AUD_CNTL_ST, tmp); - len = min_t(int, eld[2], len); + len = min(drm_eld_size(eld) / 4, len); DRM_DEBUG_DRIVER(ELD size %d\n, len); for (i = 0; i len; i++) I915_WRITE(G4X_HDMIW_HDMIEDID, *((uint32_t *)eld + i)); @@ -209,7 +209,7 @@ static void hsw_audio_codec_enable(struct drm_connector *connector, int len, i; DRM_DEBUG_KMS(Enable audio codec on pipe %c, %u bytes ELD\n, - pipe_name(pipe), eld[2]); + pipe_name(pipe), drm_eld_size(eld)); /* Enable audio presence detect, invalidate ELD */ tmp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD); @@ -225,8 +225,8 @@ static void hsw_audio_codec_enable(struct drm_connector *connector, I915_WRITE(HSW_AUD_DIP_ELD_CTRL(pipe), tmp); /* Up to 84 bytes of hw ELD buffer */ - len = min_t(int, eld[2], 21); - for (i = 0; i len; i++) + len = min(drm_eld_size(eld), 84); + for (i = 0; i len / 4; i++) I915_WRITE(HSW_AUD_EDID_DATA(pipe), *((uint32_t *)eld + i)); /* ELD valid */ @@ -315,7 +315,7 @@ static void ilk_audio_codec_enable(struct drm_connector *connector, int aud_cntrl_st2; DRM_DEBUG_KMS(Enable audio codec on port %c, pipe %c, %u bytes ELD\n, - port_name(port), pipe_name(pipe), eld[2]); + port_name(port), pipe_name(pipe), drm_eld_size(eld)); /* XXX: vblank wait here */ @@ -354,8 +354,8 @@ static void ilk_audio_codec_enable(struct drm_connector *connector, I915_WRITE(aud_cntl_st, tmp); /* Up to 84 bytes of hw ELD buffer */ - len = min_t(int, eld[2], 21); - for (i = 0; i len; i++) + len = min(drm_eld_size(eld), 84); + for (i = 0; i len / 4; i++) I915_WRITE