Re: [Nouveau] [PATCH 5/6] drm: Delete "mandatory" stereographic modes
On Tue, Jan 17, 2017 at 5:42 PM, Alastair Bridgewater wrote: > HDMI specification 1.4a, table 8-15 is very explicitly a "must > support at least one of" table, not a "must support all of" table. > It is not hard to find hardware that does not support some of the > so-called "mandatory" modes. > > More seriously, this code generates invalid display modes for both > of the 3D-capable panels that I have (a 42-inch LG TV and a Sony > PlayStation 3D Display). > > If we want to be persnickety, one option would be to check the > final list of modes against the table and give some message if > none of them are valid, but it's a whole lot easier just to delete > the code in question. Damien added this in commit c858cfcae6d some 3 years ago. Damien, do you remember why you added these "required" modes? Did you have a monitor that only advertised 3D support without the actual modes? > > Signed-off-by: Alastair Bridgewater > --- > drivers/gpu/drm/drm_edid.c | 66 > -- > 1 file changed, 66 deletions(-) > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index 336be31..723116a 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -2926,70 +2926,6 @@ do_cea_modes(struct drm_connector *connector, const u8 > *db, u8 len) > return modes; > } > > -struct stereo_mandatory_mode { > - int width, height, vrefresh; > - unsigned int flags; > -}; > - > -static const struct stereo_mandatory_mode stereo_mandatory_modes[] = { > - { 1920, 1080, 24, DRM_MODE_FLAG_3D_TOP_AND_BOTTOM }, > - { 1920, 1080, 24, DRM_MODE_FLAG_3D_FRAME_PACKING }, > - { 1920, 1080, 50, > - DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF }, > - { 1920, 1080, 60, > - DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF }, > - { 1280, 720, 50, DRM_MODE_FLAG_3D_TOP_AND_BOTTOM }, > - { 1280, 720, 50, DRM_MODE_FLAG_3D_FRAME_PACKING }, > - { 1280, 720, 60, DRM_MODE_FLAG_3D_TOP_AND_BOTTOM }, > - { 1280, 720, 60, DRM_MODE_FLAG_3D_FRAME_PACKING } > -}; > - > -static bool > -stereo_match_mandatory(const struct drm_display_mode *mode, > - const struct stereo_mandatory_mode *stereo_mode) > -{ > - unsigned int interlaced = mode->flags & DRM_MODE_FLAG_INTERLACE; > - > - return mode->hdisplay == stereo_mode->width && > - mode->vdisplay == stereo_mode->height && > - interlaced == (stereo_mode->flags & DRM_MODE_FLAG_INTERLACE) && > - drm_mode_vrefresh(mode) == stereo_mode->vrefresh; > -} > - > -static int add_hdmi_mandatory_stereo_modes(struct drm_connector *connector) > -{ > - struct drm_device *dev = connector->dev; > - const struct drm_display_mode *mode; > - struct list_head stereo_modes; > - int modes = 0, i; > - > - INIT_LIST_HEAD(&stereo_modes); > - > - list_for_each_entry(mode, &connector->probed_modes, head) { > - for (i = 0; i < ARRAY_SIZE(stereo_mandatory_modes); i++) { > - const struct stereo_mandatory_mode *mandatory; > - struct drm_display_mode *new_mode; > - > - if (!stereo_match_mandatory(mode, > - > &stereo_mandatory_modes[i])) > - continue; > - > - mandatory = &stereo_mandatory_modes[i]; > - new_mode = drm_mode_duplicate(dev, mode); > - if (!new_mode) > - continue; > - > - new_mode->flags |= mandatory->flags; > - list_add_tail(&new_mode->head, &stereo_modes); > - modes++; > - } > - } > - > - list_splice_tail(&stereo_modes, &connector->probed_modes); > - > - return modes; > -} > - > static int add_hdmi_mode(struct drm_connector *connector, u8 vic) > { > struct drm_device *dev = connector->dev; > @@ -3090,8 +3026,6 @@ do_hdmi_vsdb_modes(struct drm_connector *connector, > const u8 *db, u8 len, > /* 3D_Present */ > offset++; > if (db[8 + offset] & (1 << 7)) { > - modes += add_hdmi_mandatory_stereo_modes(connector); > - > /* 3D_Multi_present */ > multi_present = (db[8 + offset] & 0x60) >> 5; > } > -- > 2.10.2 > > ___ > Nouveau mailing list > Nouveau@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/nouveau ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
Re: [Nouveau] [PATCH 2/6] drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM
On Tue, Jan 17, 2017 at 5:42 PM, Alastair Bridgewater wrote: > Now that we have mechanism by which to pass mode-dependent HDMI > InfoFrames to the low-level hardware driver, it is incumbent upon > us to do so. > > Experimentation on a gt215 device suggests that the Audio InfoFrame > is not required here, possibly being provided by the HDA device > when necessary (because where else would it come from?). Presumably it's necessary on G84, which doesn't have the HDA device? Looks like there's no helper for computing such a thing in drm_edid. It's a pretty fixed setup on G84... you're supposed to hook the audio from your sound card into an internal S/PDIF connector, so just leaving the default audio infoframe on in there might be enough. > > Signed-off-by: Alastair Bridgewater > --- > drivers/gpu/drm/nouveau/nv50_display.c | 49 > +- > 1 file changed, 48 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/nouveau/nv50_display.c > b/drivers/gpu/drm/nouveau/nv50_display.c > index 2c2c645..d52d0b8 100644 > --- a/drivers/gpu/drm/nouveau/nv50_display.c > +++ b/drivers/gpu/drm/nouveau/nv50_display.c > @@ -23,6 +23,7 @@ > */ > > #include > +#include > > #include > #include > @@ -31,6 +32,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -2772,6 +2774,28 @@ nv50_hdmi_disable(struct drm_encoder *encoder, struct > nouveau_crtc *nv_crtc) > nvif_mthd(disp->disp, 0, &args, sizeof(args)); > } > > +static ssize_t > +nv50_hdmi_pack_infoframe(struct nv50_disp_sor_hdmi_pwr_v0_infoframe > *frame_out, > +union hdmi_infoframe *frame_in) > +{ > + uint8_t buffer[17]; /* The header plus two "subpacks" */ > + ssize_t len; > + > + len = hdmi_infoframe_pack(frame_in, buffer, sizeof(buffer)); > + > + frame_out->header = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16); > + frame_out->subpack0_low = buffer[3] | (buffer[4] << 8) | > + (buffer[5] << 16) | (buffer[6] << 24); > + frame_out->subpack0_high = buffer[7] | (buffer[8] << 8) | > + (buffer[9] << 16); > + frame_out->subpack1_low = buffer[10] | (buffer[11] << 8) | > + (buffer[12] << 16) | (buffer[13] << 24); > + frame_out->subpack1_high = buffer[14] | (buffer[15] << 8) | > + (buffer[16] << 16); > + > + return len; > +} > + > static void > nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode) > { > @@ -2781,6 +2805,7 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct > drm_display_mode *mode) > struct { > struct nv50_disp_mthd_v1 base; > struct nv50_disp_sor_hdmi_pwr_v0 pwr; > + struct nv50_disp_sor_hdmi_pwr_v0_infoframe iframe[3]; > } args = { > .base.version = 1, > .base.method = NV50_DISP_MTHD_V1_SOR_HDMI_PWR, > @@ -2792,17 +2817,39 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct > drm_display_mode *mode) > }; > struct nouveau_connector *nv_connector; > u32 max_ac_packet; > + union hdmi_infoframe avi_frame; > + union hdmi_infoframe vendor_frame; > + int ret; > + int size; > + int frame = 0; > > nv_connector = nouveau_encoder_connector_get(nv_encoder); > if (!drm_detect_hdmi_monitor(nv_connector->edid)) > return; > > + /* Audio InfoFrame apparently not required (supplied by HDA device?) > */ > + > + ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame.avi, mode); > + if (ret >= 0) { if (!ret) or if (ret == 0) is more idiomatic. > + /* We have an AVI InfoFrame, populate it to the display */ > + args.pwr.flags |= > NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AVI_INFOFRAME; > + nv50_hdmi_pack_infoframe(&args.iframe[frame++], &avi_frame); > + } > + > + ret = > drm_hdmi_vendor_infoframe_from_display_mode(&vendor_frame.vendor.hdmi, mode); > + if (ret >= 0) { > + /* We have a Vendor InfoFrame, populate it to the display */ > + args.pwr.flags |= > NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_VENDOR_INFOFRAME; > + nv50_hdmi_pack_infoframe(&args.iframe[frame++], > &vendor_frame); > + } > + > max_ac_packet = mode->htotal - mode->hdisplay; > max_ac_packet -= args.pwr.rekey; > max_ac_packet -= 18; /* constant from tegra */ > args.pwr.max_ac_packet = max_ac_packet / 32; > > - nvif_mthd(disp->disp, 0, &args, sizeof(args)); > + size = sizeof(args.base) + sizeof(args.pwr) + frame * > sizeof(args.iframe[0]); > + nvif_mthd(disp->disp, 0, &args, size); > nv50_audio_enable(encoder, mode); > } > > -- > 2.10.2 > > ___ > Nouveau mailing list > Nouveau@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/nouveau __
Re: [Nouveau] [PATCH 1/6] drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames
On Tue, Jan 17, 2017 at 5:41 PM, Alastair Bridgewater wrote: > The nouveau driver, in the Linux 3.7 days, used to try and set the > AVI InfoFrame based on the selected display mode. These days, it > uses a fixed set of InfoFrames. Start to correct that, by > providing a mechanism whereby InfoFrame data may be passed to the > NVKM functions that do the actual configuration. > > At this point, only establish the new parameters and their parsing, > don't actually use the data anywhere yet (since it's not supplied > anywhere). > > Signed-off-by: Alastair Bridgewater > --- > drivers/gpu/drm/nouveau/include/nvif/cl5070.h | 16 ++- > drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c | 32 > +- > .../gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c | 32 > +- > .../gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c | 32 > +- > .../gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c | 32 > +- > 5 files changed, 139 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/nouveau/include/nvif/cl5070.h > b/drivers/gpu/drm/nouveau/include/nvif/cl5070.h > index ae49dfd..a3ce3bf 100644 > --- a/drivers/gpu/drm/nouveau/include/nvif/cl5070.h > +++ b/drivers/gpu/drm/nouveau/include/nvif/cl5070.h > @@ -76,7 +76,21 @@ struct nv50_disp_sor_hdmi_pwr_v0 { > __u8 state; > __u8 max_ac_packet; > __u8 rekey; > - __u8 pad04[4]; > + __u8 flags; > +#define NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AUDIO_INFOFRAME 0x01 > +#define NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AVI_INFOFRAME 0x02 > +#define NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_VENDOR_INFOFRAME0x04 These should come before flags, not after (based on the other ones). Also, this is nv50_disp_sor_hdmi_pwr_v0, so they should be NV50_DISP_SOR_HDMI_PWR_V0_FLAG_AUDIO_INFOFRAME and so on. > + __u8 pad05[3]; > +}; > + > +struct nv50_disp_sor_hdmi_pwr_v0_infoframe { > + __u8 version; Why do you need a version here? Do you anticipate mixing and matching, e.g. calling the sor_hdmi_pwr_v0 method with v0 or v1 infoframes attached, and needing to tell them apart? I'd just as soon drop it and not use nvif_unpack for these. > + __u8 pad01[3]; > + __u32 header; > + __u32 subpack0_low; > + __u32 subpack0_high; > + __u32 subpack1_low; > + __u32 subpack1_high; Is this nomenclature from the spec? I've never seen it... (not that I'm some spec expert). Why not make it a __u8 buffer[20]? > }; > > struct nv50_disp_sor_lvds_script_v0 { > diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c > b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c > index 1c4256e..f767588 100644 > --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c > +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c > @@ -36,11 +36,14 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1) > union { > struct nv50_disp_sor_hdmi_pwr_v0 v0; > } *args = data; > + struct nv50_disp_sor_hdmi_pwr_v0_infoframe *audio_infoframe = NULL; > + struct nv50_disp_sor_hdmi_pwr_v0_infoframe *avi_infoframe = NULL; > + struct nv50_disp_sor_hdmi_pwr_v0_infoframe *vendor_infoframe = NULL; > u32 ctrl; > int ret = -ENOSYS; > > nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size); > - if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { > + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { > nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d " >"max_ac_packet %d rekey %d\n", >args->v0.version, args->v0.state, > @@ -54,6 +57,33 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1) > } else > return ret; > > + if (args->v0.flags & > + NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AUDIO_INFOFRAME) { > + audio_infoframe = data; > + if ((ret = nvif_unpack(-ENOSYS, &data, &size, > + *audio_infoframe, 0, 0, true))) > + return ret; > + } > + > + if (args->v0.flags & > + NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AVI_INFOFRAME) { > + avi_infoframe = data; > + if ((ret = nvif_unpack(-ENOSYS, &data, &size, > + *avi_infoframe, 0, 0, true))) > + return ret; > + } > + > + if (args->v0.flags & > + NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_VENDOR_INFOFRAME) { > + vendor_infoframe = data; > + if ((ret = nvif_unpack(-ENOSYS, &data, &size, > + *vendor_infoframe, 0, 0, true))) > + return ret; > + } > + > + if (size) > + return -E2BIG; > + > if (!(ctrl & 0x4000)) { > nvkm_mask(device, 0x6165a4 + hoff, 0x4000, 0x);
Re: [Nouveau] [PATCH 3/4] drm/amd/display: Switch to using atomic_helper for flip.
On 17/01/17 07:16 AM, Laurent Pinchart wrote: > On Monday 16 Jan 2017 10:44:57 Andrey Grodzovsky wrote: >> Change-Id: Iad3e0b9b3546e4e4dc79be9233daf4fe4dba83e0 >> Signed-off-by: Andrey Grodzovsky >> --- >> .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c| 92 ++ >> 1 file changed, 6 insertions(+), 86 deletions(-) >> >> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c >> b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c index >> a443b70..d4664bf 100644 >> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c >> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c >> @@ -1060,83 +1060,6 @@ static int dm_crtc_funcs_atomic_set_property( >> return 0; >> } >> >> - >> -static int amdgpu_atomic_helper_page_flip(struct drm_crtc *crtc, >> -struct drm_framebuffer *fb, >> -struct drm_pending_vblank_event *event, >> -uint32_t flags) >> -{ >> -struct drm_plane *plane = crtc->primary; >> -struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); >> -struct drm_atomic_state *state; >> -struct drm_plane_state *plane_state; >> -struct drm_crtc_state *crtc_state; >> -int ret = 0; >> - >> -state = drm_atomic_state_alloc(plane->dev); >> -if (!state) >> -return -ENOMEM; >> - >> -ret = drm_crtc_vblank_get(crtc); > > The DRM core's atomic page flip helper doesn't get/put vblank. Have you > double-checked that removing them isn't a problem ? This patch makes the amdgpu DM code use the page_flip_target hook. drm_mode_page_flip_ioctl calls drm_crtc_vblank_get before the page_flip_target hook. You're right though that the fact that drm_atomic_helper_page_flip doesn't call drm_crtc_vblank_get is a bit alarming. From the DRM_IOCTL_MODE_PAGE_FLIP POV, drm_crtc_vblank_get must be called when userspace calls the ioctl (either by drm_mode_page_flip_ioctl or the page_flip hook implementation), and drm_crtc_vblank_put must be called when the flip completes and the event is sent to userspace. How is this supposed to be handled with atomic? Andrey, did you check via code audit and/or testing that the vblank reference count is still balanced after this change? >> @@ -3143,8 +3064,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev, >> * 1. This commit is not a page flip. >> * 2. This commit is a page flip, and targets are > created. >> */ >> -if (!page_flip_needed(plane_state, old_plane_state, >> - true) || >> +if (!page_flip_needed(plane_state, old_plane_state, > true) || > > This seems to be an unrelated change. Yeah, such whitespace-only changes should be dropped. -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
[Nouveau] [PATCH 4/6] drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware
Now that we have the InfoFrame data being provided, for the most part, program the hardware to use it. While we're here, and since the functionality will come in handy for supporting 3D stereoscopy, implement setting the Vendor ("generic"?) InfoFrame. Also don't enable any InfoFrame that is not provided, and disable the Vendor InfoFrame when disabling the output. Ignore the Audio InfoFrame: We don't supply it, and there is no indication that the hardware supports it through this interface. Signed-off-by: Alastair Bridgewater --- .../gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c | 26 +- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c index 6c38d6d..64b21a4 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c @@ -86,6 +86,7 @@ gk104_hdmi_ctrl(NV50_DISP_MTHD_V1) if (!(ctrl & 0x4000)) { nvkm_mask(device, 0x616798 + hoff, 0x4000, 0x); + nvkm_mask(device, 0x690100 + hdmi, 0x0001, 0x); nvkm_mask(device, 0x6900c0 + hdmi, 0x0001, 0x); nvkm_mask(device, 0x69 + hdmi, 0x0001, 0x); return 0; @@ -93,12 +94,25 @@ gk104_hdmi_ctrl(NV50_DISP_MTHD_V1) /* AVI InfoFrame */ nvkm_mask(device, 0x69 + hdmi, 0x0001, 0x); - nvkm_wr32(device, 0x690008 + hdmi, 0x000d0282); - nvkm_wr32(device, 0x69000c + hdmi, 0x006f); - nvkm_wr32(device, 0x690010 + hdmi, 0x); - nvkm_wr32(device, 0x690014 + hdmi, 0x); - nvkm_wr32(device, 0x690018 + hdmi, 0x); - nvkm_mask(device, 0x69 + hdmi, 0x0001, 0x0001); + if (avi_infoframe) { + nvkm_wr32(device, 0x690008 + hdmi, avi_infoframe->header); + nvkm_wr32(device, 0x69000c + hdmi, avi_infoframe->subpack0_low); + nvkm_wr32(device, 0x690010 + hdmi, avi_infoframe->subpack0_high); + nvkm_wr32(device, 0x690014 + hdmi, avi_infoframe->subpack1_low); + nvkm_wr32(device, 0x690018 + hdmi, avi_infoframe->subpack1_high); + nvkm_mask(device, 0x69 + hdmi, 0x0001, 0x0001); + } + + /* GENERIC(?) / Vendor InfoFrame? */ + nvkm_mask(device, 0x690100 + hdmi, 0x00010001, 0x); + if (vendor_infoframe) { + nvkm_wr32(device, 0x690108 + hdmi, vendor_infoframe->header); + nvkm_wr32(device, 0x69010c + hdmi, vendor_infoframe->subpack0_low); + nvkm_wr32(device, 0x690110 + hdmi, vendor_infoframe->subpack0_high); + /* Is there a second (or further?) set of subpack registers here? */ + nvkm_mask(device, 0x690100 + hdmi, 0x0001, 0x0001); + } + /* ??? InfoFrame? */ nvkm_mask(device, 0x6900c0 + hdmi, 0x0001, 0x); -- 2.10.2 ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
[Nouveau] [PATCH 3/6] drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware
Now that we have the InfoFrame data being provided, for the most part, program the hardware to use it. While we're here, and since the functionality will come in handy for supporting 3D stereoscopy, implement setting the Vendor ("generic") InfoFrame. Also don't enable any InfoFrame that is not provided, and disable the Vendor InfoFrame when disabling the output. This change should have two net effects: The Audio infoframe will no longer be configured (because it's not being supplied, not that it appears to be necessary), and the AVI and Vendor InfoFrames will start being emitted correctly for the selected video mode... For GT215 hardware only. Signed-off-by: Alastair Bridgewater --- .../gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c | 38 -- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c index e2fbe4c..fc8e1e4 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c @@ -87,6 +87,7 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1) if (!(ctrl & 0x4000)) { nvkm_mask(device, 0x61c5a4 + soff, 0x4000, 0x); + nvkm_mask(device, 0x61c53c + soff, 0x0001, 0x); nvkm_mask(device, 0x61c520 + soff, 0x0001, 0x); nvkm_mask(device, 0x61c500 + soff, 0x0001, 0x); return 0; @@ -94,19 +95,36 @@ gt215_hdmi_ctrl(NV50_DISP_MTHD_V1) /* AVI InfoFrame */ nvkm_mask(device, 0x61c520 + soff, 0x0001, 0x); - nvkm_wr32(device, 0x61c528 + soff, 0x000d0282); - nvkm_wr32(device, 0x61c52c + soff, 0x006f); - nvkm_wr32(device, 0x61c530 + soff, 0x); - nvkm_wr32(device, 0x61c534 + soff, 0x); - nvkm_wr32(device, 0x61c538 + soff, 0x); - nvkm_mask(device, 0x61c520 + soff, 0x0001, 0x0001); + if (avi_infoframe) { + nvkm_wr32(device, 0x61c528 + soff, avi_infoframe->header); + nvkm_wr32(device, 0x61c52c + soff, avi_infoframe->subpack0_low); + nvkm_wr32(device, 0x61c530 + soff, avi_infoframe->subpack0_high); + nvkm_wr32(device, 0x61c534 + soff, avi_infoframe->subpack1_low); + nvkm_wr32(device, 0x61c538 + soff, avi_infoframe->subpack1_high); + nvkm_mask(device, 0x61c520 + soff, 0x0001, 0x0001); + } /* Audio InfoFrame */ nvkm_mask(device, 0x61c500 + soff, 0x0001, 0x); - nvkm_wr32(device, 0x61c508 + soff, 0x000a0184); - nvkm_wr32(device, 0x61c50c + soff, 0x0071); - nvkm_wr32(device, 0x61c510 + soff, 0x); - nvkm_mask(device, 0x61c500 + soff, 0x0001, 0x0001); + if (audio_infoframe) { + nvkm_wr32(device, 0x61c508 + soff, audio_infoframe->header); + nvkm_wr32(device, 0x61c50c + soff, audio_infoframe->subpack0_low); + nvkm_wr32(device, 0x61c510 + soff, audio_infoframe->subpack0_high); + /* Audio InfoFrame supposedly has only one subpack. */ + nvkm_mask(device, 0x61c500 + soff, 0x0001, 0x0001); + } + + /* Vendor InfoFrame */ + nvkm_mask(device, 0x61c53c + soff, 0x00010001, 0x0001); + if (vendor_infoframe) { + nvkm_wr32(device, 0x61c544 + soff, vendor_infoframe->header); + nvkm_wr32(device, 0x61c548 + soff, vendor_infoframe->subpack0_low); + nvkm_wr32(device, 0x61c54c + soff, vendor_infoframe->subpack0_high); + /* Is there a second (or up to fourth?) set of subpack registers here? */ + /* nvkm_wr32(device, 0x61c550 + soff, vendor_infoframe->subpack1_low); */ + /* nvkm_wr32(device, 0x61c554 + soff, vendor_infoframe->subpack1_high); */ + nvkm_mask(device, 0x61c53c + soff, 0x00010001, 0x00010001); + } nvkm_mask(device, 0x61c5d0 + soff, 0x00070001, 0x00010001); /* SPARE, HW_CTS */ nvkm_mask(device, 0x61c568 + soff, 0x00010101, 0x); /* ACR_CTRL, ?? */ -- 2.10.2 ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
[Nouveau] [PATCH 5/6] drm: Delete "mandatory" stereographic modes
HDMI specification 1.4a, table 8-15 is very explicitly a "must support at least one of" table, not a "must support all of" table. It is not hard to find hardware that does not support some of the so-called "mandatory" modes. More seriously, this code generates invalid display modes for both of the 3D-capable panels that I have (a 42-inch LG TV and a Sony PlayStation 3D Display). If we want to be persnickety, one option would be to check the final list of modes against the table and give some message if none of them are valid, but it's a whole lot easier just to delete the code in question. Signed-off-by: Alastair Bridgewater --- drivers/gpu/drm/drm_edid.c | 66 -- 1 file changed, 66 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 336be31..723116a 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -2926,70 +2926,6 @@ do_cea_modes(struct drm_connector *connector, const u8 *db, u8 len) return modes; } -struct stereo_mandatory_mode { - int width, height, vrefresh; - unsigned int flags; -}; - -static const struct stereo_mandatory_mode stereo_mandatory_modes[] = { - { 1920, 1080, 24, DRM_MODE_FLAG_3D_TOP_AND_BOTTOM }, - { 1920, 1080, 24, DRM_MODE_FLAG_3D_FRAME_PACKING }, - { 1920, 1080, 50, - DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF }, - { 1920, 1080, 60, - DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF }, - { 1280, 720, 50, DRM_MODE_FLAG_3D_TOP_AND_BOTTOM }, - { 1280, 720, 50, DRM_MODE_FLAG_3D_FRAME_PACKING }, - { 1280, 720, 60, DRM_MODE_FLAG_3D_TOP_AND_BOTTOM }, - { 1280, 720, 60, DRM_MODE_FLAG_3D_FRAME_PACKING } -}; - -static bool -stereo_match_mandatory(const struct drm_display_mode *mode, - const struct stereo_mandatory_mode *stereo_mode) -{ - unsigned int interlaced = mode->flags & DRM_MODE_FLAG_INTERLACE; - - return mode->hdisplay == stereo_mode->width && - mode->vdisplay == stereo_mode->height && - interlaced == (stereo_mode->flags & DRM_MODE_FLAG_INTERLACE) && - drm_mode_vrefresh(mode) == stereo_mode->vrefresh; -} - -static int add_hdmi_mandatory_stereo_modes(struct drm_connector *connector) -{ - struct drm_device *dev = connector->dev; - const struct drm_display_mode *mode; - struct list_head stereo_modes; - int modes = 0, i; - - INIT_LIST_HEAD(&stereo_modes); - - list_for_each_entry(mode, &connector->probed_modes, head) { - for (i = 0; i < ARRAY_SIZE(stereo_mandatory_modes); i++) { - const struct stereo_mandatory_mode *mandatory; - struct drm_display_mode *new_mode; - - if (!stereo_match_mandatory(mode, - &stereo_mandatory_modes[i])) - continue; - - mandatory = &stereo_mandatory_modes[i]; - new_mode = drm_mode_duplicate(dev, mode); - if (!new_mode) - continue; - - new_mode->flags |= mandatory->flags; - list_add_tail(&new_mode->head, &stereo_modes); - modes++; - } - } - - list_splice_tail(&stereo_modes, &connector->probed_modes); - - return modes; -} - static int add_hdmi_mode(struct drm_connector *connector, u8 vic) { struct drm_device *dev = connector->dev; @@ -3090,8 +3026,6 @@ do_hdmi_vsdb_modes(struct drm_connector *connector, const u8 *db, u8 len, /* 3D_Present */ offset++; if (db[8 + offset] & (1 << 7)) { - modes += add_hdmi_mandatory_stereo_modes(connector); - /* 3D_Multi_present */ multi_present = (db[8 + offset] & 0x60) >> 5; } -- 2.10.2 ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
[Nouveau] [PATCH 1/6] drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames
The nouveau driver, in the Linux 3.7 days, used to try and set the AVI InfoFrame based on the selected display mode. These days, it uses a fixed set of InfoFrames. Start to correct that, by providing a mechanism whereby InfoFrame data may be passed to the NVKM functions that do the actual configuration. At this point, only establish the new parameters and their parsing, don't actually use the data anywhere yet (since it's not supplied anywhere). Signed-off-by: Alastair Bridgewater --- drivers/gpu/drm/nouveau/include/nvif/cl5070.h | 16 ++- drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c | 32 +- .../gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c | 32 +- .../gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c | 32 +- .../gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c | 32 +- 5 files changed, 139 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/nouveau/include/nvif/cl5070.h b/drivers/gpu/drm/nouveau/include/nvif/cl5070.h index ae49dfd..a3ce3bf 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/cl5070.h +++ b/drivers/gpu/drm/nouveau/include/nvif/cl5070.h @@ -76,7 +76,21 @@ struct nv50_disp_sor_hdmi_pwr_v0 { __u8 state; __u8 max_ac_packet; __u8 rekey; - __u8 pad04[4]; + __u8 flags; +#define NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AUDIO_INFOFRAME 0x01 +#define NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AVI_INFOFRAME 0x02 +#define NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_VENDOR_INFOFRAME0x04 + __u8 pad05[3]; +}; + +struct nv50_disp_sor_hdmi_pwr_v0_infoframe { + __u8 version; + __u8 pad01[3]; + __u32 header; + __u32 subpack0_low; + __u32 subpack0_high; + __u32 subpack1_low; + __u32 subpack1_high; }; struct nv50_disp_sor_lvds_script_v0 { diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c index 1c4256e..f767588 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c @@ -36,11 +36,14 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1) union { struct nv50_disp_sor_hdmi_pwr_v0 v0; } *args = data; + struct nv50_disp_sor_hdmi_pwr_v0_infoframe *audio_infoframe = NULL; + struct nv50_disp_sor_hdmi_pwr_v0_infoframe *avi_infoframe = NULL; + struct nv50_disp_sor_hdmi_pwr_v0_infoframe *vendor_infoframe = NULL; u32 ctrl; int ret = -ENOSYS; nvif_ioctl(object, "disp sor hdmi ctrl size %d\n", size); - if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { + if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) { nvif_ioctl(object, "disp sor hdmi ctrl vers %d state %d " "max_ac_packet %d rekey %d\n", args->v0.version, args->v0.state, @@ -54,6 +57,33 @@ g84_hdmi_ctrl(NV50_DISP_MTHD_V1) } else return ret; + if (args->v0.flags & + NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AUDIO_INFOFRAME) { + audio_infoframe = data; + if ((ret = nvif_unpack(-ENOSYS, &data, &size, + *audio_infoframe, 0, 0, true))) + return ret; + } + + if (args->v0.flags & + NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AVI_INFOFRAME) { + avi_infoframe = data; + if ((ret = nvif_unpack(-ENOSYS, &data, &size, + *avi_infoframe, 0, 0, true))) + return ret; + } + + if (args->v0.flags & + NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_VENDOR_INFOFRAME) { + vendor_infoframe = data; + if ((ret = nvif_unpack(-ENOSYS, &data, &size, + *vendor_infoframe, 0, 0, true))) + return ret; + } + + if (size) + return -E2BIG; + if (!(ctrl & 0x4000)) { nvkm_mask(device, 0x6165a4 + hoff, 0x4000, 0x); nvkm_mask(device, 0x616520 + hoff, 0x0001, 0x); diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c index 632f02d..c492cd7 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c @@ -36,11 +36,14 @@ gf119_hdmi_ctrl(NV50_DISP_MTHD_V1) union { struct nv50_disp_sor_hdmi_pwr_v0 v0; } *args = data; + struct nv50_disp_sor_hdmi_pwr_v0_infoframe *audio_infoframe = NULL; + struct nv50_disp_sor_hdmi_pwr_v0_infoframe *avi_infoframe = NULL; + struct nv50_disp_sor_hdmi_pwr_v0_infoframe *vendor_infoframe = NULL; u32 ctrl; int ret = -ENOSYS; nvif_ioctl(object, "disp sor hdmi ctrl size %d\n
[Nouveau] [PATCH 2/6] drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM
Now that we have mechanism by which to pass mode-dependent HDMI InfoFrames to the low-level hardware driver, it is incumbent upon us to do so. Experimentation on a gt215 device suggests that the Audio InfoFrame is not required here, possibly being provided by the HDA device when necessary (because where else would it come from?). Signed-off-by: Alastair Bridgewater --- drivers/gpu/drm/nouveau/nv50_display.c | 49 +- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index 2c2c645..d52d0b8 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c @@ -23,6 +23,7 @@ */ #include +#include #include #include @@ -31,6 +32,7 @@ #include #include #include +#include #include #include @@ -2772,6 +2774,28 @@ nv50_hdmi_disable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc) nvif_mthd(disp->disp, 0, &args, sizeof(args)); } +static ssize_t +nv50_hdmi_pack_infoframe(struct nv50_disp_sor_hdmi_pwr_v0_infoframe *frame_out, +union hdmi_infoframe *frame_in) +{ + uint8_t buffer[17]; /* The header plus two "subpacks" */ + ssize_t len; + + len = hdmi_infoframe_pack(frame_in, buffer, sizeof(buffer)); + + frame_out->header = buffer[0] | (buffer[1] << 8) | (buffer[2] << 16); + frame_out->subpack0_low = buffer[3] | (buffer[4] << 8) | + (buffer[5] << 16) | (buffer[6] << 24); + frame_out->subpack0_high = buffer[7] | (buffer[8] << 8) | + (buffer[9] << 16); + frame_out->subpack1_low = buffer[10] | (buffer[11] << 8) | + (buffer[12] << 16) | (buffer[13] << 24); + frame_out->subpack1_high = buffer[14] | (buffer[15] << 8) | + (buffer[16] << 16); + + return len; +} + static void nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode) { @@ -2781,6 +2805,7 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode) struct { struct nv50_disp_mthd_v1 base; struct nv50_disp_sor_hdmi_pwr_v0 pwr; + struct nv50_disp_sor_hdmi_pwr_v0_infoframe iframe[3]; } args = { .base.version = 1, .base.method = NV50_DISP_MTHD_V1_SOR_HDMI_PWR, @@ -2792,17 +2817,39 @@ nv50_hdmi_enable(struct drm_encoder *encoder, struct drm_display_mode *mode) }; struct nouveau_connector *nv_connector; u32 max_ac_packet; + union hdmi_infoframe avi_frame; + union hdmi_infoframe vendor_frame; + int ret; + int size; + int frame = 0; nv_connector = nouveau_encoder_connector_get(nv_encoder); if (!drm_detect_hdmi_monitor(nv_connector->edid)) return; + /* Audio InfoFrame apparently not required (supplied by HDA device?) */ + + ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame.avi, mode); + if (ret >= 0) { + /* We have an AVI InfoFrame, populate it to the display */ + args.pwr.flags |= NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_AVI_INFOFRAME; + nv50_hdmi_pack_infoframe(&args.iframe[frame++], &avi_frame); + } + + ret = drm_hdmi_vendor_infoframe_from_display_mode(&vendor_frame.vendor.hdmi, mode); + if (ret >= 0) { + /* We have a Vendor InfoFrame, populate it to the display */ + args.pwr.flags |= NV50_DISP_MTHD_V1_SOR_HDMI_PWR_FLAG_VENDOR_INFOFRAME; + nv50_hdmi_pack_infoframe(&args.iframe[frame++], &vendor_frame); + } + max_ac_packet = mode->htotal - mode->hdisplay; max_ac_packet -= args.pwr.rekey; max_ac_packet -= 18; /* constant from tegra */ args.pwr.max_ac_packet = max_ac_packet / 32; - nvif_mthd(disp->disp, 0, &args, sizeof(args)); + size = sizeof(args.base) + sizeof(args.pwr) + frame * sizeof(args.iframe[0]); + nvif_mthd(disp->disp, 0, &args, size); nv50_audio_enable(encoder, mode); } -- 2.10.2 ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
[Nouveau] [PATCH 6/6] drm/nouveau: Enable stereoscopic 3D output over HDMI
This is a bit sketchy in terms of implementation, with some rough edges, but for the most part IT WORKS. That is to say, I get an obvious 3D output when using the "testdisplay" program from intel-gpu-tools with the "-3" parameter and outputting to a 3D-capable HDMI display. Rough edges include: the criteria for when to enable 3D mode selection, and the inconsistent support for setting InfoFrames on HDMI outputs. Signed-off-by: Alastair Bridgewater --- drivers/gpu/drm/nouveau/nouveau_connector.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 947c200..11b4977 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -547,6 +547,16 @@ nouveau_connector_set_encoder(struct drm_connector *connector, DRM_MODE_SUBCONNECTOR_DVID : DRM_MODE_SUBCONNECTOR_DVIA); } + + if (nv_encoder->dcb->type == DCB_OUTPUT_TMDS) { + /* Can we just ask for the drm connector type? */ + /* +* FIXME: Does this also kick in for DVI or DP->DVI +* connectors? It shouldn't. +*/ + /* FIXME: Should only allow when we can set InfoFrames */ + connector->stereo_allowed = true; + } } static enum drm_connector_status @@ -1044,6 +1054,9 @@ nouveau_connector_mode_valid(struct drm_connector *connector, return MODE_BAD; } + if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING) + clock *= 2; + if (clock < min_clock) return MODE_CLOCK_LOW; -- 2.10.2 ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
[Nouveau] [PATCH 0/6] drm/nouveau: Enable HDMI Stereoscopy
This is an initial implementation of HDMI 3D mode support for the nouveau kernel driver. It works on all of the hardware that I have available to test at the moment, but I am unsure as to the overall approach taken for setting HDMI InfoFrames, there's no support for g84 or gf119 disps, and the criteria for enabling stereo support for an output seems a bit iffy. The first four patches arrange to set the HDMI InfoFrames for gt215 and gk104 disps, and provide the parsing side of support for g84 and gf119 disps. The fifth patch removes code that sets up the "mandatory" 3D modes. The requirement is that a display that supports 3D support at least one of these modes, not that it must support all of them. The sixth patch enables stereo support on all TMDS outputs, and adds a term (copied from the i915 driver) to adjust the clock required for frame-packed stereo modes. The criteria used here for enabling stereo on an output seems wrong to me, but it's the least wrong thing that I've been able to come up with so far. Even just taking the InfoFrame patches and leaving the stereoscopy patches until the rest of the InfoFrame support is worked out would probably be a win. Alastair Bridgewater (6): drm/nouveau: Extend NVKM HDMI power control method to set InfoFrames drm/nouveau: Pass mode-dependent AVI and Vendor HDMI InfoFrames to NVKM drm/nouveau: Use supplied HDMI InfoFrames on GT215 hardware drm/nouveau: Use supplied HDMI InfoFrames on GK104 hardware drm: Delete "mandatory" stereographic modes drm/nouveau: Enable stereoscopic 3D output over HDMI drivers/gpu/drm/drm_edid.c | 66 drivers/gpu/drm/nouveau/include/nvif/cl5070.h | 16 - drivers/gpu/drm/nouveau/nouveau_connector.c| 13 drivers/gpu/drm/nouveau/nv50_display.c | 49 ++- drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmig84.c | 32 +- .../gpu/drm/nouveau/nvkm/engine/disp/hdmigf119.c | 32 +- .../gpu/drm/nouveau/nvkm/engine/disp/hdmigk104.c | 58 +++--- .../gpu/drm/nouveau/nvkm/engine/disp/hdmigt215.c | 70 ++ 8 files changed, 248 insertions(+), 88 deletions(-) -- 2.10.2 ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
Re: [Nouveau] GSOC project
Hi, I think a nice project would be to write an application to figure out those latencies automatically maybe even based on envydis. It could generate latency information based on thread count, register usage, instruction/instruction class, hw unit used. Or even tries to figure out what kind of units exist. Like instructions out of a group which are free to issue/execute after instructions out of another one. I could imagine, that this allone might be a really huge project, but useful for future and past chipsets. On 17 January 2017 10:28:20 p.m. GMT+01:00, Ilia Mirkin wrote: >There's not a lot of information about it. Basically we need 2 >instruction >scheduling passes -- one pre-RA and one post-RA. The prerequisites are >"know how compilers work" and "have a GPU that you can test performance >on". > >I won't beat around the bush - this is a very tough project. Every >attempt >at it so far has basically failed. There are a lot of issues that have >to >be dealt with, like how to properly get the instruction latency >information, and how to apply it while taking ideas like register >pressure >into account. > >You can read up on the nouveau codegen compiler here: >https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/drivers/nouveau/codegen/ > >Cheers, > > -ilia > > >On Tue, Jan 17, 2017 at 8:58 AM, Shailesh Tripathi < >shailesh.tripathi.ec...@itbhu.ac.in> wrote: > >> Hello, >> I am quite interested in the project "Instruction Scheduler" under >X.org. >> Please tell me where can I find a detailed idea of the project and >how to >> start it. I think I have the given prerequisites. >> >> Regards >> Shailesh Tripathi >> >> >> Shailesh Tripathi >> B.Tech. Part-IV >> Electronics Engineering >> IIT-BHU (Varanasi) >> >> ___ >> Nouveau mailing list >> Nouveau@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/nouveau >> >> ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
Re: [Nouveau] GSOC project
There's not a lot of information about it. Basically we need 2 instruction scheduling passes -- one pre-RA and one post-RA. The prerequisites are "know how compilers work" and "have a GPU that you can test performance on". I won't beat around the bush - this is a very tough project. Every attempt at it so far has basically failed. There are a lot of issues that have to be dealt with, like how to properly get the instruction latency information, and how to apply it while taking ideas like register pressure into account. You can read up on the nouveau codegen compiler here: https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/drivers/nouveau/codegen/ Cheers, -ilia On Tue, Jan 17, 2017 at 8:58 AM, Shailesh Tripathi < shailesh.tripathi.ec...@itbhu.ac.in> wrote: > Hello, > I am quite interested in the project "Instruction Scheduler" under X.org. > Please tell me where can I find a detailed idea of the project and how to > start it. I think I have the given prerequisites. > > Regards > Shailesh Tripathi > > > Shailesh Tripathi > B.Tech. Part-IV > Electronics Engineering > IIT-BHU (Varanasi) > > ___ > Nouveau mailing list > Nouveau@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/nouveau > > ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
[Nouveau] GSOC project
Hello, I am quite interested in the project "Instruction Scheduler" under X.org. Please tell me where can I find a detailed idea of the project and how to start it. I think I have the given prerequisites. Regards Shailesh Tripathi Shailesh Tripathi B.Tech. Part-IV Electronics Engineering IIT-BHU (Varanasi) ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
[Nouveau] Discrete card is always off even if it is used
Hi, I have a computer with an integrated graphic card and a discrete graphic card, namely: # lspci | grep -E "VGA|3D" 00:02.0 VGA compatible controller: Intel Corporation Broadwell-U Integrated Graphics (rev 09) 03:00.0 3D controller: NVIDIA Corporation GM108M [GeForce 840M] (rev a2) This is confirmed by vgaswitcheroo: xray:/ # cat /sys/kernel/debug/vgaswitcheroo/switch 0:IGD:+:Pwr::00:02.0 1:DIS: :DynOff::03:00.0 Some info: xray:/ # uname -a Linux xray 4.9.4-1.gd9de2ec-default #1 SMP PREEMPT Sun Jan 15 16:51:00 UTC 2017 (d9de2ec) x86_64 x86_64 x86_64 GNU/Linux xray:/var/log # rpm -qa | grep -i nouveau libdrm_nouveau2-2.4.68-1.4.x86_64 libvdpau_nouveau-11.2.2-166.1.x86_64 xf86-video-nouveau-1.0.12-1.5.x86_64 Mesa-dri-nouveau-11.2.2-166.1.x86_64 No NVIDIA drivers are used. # lsmod | egrep "i915|nvidia" i915 1241088 4 video 40960 5 dell_wmi,dell_laptop,int3406_thermal,nouveau,i915 button 16384 2 nouveau,i915 i2c_algo_bit 16384 2 nouveau,i915 drm_kms_helper159744 2 nouveau,i915 drm 360448 7 nouveau,i915,ttm,drm_kms_helper Now begins the strangeness xray:~> xrandr --listproviders Providers: number : 1 Provider 0: id: 0x49 cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 4 outputs: 6 associated providers: 0 name:Intel Why just one provider? Should be also listed NVIDIA with nouveau. And now for some strangeness again: xray:~> glxgears -info Running synchronized to the vertical refresh. The framerate should be approximately the same as the monitor refresh rate. GL_RENDERER = Mesa DRI Intel(R) HD Graphics 5500 (Broadwell GT2) GL_VERSION= 3.0 Mesa 11.2.2 GL_VENDOR = Intel Open Source Technology Center GL_EXTENSIONS = GL_ARB_multisample GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_copy_texture GL_EXT_polygon_offset GL_EXT_subtexture GL_EXT_texture_object GL_EXT_vertex_array GL_EXT_compiled_vertex_array GL_EXT_texture GL_EXT_texture3D GL_IBM_rasterpos_clip GL_ARB_point_parameters GL_EXT_draw_range_elements GL_EXT_packed_pixels GL_EXT_point_parameters GL_EXT_rescale_normal GL_EXT_separate_specular_color GL_EXT_texture_edge_clamp GL_SGIS_generate_mipmap GL_SGIS_texture_border_clamp GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod GL_ARB_framebuffer_sRGB GL_ARB_multitexture GL_EXT_framebuffer_sRGB GL_IBM_multimode_draw_arrays GL_IBM_texture_mirrored_repeat GL_3DFX_texture_compression_FXT1 GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_transpose_matrix GL_EXT_blend_func_separate GL_EXT_fog_coord GL_EXT_multi_draw_arrays GL_EXT_secondary_color GL_EXT_texture_env_add GL_EXT_texture_filter_anisotropic GL_EXT_texture_lod_bias GL_INGR_blend_func_separate GL_NV_blend_square GL_NV_light_max_exponent GL_NV_texgen_reflection GL_NV_texture_env_combine4 GL_S3_s3tc GL_SUN_multi_draw_arrays GL_ARB_texture_border_clamp GL_ARB_texture_compression GL_EXT_framebuffer_object GL_EXT_texture_compression_s3tc GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_MESA_window_pos GL_NV_packed_depth_stencil GL_NV_texture_rectangle GL_ARB_depth_texture GL_ARB_occlusion_query GL_ARB_shadow GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_mirrored_repeat GL_ARB_window_pos GL_EXT_stencil_two_side GL_EXT_texture_cube_map GL_NV_depth_clamp GL_APPLE_packed_pixels GL_APPLE_vertex_array_object GL_ARB_draw_buffers GL_ARB_fragment_program GL_ARB_fragment_shader GL_ARB_shader_objects GL_ARB_vertex_program GL_ARB_vertex_shader GL_ATI_draw_buffers GL_ATI_texture_env_combine3 GL_ATI_texture_float GL_EXT_shadow_funcs GL_EXT_stencil_wrap GL_MESA_pack_invert GL_NV_primitive_restart GL_ARB_depth_clamp GL_ARB_fragment_program_shadow GL_ARB_half_float_pixel GL_ARB_occlusion_query2 GL_ARB_point_sprite GL_ARB_shading_language_100 GL_ARB_sync GL_ARB_texture_non_power_of_two GL_ARB_vertex_buffer_object GL_ATI_blend_equation_separate GL_EXT_blend_equation_separate GL_OES_read_format GL_ARB_color_buffer_float GL_ARB_pixel_buffer_object GL_ARB_texture_compression_rgtc GL_ARB_texture_float GL_ARB_texture_rectangle GL_EXT_packed_float GL_EXT_pixel_buffer_object GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_rgtc GL_EXT_texture_rectangle GL_EXT_texture_sRGB GL_EXT_texture_shared_exponent GL_ARB_framebuffer_object GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXT_packed_depth_stencil GL_APPLE_object_purgeable GL_ARB_vertex_array_object GL_ATI_separate_stencil GL_EXT_draw_buffers2 GL_EXT_draw_instanced GL_EXT_gpu_program_parameters GL_EXT_texture_array GL_EXT_texture_integer GL_EXT_texture_sRGB_decode GL_EXT_timer_query GL_OES_EGL_image GL_ARB_copy_buffer GL_ARB_depth_buffer_float GL_ARB_draw_instanced GL_ARB_half_float_vertex GL_ARB_instanced_arrays GL_ARB_map_buffer_range GL_ARB_texture_rg GL_ARB_texture_swizzle GL_ARB_vertex_array_bgra GL_EXT_texture_swizzle GL_EXT_
[Nouveau] [Bug 99400] [nouveau] garbled rendering with glamor on G71
https://bugs.freedesktop.org/show_bug.cgi?id=99400 --- Comment #11 from Olivier Fourdan --- (In reply to Olivier Fourdan from comment #10) > (In reply to Olivier Fourdan from comment #9) > > glamor_composite_choose_shader: Unsupported source picture format. > > glamor_composite_with_shader: glamor_composite_choose_shader > > failed > > I see the same with intel and yet rendering is correct there, so it's not > that. Unless the issue is with the fallback code in glamor, i.e.: https://cgit.freedesktop.org/xorg/xserver/tree/glamor/glamor_render.c#n1699 Calling the fallback code unconditionally (i.e. "goto fail;" at the beginning of glamor_composite() ) still exhibits the issue on nvidia/nouveau and not on intel, but then it doesn't seem to be specific to nouveau... I am confused now. -- You are receiving this mail because: You are the assignee for the bug. You are the QA Contact for the bug.___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
Re: [Nouveau] [PATCH 1/4] drm/atomic: Save flip flags in drm_plane_state
Hi Andrey, On Tuesday 17 Jan 2017 04:03:11 Grodzovsky, Andrey wrote: > On Monday, January 16, 2017 5:18 PM Laurent Pinchart wrote: > > On Monday 16 Jan 2017 10:44:55 Andrey Grodzovsky wrote: > > > Allows using atomic flip helpers for drivers using ASYNC flip. > > > Remove ASYNC_FLIP restriction in helpers and caches the page flip > > > flags in drm_plane_state to be used in the low level drivers. > > > > >> Signed-off-by: Andrey Grodzovsky > >> --- > >> > >> drivers/gpu/drm/drm_atomic_helper.c | 10 +++--- > >> include/drm/drm_plane.h | 8 > >> 2 files changed, 11 insertions(+), 7 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/drm_atomic_helper.c > >> b/drivers/gpu/drm/drm_atomic_helper.c index a4e5477..f83dc43 100644 > >> --- a/drivers/gpu/drm/drm_atomic_helper.c > >> +++ b/drivers/gpu/drm/drm_atomic_helper.c > >> @@ -2737,7 +2737,8 @@ static int page_flip_common( > >>struct drm_atomic_state *state, > >>struct drm_crtc *crtc, > >>struct drm_framebuffer *fb, > >> - struct drm_pending_vblank_event *event) > >> + struct drm_pending_vblank_event *event, > >> + uint32_t flags) > >> { > >>struct drm_plane *plane = crtc->primary; > >>struct drm_plane_state *plane_state; > >> @@ -2754,6 +2755,7 @@ static int page_flip_common( > >>if (IS_ERR(plane_state)) > >>return PTR_ERR(plane_state); > >> > >> + plane_state->pflip_flags = flags; > >> > >>ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); > >>if (ret != 0) > >> @@ -2800,9 +2802,6 @@ int drm_atomic_helper_page_flip(struct drm_crtc > >> *crtc, > >>struct drm_atomic_state *state; > >>int ret = 0; > >> > >> - if (flags & DRM_MODE_PAGE_FLIP_ASYNC) > >> - return -EINVAL; > >> - > > > > With this change all drivers using the helper will not reject that async > > flag, even if they don't implement support for async page flip. You need > > to either patch them all to reject the flag, or implement async page flip > > support for all of them (preferable in the helpers, and then remove the > > Please check drm_mode_page_flip_ioctl, one of the checks in the beginning is > > if ((page_flip->flags & DRM_MODE_PAGE_FLIP_ASYNC) && > !dev->mode_config.async_page_flip) return -EINVAL; I think you're right. Sorry for the noise. > We in DC explicitly set dev->mode_config.async_page_flip = true, any driver > which is Not supporting ASYNC flip will fail the IOCTL at this point. > Same in drm_mode_atomic_ioctl > > > * Note that for now so called async page flips (i.e. updates which are > > not > > * synchronized to vblank) are not supported, since the atomic interfaces > > have > > * no provisions for this yet. > > > > comment). > > Thanks, that a good catch, will remove. -- Regards, Laurent Pinchart ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
[Nouveau] [Bug 91247] Tomb Raider: Underworld renders lots of artefacts on models and objects
https://bugs.freedesktop.org/show_bug.cgi?id=91247 --- Comment #10 from Samuel Pitoiset --- Good to know. Maybe F1 2015 now works by luck too? :) -- You are receiving this mail because: You are the assignee for the bug. You are the QA Contact for the bug.___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
Re: [Nouveau] [PATCH 1/4] drm/atomic: Save flip flags in drm_plane_state
On Mon, Jan 16, 2017 at 10:44:55AM -0500, Andrey Grodzovsky wrote: > Allows using atomic flip helpers for drivers > using ASYNC flip. > Remove ASYNC_FLIP restriction in helpers and > caches the page flip flags in drm_plane_state > to be used in the low level drivers. > > Signed-off-by: Andrey Grodzovsky > --- > drivers/gpu/drm/drm_atomic_helper.c | 10 +++--- > include/drm/drm_plane.h | 8 > 2 files changed, 11 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c > b/drivers/gpu/drm/drm_atomic_helper.c > index a4e5477..f83dc43 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -2737,7 +2737,8 @@ static int page_flip_common( > struct drm_atomic_state *state, > struct drm_crtc *crtc, > struct drm_framebuffer *fb, > - struct drm_pending_vblank_event *event) > + struct drm_pending_vblank_event *event, > + uint32_t flags) > { > struct drm_plane *plane = crtc->primary; > struct drm_plane_state *plane_state; > @@ -2754,6 +2755,7 @@ static int page_flip_common( > if (IS_ERR(plane_state)) > return PTR_ERR(plane_state); > > + plane_state->pflip_flags = flags; "pflip" looks off. Better just spell it out. These flags need to be reset in duplicate_state otherwise they leak into subsequent operations. This is why I don't really like the concept of "state" containing flags and stuff that are not really part of the state but rather part of the operation of moving from the old state to the new state. But maybe we don't have a better place for this sort of stuff? I have suggested at some point that we might rename drm_atomic_state to drm_atomic_transaction or something. Stuffing the flags (or just a bool perhaps?) in there might be less confusing. > > ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); > if (ret != 0) > @@ -2800,9 +2802,6 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc, > struct drm_atomic_state *state; > int ret = 0; > > - if (flags & DRM_MODE_PAGE_FLIP_ASYNC) > - return -EINVAL; > - > state = drm_atomic_state_alloc(plane->dev); > if (!state) > return -ENOMEM; > @@ -2865,9 +2864,6 @@ int drm_atomic_helper_page_flip_target( > struct drm_crtc_state *crtc_state; > int ret = 0; > > - if (flags & DRM_MODE_PAGE_FLIP_ASYNC) > - return -EINVAL; > - > state = drm_atomic_state_alloc(plane->dev); > if (!state) > return -ENOMEM; > diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h > index db3bbde..86d8ffc 100644 > --- a/include/drm/drm_plane.h > +++ b/include/drm/drm_plane.h > @@ -122,6 +122,14 @@ struct drm_plane_state { >*/ > bool visible; > > + > + /** > + * @pflip_flags: > + * > + * Flip related config options > + */ > + u32 pflip_flags; > + > struct drm_atomic_state *state; > }; > > -- > 1.9.1 > > ___ > dri-devel mailing list > dri-de...@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Ville Syrjälä Intel OTC ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
Re: [Nouveau] [PATCH 1/4] drm/atomic: Save flip flags in drm_plane_state
> -Original Message- > From: Laurent Pinchart [mailto:laurent.pinch...@ideasonboard.com] > Sent: Monday, January 16, 2017 5:18 PM > To: dri-de...@lists.freedesktop.org > Cc: Grodzovsky, Andrey; nouveau@lists.freedesktop.org; amd- > g...@lists.freedesktop.org; Deucher, Alexander; daniel.vet...@intel.com > Subject: Re: [PATCH 1/4] drm/atomic: Save flip flags in drm_plane_state > > Hi Andrey, > > Thank you for the patch. > > On Monday 16 Jan 2017 10:44:55 Andrey Grodzovsky wrote: > > Allows using atomic flip helpers for drivers using ASYNC flip. > > Remove ASYNC_FLIP restriction in helpers and caches the page flip > > flags in drm_plane_state to be used in the low level drivers. > > > > Signed-off-by: Andrey Grodzovsky > > --- > > drivers/gpu/drm/drm_atomic_helper.c | 10 +++--- > > include/drm/drm_plane.h | 8 > > 2 files changed, 11 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c > > b/drivers/gpu/drm/drm_atomic_helper.c index a4e5477..f83dc43 100644 > > --- a/drivers/gpu/drm/drm_atomic_helper.c > > +++ b/drivers/gpu/drm/drm_atomic_helper.c > > @@ -2737,7 +2737,8 @@ static int page_flip_common( > > struct drm_atomic_state *state, > > struct drm_crtc *crtc, > > struct drm_framebuffer *fb, > > - struct drm_pending_vblank_event *event) > > + struct drm_pending_vblank_event *event, > > + uint32_t flags) > > { > > struct drm_plane *plane = crtc->primary; > > struct drm_plane_state *plane_state; @@ -2754,6 +2755,7 @@ static > > int page_flip_common( > > if (IS_ERR(plane_state)) > > return PTR_ERR(plane_state); > > > > + plane_state->pflip_flags = flags; > > > > ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); > > if (ret != 0) > > @@ -2800,9 +2802,6 @@ int drm_atomic_helper_page_flip(struct drm_crtc > > *crtc, struct drm_atomic_state *state; > > int ret = 0; > > > > - if (flags & DRM_MODE_PAGE_FLIP_ASYNC) > > - return -EINVAL; > > - > > With this change all drivers using the helper will not reject that async flag, > even if they don't implement support for async page flip. You need to either > patch them all to reject the flag, or implement async page flip support for > all > of them (preferable in the helpers, and then remove the Please check drm_mode_page_flip_ioctl, one of the checks in the beginning is if ((page_flip->flags & DRM_MODE_PAGE_FLIP_ASYNC) && !dev->mode_config.async_page_flip) return -EINVAL; We in DC explicitly set dev->mode_config.async_page_flip = true, any driver which is Not supporting ASYNC flip will fail the IOCTL at this point. Same in drm_mode_atomic_ioctl > > * Note that for now so called async page flips (i.e. updates which are not > * synchronized to vblank) are not supported, since the atomic interfaces > have > * no provisions for this yet. > > comment). Thanks, that a good catch, will remove. Andrey > > > state = drm_atomic_state_alloc(plane->dev); > > if (!state) > > return -ENOMEM; > > @@ -2865,9 +2864,6 @@ int drm_atomic_helper_page_flip_target( > > struct drm_crtc_state *crtc_state; > > int ret = 0; > > > > - if (flags & DRM_MODE_PAGE_FLIP_ASYNC) > > - return -EINVAL; > > - > > state = drm_atomic_state_alloc(plane->dev); > > if (!state) > > return -ENOMEM; > > diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index > > db3bbde..86d8ffc 100644 > > --- a/include/drm/drm_plane.h > > +++ b/include/drm/drm_plane.h > > @@ -122,6 +122,14 @@ struct drm_plane_state { > > */ > > bool visible; > > > > + > > + /** > > +* @pflip_flags: > > +* > > +* Flip related config options > > +*/ > > + u32 pflip_flags; > > + > > struct drm_atomic_state *state; > > }; > > -- > Regards, > > Laurent Pinchart ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
Re: [Nouveau] [PATCH v2 0/3] Allow ASYNC flip with atomic helpers.
This series is, Reviewed-by: Edward O'Callaghan On 01/17/2017 04:16 PM, Andrey Grodzovsky wrote: > This series is a folow-up on > https://patchwork.kernel.org/patch/9501787/ > > The first patch makes changes to atomic helpers to allow for > drives with ASYNC flip support to use them. > Patch 2 is to use this in AMDGPU/DC. > Patch 3 is possible cleanup in nouveau/kms who seems to have to duplicate > the helper as we did to support ASYNC flips. > > v2: > Resend drm/atomic: Save flip flags in drm_plane_state since > the original patch was incomplete. > Squash 2 AMD changes into one to not break compilation. > > Andrey Grodzovsky (3): > drm/atomic: Save flip flags in drm_plane_state > drm/amd/display: Switch to using atomic_helper for flip. > drm/nouveau/kms/nv50: Switch to using atomic helper for flip. > > drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 - > .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c| 92 > ++ > drivers/gpu/drm/drm_atomic_helper.c| 18 ++--- > drivers/gpu/drm/nouveau/nv50_display.c | 77 ++ > include/drm/drm_plane.h| 8 ++ > 5 files changed, 24 insertions(+), 172 deletions(-) > signature.asc Description: OpenPGP digital signature ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
Re: [Nouveau] [PATCH 1/4] drm/atomic: Save flip flags in drm_plane_state
Hi Andrey, Thank you for the patch. On Monday 16 Jan 2017 10:44:55 Andrey Grodzovsky wrote: > Allows using atomic flip helpers for drivers > using ASYNC flip. > Remove ASYNC_FLIP restriction in helpers and > caches the page flip flags in drm_plane_state > to be used in the low level drivers. > > Signed-off-by: Andrey Grodzovsky > --- > drivers/gpu/drm/drm_atomic_helper.c | 10 +++--- > include/drm/drm_plane.h | 8 > 2 files changed, 11 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c > b/drivers/gpu/drm/drm_atomic_helper.c index a4e5477..f83dc43 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -2737,7 +2737,8 @@ static int page_flip_common( > struct drm_atomic_state *state, > struct drm_crtc *crtc, > struct drm_framebuffer *fb, > - struct drm_pending_vblank_event *event) > + struct drm_pending_vblank_event *event, > + uint32_t flags) > { > struct drm_plane *plane = crtc->primary; > struct drm_plane_state *plane_state; > @@ -2754,6 +2755,7 @@ static int page_flip_common( > if (IS_ERR(plane_state)) > return PTR_ERR(plane_state); > > + plane_state->pflip_flags = flags; > > ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); > if (ret != 0) > @@ -2800,9 +2802,6 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc, > struct drm_atomic_state *state; > int ret = 0; > > - if (flags & DRM_MODE_PAGE_FLIP_ASYNC) > - return -EINVAL; > - With this change all drivers using the helper will not reject that async flag, even if they don't implement support for async page flip. You need to either patch them all to reject the flag, or implement async page flip support for all of them (preferable in the helpers, and then remove the * Note that for now so called async page flips (i.e. updates which are not * synchronized to vblank) are not supported, since the atomic interfaces have * no provisions for this yet. comment). > state = drm_atomic_state_alloc(plane->dev); > if (!state) > return -ENOMEM; > @@ -2865,9 +2864,6 @@ int drm_atomic_helper_page_flip_target( > struct drm_crtc_state *crtc_state; > int ret = 0; > > - if (flags & DRM_MODE_PAGE_FLIP_ASYNC) > - return -EINVAL; > - > state = drm_atomic_state_alloc(plane->dev); > if (!state) > return -ENOMEM; > diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h > index db3bbde..86d8ffc 100644 > --- a/include/drm/drm_plane.h > +++ b/include/drm/drm_plane.h > @@ -122,6 +122,14 @@ struct drm_plane_state { >*/ > bool visible; > > + > + /** > + * @pflip_flags: > + * > + * Flip related config options > + */ > + u32 pflip_flags; > + > struct drm_atomic_state *state; > }; -- Regards, Laurent Pinchart ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
[Nouveau] [PATCH 3/4] drm/amd/display: Switch to using atomic_helper for flip.
Change-Id: Iad3e0b9b3546e4e4dc79be9233daf4fe4dba83e0 Signed-off-by: Andrey Grodzovsky --- .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c| 92 ++ 1 file changed, 6 insertions(+), 86 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c index a443b70..d4664bf 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c @@ -1060,83 +1060,6 @@ static int dm_crtc_funcs_atomic_set_property( return 0; } - -static int amdgpu_atomic_helper_page_flip(struct drm_crtc *crtc, - struct drm_framebuffer *fb, - struct drm_pending_vblank_event *event, - uint32_t flags) -{ - struct drm_plane *plane = crtc->primary; - struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); - struct drm_atomic_state *state; - struct drm_plane_state *plane_state; - struct drm_crtc_state *crtc_state; - int ret = 0; - - state = drm_atomic_state_alloc(plane->dev); - if (!state) - return -ENOMEM; - - ret = drm_crtc_vblank_get(crtc); - if (ret) - return ret; - - state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc); -retry: - crtc_state = drm_atomic_get_crtc_state(state, crtc); - if (IS_ERR(crtc_state)) { - ret = PTR_ERR(crtc_state); - goto fail; - } - crtc_state->event = event; - - plane_state = drm_atomic_get_plane_state(state, plane); - if (IS_ERR(plane_state)) { - ret = PTR_ERR(plane_state); - goto fail; - } - - ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); - if (ret != 0) - goto fail; - drm_atomic_set_fb_for_plane(plane_state, fb); - - /* Make sure we don't accidentally do a full modeset. */ - state->allow_modeset = false; - if (!crtc_state->active) { - DRM_DEBUG_ATOMIC("[CRTC:%d] disabled, rejecting legacy flip\n", -crtc->base.id); - ret = -EINVAL; - goto fail; - } - acrtc->flip_flags = flags; - - ret = drm_atomic_nonblocking_commit(state); - -fail: - if (ret == -EDEADLK) - goto backoff; - - if (ret) - drm_crtc_vblank_put(crtc); - - drm_atomic_state_put(state); - - return ret; -backoff: - drm_atomic_state_clear(state); - drm_atomic_legacy_backoff(state); - - /* -* Someone might have exchanged the framebuffer while we dropped locks -* in the backoff code. We need to fix up the fb refcount tracking the -* core does for us. -*/ - plane->old_fb = plane->fb; - - goto retry; -} - /* Implemented only the options currently availible for the driver */ static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = { .reset = drm_atomic_helper_crtc_reset, @@ -1145,7 +1068,7 @@ static int amdgpu_atomic_helper_page_flip(struct drm_crtc *crtc, .destroy = amdgpu_dm_crtc_destroy, .gamma_set = amdgpu_dm_atomic_crtc_gamma_set, .set_config = drm_atomic_helper_set_config, - .page_flip = amdgpu_atomic_helper_page_flip, + .page_flip_target = drm_atomic_helper_page_flip_target, .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, .atomic_set_property = dm_crtc_funcs_atomic_set_property @@ -1679,7 +1602,7 @@ static bool page_flip_needed( sizeof(old_state_tmp)) == 0 ? true:false; if (new_state->crtc && page_flip_required == false) { acrtc_new = to_amdgpu_crtc(new_state->crtc); - if (acrtc_new->flip_flags & DRM_MODE_PAGE_FLIP_ASYNC) + if (new_state->pflip_flags & DRM_MODE_PAGE_FLIP_ASYNC) page_flip_required = true; } return page_flip_required; @@ -2760,7 +2683,6 @@ int amdgpu_dm_atomic_commit( for_each_plane_in_state(state, plane, old_plane_state, i) { struct drm_plane_state *plane_state = plane->state; struct drm_crtc *crtc = plane_state->crtc; - struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); struct drm_framebuffer *fb = plane_state->fb; if (!fb || !crtc || !crtc->state->planes_changed || @@ -2771,10 +2693,9 @@ int amdgpu_dm_atomic_commit( ret = amdgpu_crtc_page_flip_target(crtc, fb, crtc->state->event, - acrtc->flip_flags, - drm_crtc_
[Nouveau] [PATCH v2 2/3] drm/amd/display: Switch to using atomic_helper for flip.
Signed-off-by: Andrey Grodzovsky --- drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 - .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c| 92 ++ 2 files changed, 6 insertions(+), 87 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h index 4c0a86e..3ff3c14 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h @@ -443,7 +443,6 @@ struct amdgpu_crtc { enum amdgpu_interrupt_state vsync_timer_enabled; int otg_inst; - uint32_t flip_flags; /* After Set Mode target will be non-NULL */ struct dc_target *target; }; diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c index a443b70..d4664bf 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c @@ -1060,83 +1060,6 @@ static int dm_crtc_funcs_atomic_set_property( return 0; } - -static int amdgpu_atomic_helper_page_flip(struct drm_crtc *crtc, - struct drm_framebuffer *fb, - struct drm_pending_vblank_event *event, - uint32_t flags) -{ - struct drm_plane *plane = crtc->primary; - struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); - struct drm_atomic_state *state; - struct drm_plane_state *plane_state; - struct drm_crtc_state *crtc_state; - int ret = 0; - - state = drm_atomic_state_alloc(plane->dev); - if (!state) - return -ENOMEM; - - ret = drm_crtc_vblank_get(crtc); - if (ret) - return ret; - - state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc); -retry: - crtc_state = drm_atomic_get_crtc_state(state, crtc); - if (IS_ERR(crtc_state)) { - ret = PTR_ERR(crtc_state); - goto fail; - } - crtc_state->event = event; - - plane_state = drm_atomic_get_plane_state(state, plane); - if (IS_ERR(plane_state)) { - ret = PTR_ERR(plane_state); - goto fail; - } - - ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); - if (ret != 0) - goto fail; - drm_atomic_set_fb_for_plane(plane_state, fb); - - /* Make sure we don't accidentally do a full modeset. */ - state->allow_modeset = false; - if (!crtc_state->active) { - DRM_DEBUG_ATOMIC("[CRTC:%d] disabled, rejecting legacy flip\n", -crtc->base.id); - ret = -EINVAL; - goto fail; - } - acrtc->flip_flags = flags; - - ret = drm_atomic_nonblocking_commit(state); - -fail: - if (ret == -EDEADLK) - goto backoff; - - if (ret) - drm_crtc_vblank_put(crtc); - - drm_atomic_state_put(state); - - return ret; -backoff: - drm_atomic_state_clear(state); - drm_atomic_legacy_backoff(state); - - /* -* Someone might have exchanged the framebuffer while we dropped locks -* in the backoff code. We need to fix up the fb refcount tracking the -* core does for us. -*/ - plane->old_fb = plane->fb; - - goto retry; -} - /* Implemented only the options currently availible for the driver */ static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = { .reset = drm_atomic_helper_crtc_reset, @@ -1145,7 +1068,7 @@ static int amdgpu_atomic_helper_page_flip(struct drm_crtc *crtc, .destroy = amdgpu_dm_crtc_destroy, .gamma_set = amdgpu_dm_atomic_crtc_gamma_set, .set_config = drm_atomic_helper_set_config, - .page_flip = amdgpu_atomic_helper_page_flip, + .page_flip_target = drm_atomic_helper_page_flip_target, .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, .atomic_set_property = dm_crtc_funcs_atomic_set_property @@ -1679,7 +1602,7 @@ static bool page_flip_needed( sizeof(old_state_tmp)) == 0 ? true:false; if (new_state->crtc && page_flip_required == false) { acrtc_new = to_amdgpu_crtc(new_state->crtc); - if (acrtc_new->flip_flags & DRM_MODE_PAGE_FLIP_ASYNC) + if (new_state->pflip_flags & DRM_MODE_PAGE_FLIP_ASYNC) page_flip_required = true; } return page_flip_required; @@ -2760,7 +2683,6 @@ int amdgpu_dm_atomic_commit( for_each_plane_in_state(state, plane, old_plane_state, i) { struct drm_plane_state *plane_state = plane->state; struct drm_crtc *crtc = plane_state->crtc; - struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); struct drm_framebuffer *fb = plane_state->fb;
[Nouveau] [PATCH v2 3/3] drm/nouveau/kms/nv50: Switch to using atomic helper for flip.
Change-Id: I5a3189c03e389af2ff6c13d870a7d28282b7b0ee Signed-off-by: Andrey Grodzovsky --- drivers/gpu/drm/nouveau/nv50_display.c | 77 +++--- 1 file changed, 5 insertions(+), 72 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index 2c2c645..419e00c 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c @@ -846,6 +846,10 @@ struct nv50_wndw_func { asyw->image.w = fb->base.width; asyw->image.h = fb->base.height; asyw->image.kind = (fb->nvbo->tile_flags & 0xff00) >> 8; + + asyw->interval = + asyw->state.pflip_flags & DRM_MODE_PAGE_FLIP_ASYNC ? 0 : 1; + if (asyw->image.kind) { asyw->image.layout = 0; if (drm->device.info.chipset >= 0xc0) @@ -2221,77 +2225,6 @@ struct nv50_base { .atomic_check = nv50_head_atomic_check, }; -/* This is identical to the version in the atomic helpers, except that - * it supports non-vblanked ("async") page flips. - */ -static int -nv50_head_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, - struct drm_pending_vblank_event *event, u32 flags) -{ - struct drm_plane *plane = crtc->primary; - struct drm_atomic_state *state; - struct drm_plane_state *plane_state; - struct drm_crtc_state *crtc_state; - int ret = 0; - - state = drm_atomic_state_alloc(plane->dev); - if (!state) - return -ENOMEM; - - state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc); -retry: - crtc_state = drm_atomic_get_crtc_state(state, crtc); - if (IS_ERR(crtc_state)) { - ret = PTR_ERR(crtc_state); - goto fail; - } - crtc_state->event = event; - - plane_state = drm_atomic_get_plane_state(state, plane); - if (IS_ERR(plane_state)) { - ret = PTR_ERR(plane_state); - goto fail; - } - - ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); - if (ret != 0) - goto fail; - drm_atomic_set_fb_for_plane(plane_state, fb); - - /* Make sure we don't accidentally do a full modeset. */ - state->allow_modeset = false; - if (!crtc_state->active) { - DRM_DEBUG_ATOMIC("[CRTC:%d] disabled, rejecting legacy flip\n", -crtc->base.id); - ret = -EINVAL; - goto fail; - } - - if (flags & DRM_MODE_PAGE_FLIP_ASYNC) - nv50_wndw_atom(plane_state)->interval = 0; - - ret = drm_atomic_nonblocking_commit(state); -fail: - if (ret == -EDEADLK) - goto backoff; - - drm_atomic_state_put(state); - return ret; - -backoff: - drm_atomic_state_clear(state); - drm_atomic_legacy_backoff(state); - - /* -* Someone might have exchanged the framebuffer while we dropped locks -* in the backoff code. We need to fix up the fb refcount tracking the -* core does for us. -*/ - plane->old_fb = plane->fb; - - goto retry; -} - static int nv50_head_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, uint32_t size) @@ -2386,7 +2319,7 @@ struct nv50_base { .gamma_set = nv50_head_gamma_set, .destroy = nv50_head_destroy, .set_config = drm_atomic_helper_set_config, - .page_flip = nv50_head_page_flip, + .page_flip = drm_atomic_helper_page_flip, .set_property = drm_atomic_helper_crtc_set_property, .atomic_duplicate_state = nv50_head_atomic_duplicate_state, .atomic_destroy_state = nv50_head_atomic_destroy_state, -- 1.9.1 ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
[Nouveau] [PATCH 4/4] drm/nouveau/kms/nv50: Switch to using atomic helper for flip.
Signed-off-by: Andrey Grodzovsky --- drivers/gpu/drm/nouveau/nv50_display.c | 77 +++--- 1 file changed, 5 insertions(+), 72 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index 2c2c645..419e00c 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c @@ -846,6 +846,10 @@ struct nv50_wndw_func { asyw->image.w = fb->base.width; asyw->image.h = fb->base.height; asyw->image.kind = (fb->nvbo->tile_flags & 0xff00) >> 8; + + asyw->interval = + asyw->state.pflip_flags & DRM_MODE_PAGE_FLIP_ASYNC ? 0 : 1; + if (asyw->image.kind) { asyw->image.layout = 0; if (drm->device.info.chipset >= 0xc0) @@ -2221,77 +2225,6 @@ struct nv50_base { .atomic_check = nv50_head_atomic_check, }; -/* This is identical to the version in the atomic helpers, except that - * it supports non-vblanked ("async") page flips. - */ -static int -nv50_head_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, - struct drm_pending_vblank_event *event, u32 flags) -{ - struct drm_plane *plane = crtc->primary; - struct drm_atomic_state *state; - struct drm_plane_state *plane_state; - struct drm_crtc_state *crtc_state; - int ret = 0; - - state = drm_atomic_state_alloc(plane->dev); - if (!state) - return -ENOMEM; - - state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc); -retry: - crtc_state = drm_atomic_get_crtc_state(state, crtc); - if (IS_ERR(crtc_state)) { - ret = PTR_ERR(crtc_state); - goto fail; - } - crtc_state->event = event; - - plane_state = drm_atomic_get_plane_state(state, plane); - if (IS_ERR(plane_state)) { - ret = PTR_ERR(plane_state); - goto fail; - } - - ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); - if (ret != 0) - goto fail; - drm_atomic_set_fb_for_plane(plane_state, fb); - - /* Make sure we don't accidentally do a full modeset. */ - state->allow_modeset = false; - if (!crtc_state->active) { - DRM_DEBUG_ATOMIC("[CRTC:%d] disabled, rejecting legacy flip\n", -crtc->base.id); - ret = -EINVAL; - goto fail; - } - - if (flags & DRM_MODE_PAGE_FLIP_ASYNC) - nv50_wndw_atom(plane_state)->interval = 0; - - ret = drm_atomic_nonblocking_commit(state); -fail: - if (ret == -EDEADLK) - goto backoff; - - drm_atomic_state_put(state); - return ret; - -backoff: - drm_atomic_state_clear(state); - drm_atomic_legacy_backoff(state); - - /* -* Someone might have exchanged the framebuffer while we dropped locks -* in the backoff code. We need to fix up the fb refcount tracking the -* core does for us. -*/ - plane->old_fb = plane->fb; - - goto retry; -} - static int nv50_head_gamma_set(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, uint32_t size) @@ -2386,7 +2319,7 @@ struct nv50_base { .gamma_set = nv50_head_gamma_set, .destroy = nv50_head_destroy, .set_config = drm_atomic_helper_set_config, - .page_flip = nv50_head_page_flip, + .page_flip = drm_atomic_helper_page_flip, .set_property = drm_atomic_helper_crtc_set_property, .atomic_duplicate_state = nv50_head_atomic_duplicate_state, .atomic_destroy_state = nv50_head_atomic_destroy_state, -- 1.9.1 ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
[Nouveau] [PATCH v2 0/3] Allow ASYNC flip with atomic helpers.
This series is a folow-up on https://patchwork.kernel.org/patch/9501787/ The first patch makes changes to atomic helpers to allow for drives with ASYNC flip support to use them. Patch 2 is to use this in AMDGPU/DC. Patch 3 is possible cleanup in nouveau/kms who seems to have to duplicate the helper as we did to support ASYNC flips. v2: Resend drm/atomic: Save flip flags in drm_plane_state since the original patch was incomplete. Squash 2 AMD changes into one to not break compilation. Andrey Grodzovsky (3): drm/atomic: Save flip flags in drm_plane_state drm/amd/display: Switch to using atomic_helper for flip. drm/nouveau/kms/nv50: Switch to using atomic helper for flip. drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 - .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c| 92 ++ drivers/gpu/drm/drm_atomic_helper.c| 18 ++--- drivers/gpu/drm/nouveau/nv50_display.c | 77 ++ include/drm/drm_plane.h| 8 ++ 5 files changed, 24 insertions(+), 172 deletions(-) -- 1.9.1 ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
[Nouveau] [PATCH v2 1/3] drm/atomic: Save flip flags in drm_plane_state
Allows using atomic flip helpers for drivers using ASYNC flip. Remove ASYNC_FLIP restriction in helpers and caches the page flip flags in drm_plane_state to be used in the low level drivers. v2: Resending the patch since the original was broken. Remove comment about not supporting ASYNC flips. Change-Id: I0219c3ec3ecceb82143ee176d30cb50d9aa76bf0 Signed-off-by: Andrey Grodzovsky --- drivers/gpu/drm/drm_atomic_helper.c | 18 +- include/drm/drm_plane.h | 8 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index a4e5477..12f70f2 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -2737,7 +2737,8 @@ static int page_flip_common( struct drm_atomic_state *state, struct drm_crtc *crtc, struct drm_framebuffer *fb, - struct drm_pending_vblank_event *event) + struct drm_pending_vblank_event *event, + uint32_t flags) { struct drm_plane *plane = crtc->primary; struct drm_plane_state *plane_state; @@ -2754,6 +2755,7 @@ static int page_flip_common( if (IS_ERR(plane_state)) return PTR_ERR(plane_state); + plane_state->pflip_flags = flags; ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); if (ret != 0) @@ -2781,10 +2783,6 @@ static int page_flip_common( * Provides a default &drm_crtc_funcs.page_flip implementation * using the atomic driver interface. * - * Note that for now so called async page flips (i.e. updates which are not - * synchronized to vblank) are not supported, since the atomic interfaces have - * no provisions for this yet. - * * Returns: * Returns 0 on success, negative errno numbers on failure. * @@ -2800,9 +2798,6 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc, struct drm_atomic_state *state; int ret = 0; - if (flags & DRM_MODE_PAGE_FLIP_ASYNC) - return -EINVAL; - state = drm_atomic_state_alloc(plane->dev); if (!state) return -ENOMEM; @@ -2810,7 +2805,7 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc, state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc); retry: - ret = page_flip_common(state, crtc, fb, event); + ret = page_flip_common(state, crtc, fb, event, flags); if (ret != 0) goto fail; @@ -2865,9 +2860,6 @@ int drm_atomic_helper_page_flip_target( struct drm_crtc_state *crtc_state; int ret = 0; - if (flags & DRM_MODE_PAGE_FLIP_ASYNC) - return -EINVAL; - state = drm_atomic_state_alloc(plane->dev); if (!state) return -ENOMEM; @@ -2875,7 +2867,7 @@ int drm_atomic_helper_page_flip_target( state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc); retry: - ret = page_flip_common(state, crtc, fb, event); + ret = page_flip_common(state, crtc, fb, event, flags); if (ret != 0) goto fail; diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index db3bbde..86d8ffc 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -122,6 +122,14 @@ struct drm_plane_state { */ bool visible; + + /** +* @pflip_flags: +* +* Flip related config options +*/ + u32 pflip_flags; + struct drm_atomic_state *state; }; -- 1.9.1 ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
[Nouveau] [PATCH 0/4] Allow ASYNC flip with atomic helpers.
This series is a folow-up on https://patchwork.kernel.org/patch/9501787/ The first patch makes changes to atomic helpers to allow for drives with ASYNC flip support to use them. Patches 2 and 3 are to use this in AMDGPU/DC and patch 4 is possible cleanup in nouveau/kms who seems to have the duplicate the helper as we did to support ASYNC flips. Andrey Grodzovsky (4): drm/atomic: Save flip flags in drm_plane_state drm/amdgpu: Remove flip_flag from amdgpu_crtc drm/amd/display: Switch to using atomic_helper for flip. drm/nouveau/kms/nv50: Switch to using atomic helper for flip. drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 - .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c| 92 ++ drivers/gpu/drm/drm_atomic_helper.c| 10 +-- drivers/gpu/drm/nouveau/nv50_display.c | 77 ++ include/drm/drm_plane.h| 8 ++ 5 files changed, 22 insertions(+), 166 deletions(-) -- 1.9.1 ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
[Nouveau] [PATCH 1/4] drm/atomic: Save flip flags in drm_plane_state
Allows using atomic flip helpers for drivers using ASYNC flip. Remove ASYNC_FLIP restriction in helpers and caches the page flip flags in drm_plane_state to be used in the low level drivers. Signed-off-by: Andrey Grodzovsky --- drivers/gpu/drm/drm_atomic_helper.c | 10 +++--- include/drm/drm_plane.h | 8 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index a4e5477..f83dc43 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -2737,7 +2737,8 @@ static int page_flip_common( struct drm_atomic_state *state, struct drm_crtc *crtc, struct drm_framebuffer *fb, - struct drm_pending_vblank_event *event) + struct drm_pending_vblank_event *event, + uint32_t flags) { struct drm_plane *plane = crtc->primary; struct drm_plane_state *plane_state; @@ -2754,6 +2755,7 @@ static int page_flip_common( if (IS_ERR(plane_state)) return PTR_ERR(plane_state); + plane_state->pflip_flags = flags; ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); if (ret != 0) @@ -2800,9 +2802,6 @@ int drm_atomic_helper_page_flip(struct drm_crtc *crtc, struct drm_atomic_state *state; int ret = 0; - if (flags & DRM_MODE_PAGE_FLIP_ASYNC) - return -EINVAL; - state = drm_atomic_state_alloc(plane->dev); if (!state) return -ENOMEM; @@ -2865,9 +2864,6 @@ int drm_atomic_helper_page_flip_target( struct drm_crtc_state *crtc_state; int ret = 0; - if (flags & DRM_MODE_PAGE_FLIP_ASYNC) - return -EINVAL; - state = drm_atomic_state_alloc(plane->dev); if (!state) return -ENOMEM; diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index db3bbde..86d8ffc 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -122,6 +122,14 @@ struct drm_plane_state { */ bool visible; + + /** +* @pflip_flags: +* +* Flip related config options +*/ + u32 pflip_flags; + struct drm_atomic_state *state; }; -- 1.9.1 ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
Re: [Nouveau] [PATCH 3/4] drm/amd/display: Switch to using atomic_helper for flip.
Hi Andrey, Thank you for the patch. On Monday 16 Jan 2017 10:44:57 Andrey Grodzovsky wrote: > Change-Id: Iad3e0b9b3546e4e4dc79be9233daf4fe4dba83e0 > Signed-off-by: Andrey Grodzovsky > --- > .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c| 92 ++ > 1 file changed, 6 insertions(+), 86 deletions(-) > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c > b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c index > a443b70..d4664bf 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c > @@ -1060,83 +1060,6 @@ static int dm_crtc_funcs_atomic_set_property( > return 0; > } > > - > -static int amdgpu_atomic_helper_page_flip(struct drm_crtc *crtc, > - struct drm_framebuffer *fb, > - struct drm_pending_vblank_event *event, > - uint32_t flags) > -{ > - struct drm_plane *plane = crtc->primary; > - struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); > - struct drm_atomic_state *state; > - struct drm_plane_state *plane_state; > - struct drm_crtc_state *crtc_state; > - int ret = 0; > - > - state = drm_atomic_state_alloc(plane->dev); > - if (!state) > - return -ENOMEM; > - > - ret = drm_crtc_vblank_get(crtc); The DRM core's atomic page flip helper doesn't get/put vblank. Have you double-checked that removing them isn't a problem ? > - if (ret) > - return ret; > - > - state->acquire_ctx = drm_modeset_legacy_acquire_ctx(crtc); > -retry: > - crtc_state = drm_atomic_get_crtc_state(state, crtc); > - if (IS_ERR(crtc_state)) { > - ret = PTR_ERR(crtc_state); > - goto fail; > - } > - crtc_state->event = event; > - > - plane_state = drm_atomic_get_plane_state(state, plane); > - if (IS_ERR(plane_state)) { > - ret = PTR_ERR(plane_state); > - goto fail; > - } > - > - ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); > - if (ret != 0) > - goto fail; > - drm_atomic_set_fb_for_plane(plane_state, fb); > - > - /* Make sure we don't accidentally do a full modeset. */ > - state->allow_modeset = false; > - if (!crtc_state->active) { > - DRM_DEBUG_ATOMIC("[CRTC:%d] disabled, rejecting legacy flip\n", > - crtc->base.id); > - ret = -EINVAL; > - goto fail; > - } > - acrtc->flip_flags = flags; > - > - ret = drm_atomic_nonblocking_commit(state); > - > -fail: > - if (ret == -EDEADLK) > - goto backoff; > - > - if (ret) > - drm_crtc_vblank_put(crtc); > - > - drm_atomic_state_put(state); > - > - return ret; > -backoff: > - drm_atomic_state_clear(state); > - drm_atomic_legacy_backoff(state); > - > - /* > - * Someone might have exchanged the framebuffer while we dropped locks > - * in the backoff code. We need to fix up the fb refcount tracking the > - * core does for us. > - */ > - plane->old_fb = plane->fb; > - > - goto retry; > -} > - > /* Implemented only the options currently availible for the driver */ > static const struct drm_crtc_funcs amdgpu_dm_crtc_funcs = { > .reset = drm_atomic_helper_crtc_reset, > @@ -1145,7 +1068,7 @@ static int amdgpu_atomic_helper_page_flip(struct > drm_crtc *crtc, .destroy = amdgpu_dm_crtc_destroy, > .gamma_set = amdgpu_dm_atomic_crtc_gamma_set, > .set_config = drm_atomic_helper_set_config, > - .page_flip = amdgpu_atomic_helper_page_flip, > + .page_flip_target = drm_atomic_helper_page_flip_target, > .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, > .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, > .atomic_set_property = dm_crtc_funcs_atomic_set_property > @@ -1679,7 +1602,7 @@ static bool page_flip_needed( > sizeof(old_state_tmp)) == 0 ? true:false; > if (new_state->crtc && page_flip_required == false) { > acrtc_new = to_amdgpu_crtc(new_state->crtc); > - if (acrtc_new->flip_flags & DRM_MODE_PAGE_FLIP_ASYNC) > + if (new_state->pflip_flags & DRM_MODE_PAGE_FLIP_ASYNC) > page_flip_required = true; > } > return page_flip_required; > @@ -2760,7 +2683,6 @@ int amdgpu_dm_atomic_commit( > for_each_plane_in_state(state, plane, old_plane_state, i) { > struct drm_plane_state *plane_state = plane->state; > struct drm_crtc *crtc = plane_state->crtc; > - struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc); > struct drm_framebuffer *fb = plane_state->fb; > > if (!fb || !crtc || !crtc->state->planes_changed || > @@ -2771,10 +2693,9 @@ int amdgpu_dm_atomic_commit( > ret = amdgpu_crtc_page_flip_target(crt
Re: [Nouveau] [PATCH 0/4] Allow ASYNC flip with atomic helpers.
Hi Harry, On Monday 16 Jan 2017 16:13:39 Harry Wentland wrote: > On 2017-01-16 03:39 PM, Laurent Pinchart wrote: > > On Monday 16 Jan 2017 10:44:54 Andrey Grodzovsky wrote: > >> This series is a folow-up on > >> https://patchwork.kernel.org/patch/9501787/ > >> > >> The first patch makes changes to atomic helpers > >> to allow for drives with ASYNC flip support to use them. > >> Patches 2 and 3 are to use this in AMDGPU/DC and > >> patch 4 is possible cleanup in nouveau/kms who seems > >> to have the duplicate the helper as we did to support > >> ASYNC flips. > > > > I have my doubts regarding this. I'd much rather see userspace moving to > > the atomic API instead of extending support for legacy APIs. > > This change is not about introducing the async flag but cleaning up the > legacy helpers to make sure drivers that currently use it through the > legacy IOCTLs can benefit from the helpers and not have to roll their own. > > If the problem is with the pflip_flags, wouldn't drivers still need that > after moving userspace to the atomic IOCTL? > > I don't disagree with you on having userspace move to atomic but I don't > expect to see all userspace drivers move to atomic in the next couple > months. Why not clean this up in the meantime? If this patch series was just about moving common driver code into the core, sure, but it goes beyond that. Or, actually, it needs to go beyond that, but doesn't yet. Removing the DRM_MODE_PAGE_FLIP_ASYNC test in patch 1/4 means that the DRM core will not reject async page flips anymore, for any driver that uses the helper. You thus need to either patch all drivers that use the helper to reject the flag, or implement the feature in the drivers (and preferably in the helpers then). The current version of this patch series will make all existing users of the helpers accept async page flips without actually implementing them. > >> Andrey Grodzovsky (4): > >> drm/atomic: Save flip flags in drm_plane_state > >> drm/amdgpu: Remove flip_flag from amdgpu_crtc > >> drm/amd/display: Switch to using atomic_helper for flip. > >> drm/nouveau/kms/nv50: Switch to using atomic helper for flip. > >> > >> drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 - > >> .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c| 92 --- > >> drivers/gpu/drm/drm_atomic_helper.c| 10 +-- > >> drivers/gpu/drm/nouveau/nv50_display.c | 77 ++- > >> include/drm/drm_plane.h| 8 ++ > >> 5 files changed, 22 insertions(+), 166 deletions(-) -- Regards, Laurent Pinchart ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
[Nouveau] [PATCH 2/4] drm/amdgpu: Remove flip_flag from amdgpu_crtc
Follwing introduction of pflip_flags in drm_plane_state this is not needed anymore. Signed-off-by: Andrey Grodzovsky --- drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h index 4c0a86e..3ff3c14 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h @@ -443,7 +443,6 @@ struct amdgpu_crtc { enum amdgpu_interrupt_state vsync_timer_enabled; int otg_inst; - uint32_t flip_flags; /* After Set Mode target will be non-NULL */ struct dc_target *target; }; -- 1.9.1 ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
Re: [Nouveau] [PATCH 1/4] drm/atomic: Save flip flags in drm_plane_state
> -Original Message- > From: Gustavo Padovan [mailto:gust...@padovan.org] > Sent: Monday, January 16, 2017 3:22 PM > To: Grodzovsky, Andrey > Cc: dri-de...@lists.freedesktop.org; nouveau@lists.freedesktop.org; amd- > g...@lists.freedesktop.org; Deucher, Alexander; daniel.vet...@intel.com > Subject: Re: [PATCH 1/4] drm/atomic: Save flip flags in drm_plane_state > > Hi Andrey, > > 2017-01-16 Andrey Grodzovsky : > > > Allows using atomic flip helpers for drivers using ASYNC flip. > > Remove ASYNC_FLIP restriction in helpers and caches the page flip > > flags in drm_plane_state to be used in the low level drivers. > > > > Signed-off-by: Andrey Grodzovsky > > --- > > drivers/gpu/drm/drm_atomic_helper.c | 10 +++--- > > include/drm/drm_plane.h | 8 > > 2 files changed, 11 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c > > b/drivers/gpu/drm/drm_atomic_helper.c > > index a4e5477..f83dc43 100644 > > --- a/drivers/gpu/drm/drm_atomic_helper.c > > +++ b/drivers/gpu/drm/drm_atomic_helper.c > > @@ -2737,7 +2737,8 @@ static int page_flip_common( > > struct drm_atomic_state *state, > > struct drm_crtc *crtc, > > struct drm_framebuffer *fb, > > - struct drm_pending_vblank_event *event) > > + struct drm_pending_vblank_event *event, > > + uint32_t flags) > > Did you build this patch? It is changing the signature of > page_flip_common() but no changes to the callers. > > Gustavo Thanks for spotting this, I am afraid I've sent not the final version of the patch. I will resend the latest version later today. Thanks Andrey ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
Re: [Nouveau] [PATCH 0/4] Allow ASYNC flip with atomic helpers.
On 2017-01-16 03:39 PM, Laurent Pinchart wrote: Hi Andrey, Thank you for the patches. On Monday 16 Jan 2017 10:44:54 Andrey Grodzovsky wrote: This series is a folow-up on https://patchwork.kernel.org/patch/9501787/ The first patch makes changes to atomic helpers to allow for drives with ASYNC flip support to use them. Patches 2 and 3 are to use this in AMDGPU/DC and patch 4 is possible cleanup in nouveau/kms who seems to have the duplicate the helper as we did to support ASYNC flips. I have my doubts regarding this. I'd much rather see userspace moving to the atomic API instead of extending support for legacy APIs. This change is not about introducing the async flag but cleaning up the legacy helpers to make sure drivers that currently use it through the legacy IOCTLs can benefit from the helpers and not have to roll their own. If the problem is with the pflip_flags, wouldn't drivers still need that after moving userspace to the atomic IOCTL? I don't disagree with you on having userspace move to atomic but I don't expect to see all userspace drivers move to atomic in the next couple months. Why not clean this up in the meantime? Harry Andrey Grodzovsky (4): drm/atomic: Save flip flags in drm_plane_state drm/amdgpu: Remove flip_flag from amdgpu_crtc drm/amd/display: Switch to using atomic_helper for flip. drm/nouveau/kms/nv50: Switch to using atomic helper for flip. drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 - .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c| 92 --- drivers/gpu/drm/drm_atomic_helper.c| 10 +-- drivers/gpu/drm/nouveau/nv50_display.c | 77 ++ include/drm/drm_plane.h| 8 ++ 5 files changed, 22 insertions(+), 166 deletions(-) ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
Re: [Nouveau] [PATCH 0/4] Allow ASYNC flip with atomic helpers.
Hi Andrey, Thank you for the patches. On Monday 16 Jan 2017 10:44:54 Andrey Grodzovsky wrote: > This series is a folow-up on > https://patchwork.kernel.org/patch/9501787/ > > The first patch makes changes to atomic helpers > to allow for drives with ASYNC flip support to use them. > Patches 2 and 3 are to use this in AMDGPU/DC and > patch 4 is possible cleanup in nouveau/kms who seems > to have the duplicate the helper as we did to support > ASYNC flips. I have my doubts regarding this. I'd much rather see userspace moving to the atomic API instead of extending support for legacy APIs. > Andrey Grodzovsky (4): > drm/atomic: Save flip flags in drm_plane_state > drm/amdgpu: Remove flip_flag from amdgpu_crtc > drm/amd/display: Switch to using atomic_helper for flip. > drm/nouveau/kms/nv50: Switch to using atomic helper for flip. > > drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 - > .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c| 92 --- > drivers/gpu/drm/drm_atomic_helper.c| 10 +-- > drivers/gpu/drm/nouveau/nv50_display.c | 77 ++ > include/drm/drm_plane.h| 8 ++ > 5 files changed, 22 insertions(+), 166 deletions(-) -- Regards, Laurent Pinchart ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau
Re: [Nouveau] [PATCH 2/4] drm/amdgpu: Remove flip_flag from amdgpu_crtc
Hi Andrey, Thank you for the patch. On Monday 16 Jan 2017 10:44:56 Andrey Grodzovsky wrote: > Follwing introduction of pflip_flags in drm_plane_state > this is not needed anymore. > > Signed-off-by: Andrey Grodzovsky > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h > b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h index 4c0a86e..3ff3c14 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h > @@ -443,7 +443,6 @@ struct amdgpu_crtc { > enum amdgpu_interrupt_state vsync_timer_enabled; > > int otg_inst; > - uint32_t flip_flags; This breaks compilation of the amdgpu driver. You should squash this patch with 3/4. > /* After Set Mode target will be non-NULL */ > struct dc_target *target; > }; -- Regards, Laurent Pinchart ___ Nouveau mailing list Nouveau@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/nouveau