Skip to contentSkip to conversation

drm: Add getfb2 ioctl

PATCH RESEND Superseded Juston Li 6 participants 14 messages Oct 3, 2019 – Dec 14, 2019

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Juston Li

author
#0 lore raw

PATCH RESEND v2 1/1 drm: Add getfb2 ioctl

From: Daniel Stone <[email protected]>

getfb2 allows us to pass multiple planes and modifiers, just like addfb2 over addfb.

Changes since v1:
- unused modifiers set to 0 instead of DRM_FORMAT_MOD_INVALID
- update ioctl number

---
 drivers/gpu/drm/drm_crtc_internal.h |   2 +
 drivers/gpu/drm/drm_framebuffer.c   | 110 ++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_ioctl.c         |   1 +
 include/uapi/drm/drm.h              |   2 +
 4 files changed, 115 insertions(+)
drivers/gpu/drm/drm_crtc_internal.h +2 -0
index c7d5e4c21423..16f2413403aa 100644
@@ -216,6 +216,8 @@ int drm_mode_rmfb_ioctl(struct drm_device *dev,
 			void *data, struct drm_file *file_priv);
 int drm_mode_getfb(struct drm_device *dev,
 		   void *data, struct drm_file *file_priv);
+int drm_mode_getfb2_ioctl(struct drm_device *dev,
+			  void *data, struct drm_file *file_priv);
 int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
 			   void *data, struct drm_file *file_priv);
 
drivers/gpu/drm/drm_framebuffer.c +110 -0

123 lines not on this page · raw message

drivers/gpu/drm/drm_ioctl.c +1 -0
index fcd728d7cf72..b1fafce3ad8c 100644
@@ -671,6 +671,7 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETPROPERTY, drm_connector_property_set_ioctl, DRM_MASTER),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPBLOB, drm_mode_getblob_ioctl, 0),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB, drm_mode_getfb, 0),
+	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB2, drm_mode_getfb2_ioctl, 0),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB, drm_mode_addfb_ioctl, 0),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB2, drm_mode_addfb2_ioctl, 0),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb_ioctl, 0),
include/uapi/drm/drm.h +2 -0
index 8a5b2f8f8eb9..021f33675ba2 100644
@@ -947,6 +947,8 @@ extern "C" {
 #define DRM_IOCTL_SYNCOBJ_TRANSFER	DRM_IOWR(0xCC, struct drm_syncobj_transfer)
 #define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL	DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)
 
+#define DRM_IOCTL_MODE_GETFB2		DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)
+
 /**
  * Device specific ioctls should only be in their respective headers
  * The device specific ioctl range is from 0x40 to 0x9f.
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✓ Fi.CI.BAT: success for drm: Add getfb2 ioctl

== Series Details ==

== Series Details ==

Series: drm: Add getfb2 ioctl
URL : https://patchwork.freedesktop.org/series/67553/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_7000 -> Patchwork_14656
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/index.html

Known issues
------------

Here are the changes found in Patchwork_14656 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_suspend@basic-s3:
- fi-blb-e6850: [PASS][1] -> [INCOMPLETE][2] ([fdo#107718])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/fi-blb-e6850/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/fi-blb-e6850/igt@[email protected]

* igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a:
- fi-icl-u3: [PASS][3] -> [DMESG-WARN][4] ([fdo#107724]) +3 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/fi-icl-u3/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/fi-icl-u3/igt@[email protected]

#### Possible fixes ####

* igt@gem_ctx_create@basic-files:
- {fi-tgl-u}: [INCOMPLETE][5] ([fdo#111735]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/fi-tgl-u/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/fi-tgl-u/igt@[email protected]
- {fi-icl-dsi}: [INCOMPLETE][7] ([fdo#107713] / [fdo#109100]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/fi-icl-dsi/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/fi-icl-dsi/igt@[email protected]

* igt@i915_selftest@live_execlists:
- {fi-icl-guc}: [INCOMPLETE][9] ([fdo#107713]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/fi-icl-guc/igt@i915_selftest@live_execlists.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/fi-icl-guc/igt@i915_selftest@live_execlists.html

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-icl-u2: [FAIL][11] ([fdo#109483]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/fi-icl-u2/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/fi-icl-u2/igt@[email protected]
- fi-kbl-7500u: [FAIL][13] ([fdo#111045] / [fdo#111096]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/fi-kbl-7500u/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/fi-kbl-7500u/igt@[email protected]

* igt@prime_self_import@basic-with_fd_dup:
- fi-icl-u3: [DMESG-WARN][15] ([fdo#107724]) -> [PASS][16] +1 similar issue
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/fi-icl-u3/igt@prime_self_import@basic-with_fd_dup.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/fi-icl-u3/igt@prime_self_import@basic-with_fd_dup.html

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#109100]: https://bugs.freedesktop.org/show_bug.cgi?id=109100
[fdo#109483]: https://bugs.freedesktop.org/show_bug.cgi?id=109483
[fdo#110566]: https://bugs.freedesktop.org/show_bug.cgi?id=110566
[fdo#111045]: https://bugs.freedesktop.org/show_bug.cgi?id=111045
[fdo#111096]: https://bugs.freedesktop.org/show_bug.cgi?id=111096
[fdo#111735]: https://bugs.freedesktop.org/show_bug.cgi?id=111735

Participating hosts (52 -> 44)
------------------------------

Missing (8): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-skl-6260u fi-icl-y fi-byt-clapper fi-bdw-samus

Build changes
-------------

* CI: CI-20190529 -> None
* Linux: CI_DRM_7000 -> Patchwork_14656

CI-20190529: 20190529
CI_DRM_7000: a6af6b11a94cbffff1c70dbab04ef1e13d79e4ae @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5211: 1601e1571eb0f29a06b64494040b3ea7859a650f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_14656: 83b146de852e77e9c1090a4d9cc2c88177872b24 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

83b146de852e drm: Add getfb2 ioctl

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

✗ Fi.CI.IGT: failure for drm: Add getfb2 ioctl

In reply to Juston Li
== Series Details ==

== Series Details ==

Series: drm: Add getfb2 ioctl
URL : https://patchwork.freedesktop.org/series/67553/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_7000_full -> Patchwork_14656_full
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_14656_full absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_14656_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_14656_full:

### IGT changes ###

#### Possible regressions ####

* igt@gem_exec_reloc@basic-cpu-active:
- shard-skl: [PASS][1] -> [DMESG-WARN][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-skl6/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-skl4/igt@[email protected]

* igt@gem_mmap_gtt@hang:
- shard-kbl: [PASS][3] -> [DMESG-WARN][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-kbl3/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-kbl2/igt@[email protected]

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@gem_mmap_gtt@hang:
- {shard-tglb}: NOTRUN -> [DMESG-WARN][5]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-tglb6/igt@[email protected]

* igt@kms_vblank@pipe-b-ts-continuation-dpms-suspend:
- {shard-tglb}: [PASS][6] -> [INCOMPLETE][7]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-tglb8/igt@[email protected]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-tglb5/igt@[email protected]

Known issues
------------

Here are the changes found in Patchwork_14656_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_shared@exec-single-timeline-bsd:
- shard-iclb: [PASS][8] -> [SKIP][9] ([fdo#110841])
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-iclb6/igt@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-iclb2/igt@[email protected]

* igt@gem_exec_balancer@smoke:
- shard-iclb: [PASS][10] -> [SKIP][11] ([fdo#110854])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-iclb1/igt@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-iclb5/igt@[email protected]

* igt@gem_exec_schedule@preempt-queue-bsd1:
- shard-iclb: [PASS][12] -> [SKIP][13] ([fdo#109276]) +16 similar issues
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-iclb1/igt@[email protected]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-iclb6/igt@[email protected]

* igt@gem_exec_schedule@reorder-wide-bsd:
- shard-iclb: [PASS][14] -> [SKIP][15] ([fdo#111325]) +6 similar issues
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-iclb8/igt@[email protected]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-iclb1/igt@[email protected]

* igt@gem_tiled_swapping@non-threaded:
- shard-kbl: [PASS][16] -> [DMESG-WARN][17] ([fdo#108686])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-kbl4/igt@[email protected]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-kbl7/igt@[email protected]

* igt@gem_userptr_blits@map-fixed-invalidate-busy:
- shard-hsw: [PASS][18] -> [DMESG-WARN][19] ([fdo#111870])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-hsw6/igt@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-hsw8/igt@[email protected]

* igt@gem_userptr_blits@map-fixed-invalidate-overlap-busy:
- shard-iclb: [PASS][20] -> [DMESG-WARN][21] ([fdo#111870]) +1 similar issue
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-iclb2/igt@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-iclb6/igt@[email protected]

* igt@gem_userptr_blits@sync-unmap:
- shard-snb: [PASS][22] -> [DMESG-WARN][23] ([fdo#111870]) +1 similar issue
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-snb2/igt@[email protected]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-snb1/igt@[email protected]

* igt@gem_userptr_blits@sync-unmap-after-close:
- shard-apl: [PASS][24] -> [DMESG-WARN][25] ([fdo#109385] / [fdo#111870])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-apl1/igt@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-apl3/igt@[email protected]

* igt@i915_suspend@sysfs-reader:
- shard-apl: [PASS][26] -> [DMESG-WARN][27] ([fdo#108566]) +1 similar issue
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-apl4/igt@[email protected]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-apl7/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank:
- shard-glk: [PASS][28] -> [FAIL][29] ([fdo#105363])
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-glk6/igt@[email protected]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-glk4/igt@[email protected]

* igt@kms_flip@plain-flip-fb-recreate:
- shard-skl: [PASS][30] -> [FAIL][31] ([fdo#100368])
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-skl4/igt@[email protected]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-skl9/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-shrfb-draw-pwrite:
- shard-iclb: [PASS][32] -> [FAIL][33] ([fdo#103167]) +3 similar issues
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-iclb7/igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-shrfb-draw-pwrite.html
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-iclb7/igt@kms_frontbuffer_tracking@fbc-1p-offscren-pri-shrfb-draw-pwrite.html

* igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
- shard-skl: [PASS][34] -> [FAIL][35] ([fdo#108145] / [fdo#110403])
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-skl10/igt@[email protected]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-skl4/igt@[email protected]

* igt@kms_psr2_su@page_flip:
- shard-iclb: [PASS][36] -> [SKIP][37] ([fdo#109642] / [fdo#111068])
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-iclb2/igt@kms_psr2_su@page_flip.html
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-iclb4/igt@kms_psr2_su@page_flip.html

* igt@kms_psr@psr2_cursor_blt:
- shard-iclb: [PASS][38] -> [SKIP][39] ([fdo#109441]) +1 similar issue
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-iclb2/igt@kms_psr@psr2_cursor_blt.html
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-iclb6/igt@kms_psr@psr2_cursor_blt.html

* igt@kms_sequence@get-forked:
- shard-hsw: [PASS][40] -> [DMESG-WARN][41] ([fdo#102614])
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-hsw2/igt@[email protected]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-hsw5/igt@[email protected]

* igt@kms_setmode@basic:
- shard-apl: [PASS][42] -> [FAIL][43] ([fdo#99912])
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-apl1/igt@[email protected]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-apl3/igt@[email protected]

#### Possible fixes ####

* igt@gem_ctx_shared@exec-single-timeline-bsd1:
- shard-iclb: [SKIP][44] ([fdo#109276]) -> [PASS][45] +16 similar issues
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-iclb7/igt@[email protected]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-iclb2/igt@[email protected]

* igt@gem_exec_schedule@preempt-bsd:
- shard-iclb: [SKIP][46] ([fdo#111325]) -> [PASS][47] +6 similar issues
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-iclb2/igt@[email protected]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-iclb3/igt@[email protected]

* igt@gem_mmap_gtt@hang:
- shard-apl: [DMESG-WARN][48] ([fdo#109385]) -> [PASS][49]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-apl3/igt@[email protected]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-apl4/igt@[email protected]

* igt@gem_userptr_blits@coherency-sync:
- shard-hsw: [DMESG-WARN][50] ([fdo#111870]) -> [PASS][51]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-hsw1/igt@[email protected]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-hsw7/igt@[email protected]

* igt@gem_userptr_blits@map-fixed-invalidate-busy:
- shard-snb: [DMESG-WARN][52] ([fdo#111870]) -> [PASS][53] +1 similar issue
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-snb7/igt@[email protected]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-snb6/igt@[email protected]

* igt@gem_userptr_blits@map-fixed-invalidate-busy-gup:
- shard-skl: [DMESG-WARN][54] ([fdo#111870]) -> [PASS][55]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-skl4/igt@[email protected]
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-skl10/igt@[email protected]
- shard-glk: [DMESG-WARN][56] ([fdo#111870]) -> [PASS][57]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-glk1/igt@[email protected]
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-glk7/igt@[email protected]

* igt@gem_userptr_blits@sync-unmap-after-close:
- shard-hsw: [DMESG-WARN][58] ([fdo#110789] / [fdo#111870]) -> [PASS][59]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-hsw8/igt@[email protected]
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-hsw6/igt@[email protected]

* {igt@i915_pm_dc@dc6-psr}:
- shard-iclb: [FAIL][60] ([fdo#110548]) -> [PASS][61]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-iclb2/igt@[email protected]
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-iclb6/igt@[email protected]

* igt@i915_selftest@mock_fence:
- {shard-tglb}: [INCOMPLETE][62] ([fdo#111747]) -> [PASS][63]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-tglb4/igt@i915_selftest@mock_fence.html
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-tglb4/igt@i915_selftest@mock_fence.html

* igt@i915_suspend@fence-restore-tiled2untiled:
- shard-apl: [DMESG-WARN][64] ([fdo#108566]) -> [PASS][65] +5 similar issues
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-apl8/igt@[email protected]
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-apl8/igt@[email protected]

* igt@kms_cursor_crc@pipe-b-cursor-256x256-random:
- shard-skl: [FAIL][66] ([fdo#103232]) -> [PASS][67]
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-skl8/igt@[email protected]
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-skl3/igt@[email protected]

* igt@kms_cursor_crc@pipe-b-cursor-64x64-sliding:
- shard-snb: [INCOMPLETE][68] ([fdo#105411]) -> [PASS][69]
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-snb1/igt@[email protected]
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-snb4/igt@[email protected]

* igt@kms_cursor_crc@pipe-b-cursor-alpha-opaque:
- {shard-tglb}: [DMESG-WARN][70] ([fdo#111600]) -> [PASS][71]
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-tglb2/igt@[email protected]
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-tglb1/igt@[email protected]

* igt@kms_flip@flip-vs-modeset-vs-hang:
- shard-apl: [INCOMPLETE][72] ([fdo#103927]) -> [PASS][73] +4 similar issues
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-apl2/igt@[email protected]
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-apl8/igt@[email protected]

* igt@kms_flip@flip-vs-suspend:
- shard-skl: [INCOMPLETE][74] ([fdo#109507]) -> [PASS][75]
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-skl6/igt@[email protected]
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-skl6/igt@[email protected]

* igt@kms_flip@flip-vs-suspend-interruptible:
- shard-kbl: [DMESG-WARN][76] ([fdo#103313]) -> [PASS][77]
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-kbl4/igt@[email protected]
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-kbl3/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-1p-primscrn-pri-indfb-draw-blt:
- shard-iclb: [FAIL][78] ([fdo#103167]) -> [PASS][79] +2 similar issues
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-iclb2/igt@[email protected]
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-iclb6/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-suspend:
- {shard-tglb}: [INCOMPLETE][80] ([fdo#111832]) -> [PASS][81] +2 similar issues
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-tglb7/igt@[email protected]
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-tglb6/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-onoff:
- {shard-tglb}: [FAIL][82] ([fdo#103167]) -> [PASS][83] +4 similar issues
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-tglb4/igt@[email protected]
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-tglb6/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-b-constant-alpha-min:
- shard-skl: [FAIL][84] ([fdo#108145]) -> [PASS][85]
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-skl8/igt@[email protected]
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-skl3/igt@[email protected]

* igt@kms_plane_lowres@pipe-a-tiling-y:
- shard-iclb: [FAIL][86] ([fdo#103166]) -> [PASS][87]
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-iclb6/igt@[email protected]
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-iclb2/igt@[email protected]

* igt@kms_psr@psr2_dpms:
- shard-iclb: [SKIP][88] ([fdo#109441]) -> [PASS][89]
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-iclb8/igt@kms_psr@psr2_dpms.html
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-iclb2/igt@kms_psr@psr2_dpms.html

* igt@kms_vblank@pipe-a-ts-continuation-dpms-suspend:
- shard-skl: [INCOMPLETE][90] ([fdo#104108]) -> [PASS][91]
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-skl5/igt@[email protected]
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-skl7/igt@[email protected]

* igt@perf@polling:
- shard-skl: [FAIL][92] ([fdo#110728]) -> [PASS][93]
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-skl10/igt@[email protected]
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-skl4/igt@[email protected]

#### Warnings ####

* igt@gem_mocs_settings@mocs-reset-bsd2:
- shard-iclb: [FAIL][94] ([fdo#111330]) -> [SKIP][95] ([fdo#109276])
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-iclb1/igt@[email protected]
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-iclb6/igt@[email protected]

* igt@gem_mocs_settings@mocs-reset-dirty-render:
- shard-iclb: [INCOMPLETE][96] ([fdo#107713]) -> [SKIP][97] ([fdo#110206])
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-iclb1/igt@[email protected]
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-iclb7/igt@[email protected]

* igt@gem_mocs_settings@mocs-settings-bsd2:
- shard-iclb: [SKIP][98] ([fdo#109276]) -> [FAIL][99] ([fdo#111330]) +1 similar issue
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7000/shard-iclb3/igt@[email protected]
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/shard-iclb1/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo# 111852 ]: https://bugs.freedesktop.org/show_bug.cgi?id= 111852 [fdo#100368]: https://bugs.freedesktop.org/show_bug.cgi?id=100368
[fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#103313]: https://bugs.freedesktop.org/show_bug.cgi?id=103313
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#104108]: https://bugs.freedesktop.org/show_bug.cgi?id=104108
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#105411]: https://bugs.freedesktop.org/show_bug.cgi?id=105411
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108566]: https://bugs.freedesktop.org/sho

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14656/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
In reply to Juston Li
Quoted 11 lines · Juston Li

From: Daniel Stone <[email protected]>

getfb2 allows us to pass multiple planes and modifiers, just like addfb2 over addfb.

Changes since v1:
- unused modifiers set to 0 instead of DRM_FORMAT_MOD_INVALID
- update ioctl number

Looks all good from a very quick glance (kernel, libdrm, igt), but where's the userspace? Link to weston/drm_hwc/whatever MR good enough. -Daniel

Quoted 181 lines
---
 drivers/gpu/drm/drm_crtc_internal.h |   2 +
 drivers/gpu/drm/drm_framebuffer.c   | 110 ++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_ioctl.c         |   1 +
 include/uapi/drm/drm.h              |   2 +
 4 files changed, 115 insertions(+)
drivers/gpu/drm/drm_crtc_internal.h +2 -0
index c7d5e4c21423..16f2413403aa 100644
@@ -216,6 +216,8 @@ int drm_mode_rmfb_ioctl(struct drm_device *dev,
 			void *data, struct drm_file *file_priv);
 int drm_mode_getfb(struct drm_device *dev,
 		   void *data, struct drm_file *file_priv);
+int drm_mode_getfb2_ioctl(struct drm_device *dev,
+			  void *data, struct drm_file *file_priv);
 int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
 			   void *data, struct drm_file *file_priv);
 
drivers/gpu/drm/drm_framebuffer.c +110 -0
index 57564318ceea..6db54f177443 100644
@@ -31,6 +31,7 @@
 #include <drm/drm_file.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
+#include <drm/drm_gem.h>
 #include <drm/drm_print.h>
 #include <drm/drm_util.h>
 
@@ -548,7 +549,116 @@ int drm_mode_getfb(struct drm_device *dev,
 
 out:
 	drm_framebuffer_put(fb);
+	return ret;
+}
+
+/**
+ * drm_mode_getfb2 - get extended FB info
+ * @dev: drm device for the ioctl
+ * @data: data pointer for the ioctl
+ * @file_priv: drm file for the ioctl call
+ *
+ * Lookup the FB given its ID and return info about it.
+ *
+ * Called by the user via ioctl.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_getfb2_ioctl(struct drm_device *dev,
+			  void *data, struct drm_file *file_priv)
+{
+	struct drm_mode_fb_cmd2 *r = data;
+	struct drm_framebuffer *fb;
+	unsigned int i;
+	int ret;
+
+	if (!drm_core_check_feature(dev, DRIVER_MODESET))
+		return -EINVAL;
+
+	fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id);
+	if (!fb)
+		return -ENOENT;
+
+	/* For multi-plane framebuffers, we require the driver to place the
+	 * GEM objects directly in the drm_framebuffer. For single-plane
+	 * framebuffers, we can fall back to create_handle.
+	 */
+	if (!fb->obj[0] &&
+	    (fb->format->num_planes > 1 || !fb->funcs->create_handle)) {
+		ret = -ENODEV;
+		goto out;
+	}
+
+	r->height = fb->height;
+	r->width = fb->width;
+	r->pixel_format = fb->format->format;
+
+	r->flags = 0;
+	if (dev->mode_config.allow_fb_modifiers)
+		r->flags |= DRM_MODE_FB_MODIFIERS;
+
+	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
+		r->handles[i] = 0;
+		r->pitches[i] = 0;
+		r->offsets[i] = 0;
+		r->modifier[i] = 0;
+	}
 
+	for (i = 0; i < fb->format->num_planes; i++) {
+		int j;
+
+		r->pitches[i] = fb->pitches[i];
+		r->offsets[i] = fb->offsets[i];
+		if (dev->mode_config.allow_fb_modifiers)
+			r->modifier[i] = fb->modifier;
+
+		/* If we reuse the same object for multiple planes, also
+		 * return the same handle.
+		 */
+		for (j = 0; j < i; j++) {
+			if (fb->obj[i] == fb->obj[j]) {
+				r->handles[i] = r->handles[j];
+				break;
+			}
+		}
+
+		if (r->handles[i])
+			continue;
+
+		if (fb->obj[i]) {
+			ret = drm_gem_handle_create(file_priv, fb->obj[i],
+						    &r->handles[i]);
+		} else {
+			WARN_ON(i > 0);
+			ret = fb->funcs->create_handle(fb, file_priv,
+						       &r->handles[i]);
+		}
+
+		if (ret != 0)
+			goto out;
+	}
+
+out:
+	if (ret != 0) {
+		/* Delete any previously-created handles on failure. */
+		for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
+			int j;
+
+			if (r->handles[i])
+				drm_gem_handle_delete(file_priv, r->handles[i]);
+
+			/* Zero out any handles identical to the one we just
+			 * deleted.
+			 */
+			for (j = i + 1; j < ARRAY_SIZE(r->handles); j++) {
+				if (r->handles[j] == r->handles[i])
+					r->handles[j] = 0;
+			}
+		}
+	}
+
+	drm_framebuffer_put(fb);
 	return ret;
 }
 
drivers/gpu/drm/drm_ioctl.c +1 -0
index fcd728d7cf72..b1fafce3ad8c 100644
@@ -671,6 +671,7 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETPROPERTY, drm_connector_property_set_ioctl, DRM_MASTER),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPBLOB, drm_mode_getblob_ioctl, 0),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB, drm_mode_getfb, 0),
+	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB2, drm_mode_getfb2_ioctl, 0),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB, drm_mode_addfb_ioctl, 0),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB2, drm_mode_addfb2_ioctl, 0),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb_ioctl, 0),
include/uapi/drm/drm.h +2 -0
index 8a5b2f8f8eb9..021f33675ba2 100644
@@ -947,6 +947,8 @@ extern "C" {
 #define DRM_IOCTL_SYNCOBJ_TRANSFER	DRM_IOWR(0xCC, struct drm_syncobj_transfer)
 #define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL	DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)
 
+#define DRM_IOCTL_MODE_GETFB2		DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)
+
 /**
  * Device specific ioctls should only be in their respective headers
  * The device specific ioctl range is from 0x40 to 0x9f.
Signature · 6 lines
2.21.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#4 lore raw
Quoted 11 lines · Daniel Vetter
Quoted 10 lines · Juston Li

From: Daniel Stone <[email protected]>

getfb2 allows us to pass multiple planes and modifiers, just like addfb2
over addfb.

Changes since v1:
- unused modifiers set to 0 instead of DRM_FORMAT_MOD_INVALID
- update ioctl number

Quoted 7 lines
Quoted 2 lines

Looks all good from a very quick glance (kernel, libdrm, igt), but where's
the userspace? Link to weston/drm_hwc/whatever MR good enough. -Daniel

My use case is a screenshot utility in chromiuomos that breaks with y- tiled ccs enabled.
Review linked is just WIP hack for now since it depends on this merging:
https://chromium-review.googlesource.com/c/chromiumos/platform2/+/1815146

Thanks
Juston

Quoted 196 lines
Quoted 196 lines
---
 drivers/gpu/drm/drm_crtc_internal.h |   2 +
 drivers/gpu/drm/drm_framebuffer.c   | 110
++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_ioctl.c         |   1 +
 include/uapi/drm/drm.h              |   2 +
 4 files changed, 115 insertions(+)
drivers/gpu/drm/drm_crtc_internal.h +2 -0
index c7d5e4c21423..16f2413403aa 100644
@@ -216,6 +216,8 @@ int drm_mode_rmfb_ioctl(struct drm_device *dev,
 			void *data, struct drm_file *file_priv);
 int drm_mode_getfb(struct drm_device *dev,
 		   void *data, struct drm_file *file_priv);
+int drm_mode_getfb2_ioctl(struct drm_device *dev,
+			  void *data, struct drm_file *file_priv);
 int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
 			   void *data, struct drm_file *file_priv);
 
drivers/gpu/drm/drm_framebuffer.c +33 -0
index 57564318ceea..6db54f177443 100644
@@ -31,6 +31,7 @@
 #include <drm/drm_file.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
+#include <drm/drm_gem.h>
 #include <drm/drm_print.h>
 #include <drm/drm_util.h>
 
@@ -548,7 +549,116 @@ int drm_mode_getfb(struct drm_device *dev,
 
 out:
 	drm_framebuffer_put(fb);
+	return ret;
+}
+
+/**
+ * drm_mode_getfb2 - get extended FB info
+ * @dev: drm device for the ioctl
+ * @data: data pointer for the ioctl
+ * @file_priv: drm file for the ioctl call
+ *
+ * Lookup the FB given its ID and return info about it.
+ *
+ * Called by the user via ioctl.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_getfb2_ioctl(struct drm_device *dev,
+			  void *data, struct drm_file *file_priv)
+{
+	struct drm_mode_fb_cmd2 *r = data;
+	struct drm_framebuffer *fb;
+	unsigned int i;
+	int ret;
+
+	if (!drm_core_check_feature(dev, DRIVER_MODESET))
+		return -EINVAL;
+
+	fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id);
+	if (!fb)
+		return -ENOENT;
+
+	/* For multi-plane framebuffers, we require the driver to place

the

drivers/gpu/drm/drm_framebuffer.c +1 -0
+	 * GEM objects directly in the drm_framebuffer. For single-

plane

drivers/gpu/drm/drm_framebuffer.c +4 -0
+	 * framebuffers, we can fall back to create_handle.
+	 */
+	if (!fb->obj[0] &&
+	    (fb->format->num_planes > 1 || !fb->funcs->create_handle))

{

drivers/gpu/drm/drm_framebuffer.c +27 -0
+		ret = -ENODEV;
+		goto out;
+	}
+
+	r->height = fb->height;
+	r->width = fb->width;
+	r->pixel_format = fb->format->format;
+
+	r->flags = 0;
+	if (dev->mode_config.allow_fb_modifiers)
+		r->flags |= DRM_MODE_FB_MODIFIERS;
+
+	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
+		r->handles[i] = 0;
+		r->pitches[i] = 0;
+		r->offsets[i] = 0;
+		r->modifier[i] = 0;
+	}
 
+	for (i = 0; i < fb->format->num_planes; i++) {
+		int j;
+
+		r->pitches[i] = fb->pitches[i];
+		r->offsets[i] = fb->offsets[i];
+		if (dev->mode_config.allow_fb_modifiers)
+			r->modifier[i] = fb->modifier;
+
+		/* If we reuse the same object for multiple planes,

also

drivers/gpu/drm/drm_framebuffer.c +14 -0
+		 * return the same handle.
+		 */
+		for (j = 0; j < i; j++) {
+			if (fb->obj[i] == fb->obj[j]) {
+				r->handles[i] = r->handles[j];
+				break;
+			}
+		}
+
+		if (r->handles[i])
+			continue;
+
+		if (fb->obj[i]) {
+			ret = drm_gem_handle_create(file_priv, fb-
Quoted 1 line

obj[i],

drivers/gpu/drm/drm_framebuffer.c +19 -0
+						    &r->handles[i]);
+		} else {
+			WARN_ON(i > 0);
+			ret = fb->funcs->create_handle(fb, file_priv,
+						       &r->handles[i]);
+		}
+
+		if (ret != 0)
+			goto out;
+	}
+
+out:
+	if (ret != 0) {
+		/* Delete any previously-created handles on failure. */
+		for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
+			int j;
+
+			if (r->handles[i])
+				drm_gem_handle_delete(file_priv, r-
Quoted 1 line

handles[i]);

drivers/gpu/drm/drm_framebuffer.c +2 -0
+
+			/* Zero out any handles identical to the one we

just

drivers/gpu/drm/drm_framebuffer.c +3 -0
+			 * deleted.
+			 */
+			for (j = i + 1; j < ARRAY_SIZE(r->handles);

j++) {

drivers/gpu/drm/drm_framebuffer.c +7 -0
+				if (r->handles[j] == r->handles[i])
+					r->handles[j] = 0;
+			}
+		}
+	}
+
+	drm_framebuffer_put(fb);
 	return ret;
 }
drivers/gpu/drm/drm_ioctl.c +1 -0
index fcd728d7cf72..b1fafce3ad8c 100644
@@ -671,6 +671,7 @@ static const struct drm_ioctl_desc drm_ioctls[]
 = {
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETPROPERTY,
 drm_connector_property_set_ioctl, DRM_MASTER),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPBLOB,
 drm_mode_getblob_ioctl, 0),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB, drm_mode_getfb, 0),
+	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB2, drm_mode_getfb2_ioctl, 0),
drivers/gpu/drm/drm_ioctl.c +0 -0
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB, drm_mode_addfb_ioctl, 0),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB2, drm_mode_addfb2_ioctl, 0),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb_ioctl, 0),
include/uapi/drm/drm.h +2 -0
index 8a5b2f8f8eb9..021f33675ba2 100644
@@ -947,6 +947,8 @@ extern "C" {
 #define DRM_IOCTL_SYNCOBJ_TRANSFER	DRM_IOWR(0xCC, struct
 drm_syncobj_transfer)
 #define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL	DRM_IOWR(0xCD, struct
 drm_syncobj_timeline_array)
 
+#define DRM_IOCTL_MODE_GETFB2		DRM_IOWR(0xCE, struct
 drm_mode_fb_cmd2)
+

/**
* Device specific ioctls should only be in their respective
headers
* The device specific ioctl range is from 0x40 to 0x9f.

Signature · 1 line
2.21.0
Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
Quoted 21 lines · Juston
Quoted 11 lines · Daniel Vetter
Quoted 10 lines · Juston Li

From: Daniel Stone <[email protected]>

getfb2 allows us to pass multiple planes and modifiers, just like addfb2
over addfb.

Changes since v1:
- unused modifiers set to 0 instead of DRM_FORMAT_MOD_INVALID
- update ioctl number

Quoted 7 lines
Quoted 2 lines

Looks all good from a very quick glance (kernel, libdrm, igt), but where's
the userspace? Link to weston/drm_hwc/whatever MR good enough. -Daniel

Quoted 5 lines

My use case is a screenshot utility in chromiuomos that breaks with y- tiled ccs enabled.
Review linked is just WIP hack for now since it depends on this merging:
https://chromium-review.googlesource.com/c/chromiumos/platform2/+/1815146

Adding Sean & Daniele to confirm this is real cros. -Daniel

Quoted 204 lines

Thanks
Juston

Quoted 200 lines
Quoted 200 lines
---
 drivers/gpu/drm/drm_crtc_internal.h |   2 +
 drivers/gpu/drm/drm_framebuffer.c   | 110
++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_ioctl.c         |   1 +
 include/uapi/drm/drm.h              |   2 +
 4 files changed, 115 insertions(+)
drivers/gpu/drm/drm_crtc_internal.h +2 -0
index c7d5e4c21423..16f2413403aa 100644
@@ -216,6 +216,8 @@ int drm_mode_rmfb_ioctl(struct drm_device *dev,
                    void *data, struct drm_file *file_priv);
 int drm_mode_getfb(struct drm_device *dev,
               void *data, struct drm_file *file_priv);
+int drm_mode_getfb2_ioctl(struct drm_device *dev,
+                     void *data, struct drm_file *file_priv);
 int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
                       void *data, struct drm_file *file_priv);
 
drivers/gpu/drm/drm_framebuffer.c +33 -0
index 57564318ceea..6db54f177443 100644
@@ -31,6 +31,7 @@
 #include <drm/drm_file.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
+#include <drm/drm_gem.h>
 #include <drm/drm_print.h>
 #include <drm/drm_util.h>
 
@@ -548,7 +549,116 @@ int drm_mode_getfb(struct drm_device *dev,
 
 out:
    drm_framebuffer_put(fb);
+   return ret;
+}
+
+/**
+ * drm_mode_getfb2 - get extended FB info
+ * @dev: drm device for the ioctl
+ * @data: data pointer for the ioctl
+ * @file_priv: drm file for the ioctl call
+ *
+ * Lookup the FB given its ID and return info about it.
+ *
+ * Called by the user via ioctl.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_getfb2_ioctl(struct drm_device *dev,
+                     void *data, struct drm_file *file_priv)
+{
+   struct drm_mode_fb_cmd2 *r = data;
+   struct drm_framebuffer *fb;
+   unsigned int i;
+   int ret;
+
+   if (!drm_core_check_feature(dev, DRIVER_MODESET))
+           return -EINVAL;
+
+   fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id);
+   if (!fb)
+           return -ENOENT;
+
+   /* For multi-plane framebuffers, we require the driver to place

the
+ * GEM objects directly in the drm_framebuffer. For single-
plane

drivers/gpu/drm/drm_framebuffer.c +4 -0
+    * framebuffers, we can fall back to create_handle.
+    */
+   if (!fb->obj[0] &&
+       (fb->format->num_planes > 1 || !fb->funcs->create_handle))

{

drivers/gpu/drm/drm_framebuffer.c +27 -0
+           ret = -ENODEV;
+           goto out;
+   }
+
+   r->height = fb->height;
+   r->width = fb->width;
+   r->pixel_format = fb->format->format;
+
+   r->flags = 0;
+   if (dev->mode_config.allow_fb_modifiers)
+           r->flags |= DRM_MODE_FB_MODIFIERS;
+
+   for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
+           r->handles[i] = 0;
+           r->pitches[i] = 0;
+           r->offsets[i] = 0;
+           r->modifier[i] = 0;
+   }
 
+   for (i = 0; i < fb->format->num_planes; i++) {
+           int j;
+
+           r->pitches[i] = fb->pitches[i];
+           r->offsets[i] = fb->offsets[i];
+           if (dev->mode_config.allow_fb_modifiers)
+                   r->modifier[i] = fb->modifier;
+
+           /* If we reuse the same object for multiple planes,

also

drivers/gpu/drm/drm_framebuffer.c +14 -0
+            * return the same handle.
+            */
+           for (j = 0; j < i; j++) {
+                   if (fb->obj[i] == fb->obj[j]) {
+                           r->handles[i] = r->handles[j];
+                           break;
+                   }
+           }
+
+           if (r->handles[i])
+                   continue;
+
+           if (fb->obj[i]) {
+                   ret = drm_gem_handle_create(file_priv, fb-
Quoted 1 line

obj[i],

drivers/gpu/drm/drm_framebuffer.c +19 -0
+                                               &r->handles[i]);
+           } else {
+                   WARN_ON(i > 0);
+                   ret = fb->funcs->create_handle(fb, file_priv,
+                                                  &r->handles[i]);
+           }
+
+           if (ret != 0)
+                   goto out;
+   }
+
+out:
+   if (ret != 0) {
+           /* Delete any previously-created handles on failure. */
+           for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
+                   int j;
+
+                   if (r->handles[i])
+                           drm_gem_handle_delete(file_priv, r-
Quoted 1 line

handles[i]);

drivers/gpu/drm/drm_framebuffer.c +2 -0
+
+                   /* Zero out any handles identical to the one we

just

drivers/gpu/drm/drm_framebuffer.c +3 -0
+                    * deleted.
+                    */
+                   for (j = i + 1; j < ARRAY_SIZE(r->handles);

j++) {

drivers/gpu/drm/drm_framebuffer.c +7 -0
+                           if (r->handles[j] == r->handles[i])
+                                   r->handles[j] = 0;
+                   }
+           }
+   }
+
+   drm_framebuffer_put(fb);
    return ret;
 }
drivers/gpu/drm/drm_ioctl.c +1 -0
index fcd728d7cf72..b1fafce3ad8c 100644
@@ -671,6 +671,7 @@ static const struct drm_ioctl_desc drm_ioctls[]
 = {
    DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETPROPERTY,
 drm_connector_property_set_ioctl, DRM_MASTER),
    DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPBLOB,
 drm_mode_getblob_ioctl, 0),
    DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB, drm_mode_getfb, 0),
+   DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB2, drm_mode_getfb2_ioctl, 0),

DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB, drm_mode_addfb_ioctl, 0), DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB2, drm_mode_addfb2_ioctl, 0), DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb_ioctl, 0),

include/uapi/drm/drm.h +2 -0
index 8a5b2f8f8eb9..021f33675ba2 100644
@@ -947,6 +947,8 @@ extern "C" {
 #define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct
 drm_syncobj_transfer)
 #define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL  DRM_IOWR(0xCD, struct
 drm_syncobj_timeline_array)
 
+#define DRM_IOCTL_MODE_GETFB2              DRM_IOWR(0xCE, struct
 drm_mode_fb_cmd2)
+

/**
* Device specific ioctls should only be in their respective
headers
* The device specific ioctl range is from 0x40 to 0x9f.
--
2.21.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#6 lore raw
Quoted 31 lines · Daniel Vetter
Quoted 22 lines · Juston
Quoted 12 lines · Daniel Vetter
Quoted 11 lines · Juston Li

From: Daniel Stone <[email protected]>

getfb2 allows us to pass multiple planes and modifiers, just like
addfb2
over addfb.

Changes since v1:
- unused modifiers set to 0 instead of DRM_FORMAT_MOD_INVALID
- update ioctl number

Quoted 8 lines
Quoted 2 lines

Looks all good from a very quick glance (kernel, libdrm, igt), but
where's
the userspace? Link to weston/drm_hwc/whatever MR good enough. -Daniel

Quoted 6 lines

My use case is a screenshot utility in chromiuomos that breaks with y-
tiled ccs enabled.
Review linked is just WIP hack for now since it depends on this merging:
https://chromium-review.googlesource.com/c/chromiumos/platform2/+/1815146

Quoted 2 lines

Adding Sean & Daniele to confirm this is real cros. -Daniel

+Mark, who I've been talking about enabling render buffer compression.

This patch allows me to fix a regression w/ screenshot utility when enabling RBC:
https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1759155

Thanks
Juston

Quoted 211 lines
Quoted 211 lines
Quoted 211 lines
Quoted 211 lines
---
 drivers/gpu/drm/drm_crtc_internal.h |   2 +
 drivers/gpu/drm/drm_framebuffer.c   | 110
++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_ioctl.c         |   1 +
 include/uapi/drm/drm.h              |   2 +
 4 files changed, 115 insertions(+)
drivers/gpu/drm/drm_crtc_internal.h +2 -0
index c7d5e4c21423..16f2413403aa 100644
@@ -216,6 +216,8 @@ int drm_mode_rmfb_ioctl(struct drm_device
 *dev,
                    void *data, struct drm_file *file_priv);
 int drm_mode_getfb(struct drm_device *dev,
               void *data, struct drm_file *file_priv);
+int drm_mode_getfb2_ioctl(struct drm_device *dev,
+                     void *data, struct drm_file *file_priv);
 int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
                       void *data, struct drm_file *file_priv);
drivers/gpu/drm/drm_framebuffer.c +33 -0
index 57564318ceea..6db54f177443 100644
@@ -31,6 +31,7 @@
 #include <drm/drm_file.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
+#include <drm/drm_gem.h>
 #include <drm/drm_print.h>
 #include <drm/drm_util.h>
 
@@ -548,7 +549,116 @@ int drm_mode_getfb(struct drm_device
 *dev,
 
 out:
    drm_framebuffer_put(fb);
+   return ret;
+}
+
+/**
+ * drm_mode_getfb2 - get extended FB info
+ * @dev: drm device for the ioctl
+ * @data: data pointer for the ioctl
+ * @file_priv: drm file for the ioctl call
+ *
+ * Lookup the FB given its ID and return info about it.
+ *
+ * Called by the user via ioctl.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_getfb2_ioctl(struct drm_device *dev,
+                     void *data, struct drm_file *file_priv)
+{
+   struct drm_mode_fb_cmd2 *r = data;
+   struct drm_framebuffer *fb;
+   unsigned int i;
+   int ret;
+
+   if (!drm_core_check_feature(dev, DRIVER_MODESET))
+           return -EINVAL;
+
+   fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id);
+   if (!fb)
+           return -ENOENT;
+
+   /* For multi-plane framebuffers, we require the driver to

place
the
+ * GEM objects directly in the drm_framebuffer. For single-
plane

drivers/gpu/drm/drm_framebuffer.c +4 -0
+    * framebuffers, we can fall back to create_handle.
+    */
+   if (!fb->obj[0] &&
+       (fb->format->num_planes > 1 || !fb->funcs-
Quoted 1 line

create_handle))

{

drivers/gpu/drm/drm_framebuffer.c +27 -0
+           ret = -ENODEV;
+           goto out;
+   }
+
+   r->height = fb->height;
+   r->width = fb->width;
+   r->pixel_format = fb->format->format;
+
+   r->flags = 0;
+   if (dev->mode_config.allow_fb_modifiers)
+           r->flags |= DRM_MODE_FB_MODIFIERS;
+
+   for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
+           r->handles[i] = 0;
+           r->pitches[i] = 0;
+           r->offsets[i] = 0;
+           r->modifier[i] = 0;
+   }
 
+   for (i = 0; i < fb->format->num_planes; i++) {
+           int j;
+
+           r->pitches[i] = fb->pitches[i];
+           r->offsets[i] = fb->offsets[i];
+           if (dev->mode_config.allow_fb_modifiers)
+                   r->modifier[i] = fb->modifier;
+
+           /* If we reuse the same object for multiple planes,

also

drivers/gpu/drm/drm_framebuffer.c +14 -0
+            * return the same handle.
+            */
+           for (j = 0; j < i; j++) {
+                   if (fb->obj[i] == fb->obj[j]) {
+                           r->handles[i] = r->handles[j];
+                           break;
+                   }
+           }
+
+           if (r->handles[i])
+                   continue;
+
+           if (fb->obj[i]) {
+                   ret = drm_gem_handle_create(file_priv, fb-
Quoted 1 line

obj[i],

+ &r-

Quoted 1 line

handles[i]);

drivers/gpu/drm/drm_framebuffer.c +3 -0
+           } else {
+                   WARN_ON(i > 0);
+                   ret = fb->funcs->create_handle(fb,

file_priv,
+ &r-

Quoted 1 line

handles[i]);

drivers/gpu/drm/drm_framebuffer.c +9 -0
+           }
+
+           if (ret != 0)
+                   goto out;
+   }
+
+out:
+   if (ret != 0) {
+           /* Delete any previously-created handles on

failure. */

drivers/gpu/drm/drm_framebuffer.c +5 -0
+           for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
+                   int j;
+
+                   if (r->handles[i])
+                           drm_gem_handle_delete(file_priv, r-
Quoted 1 line

handles[i]);

drivers/gpu/drm/drm_framebuffer.c +2 -0
+
+                   /* Zero out any handles identical to the

one we
just

drivers/gpu/drm/drm_framebuffer.c +3 -0
+                    * deleted.
+                    */
+                   for (j = i + 1; j < ARRAY_SIZE(r->handles);

j++) {

drivers/gpu/drm/drm_framebuffer.c +7 -0
+                           if (r->handles[j] == r->handles[i])
+                                   r->handles[j] = 0;
+                   }
+           }
+   }
+
+   drm_framebuffer_put(fb);
    return ret;
 }
drivers/gpu/drm/drm_ioctl.c +0 -0
index fcd728d7cf72..b1fafce3ad8c 100644
@@ -671,6 +671,7 @@ static const struct drm_ioctl_desc

drm_ioctls[]
= {
DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETPROPERTY,
drm_connector_property_set_ioctl, DRM_MASTER),
DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPBLOB,
drm_mode_getblob_ioctl, 0),
DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB, drm_mode_getfb, 0),
+ DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB2, drm_mode_getfb2_ioctl,
0),
DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB, drm_mode_addfb_ioctl,
0),
DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB2, drm_mode_addfb2_ioctl,
0),
DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb_ioctl, 0),

include/uapi/drm/drm.h +0 -0
index 8a5b2f8f8eb9..021f33675ba2 100644
@@ -947,6 +947,8 @@ extern "C" {
 #define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct
 drm_syncobj_transfer)
 #define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL  DRM_IOWR(0xCD,

struct
drm_syncobj_timeline_array)

+#define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE,
struct
drm_mode_fb_cmd2)
+
/**
* Device specific ioctls should only be in their respective
headers
* The device specific ioctl range is from 0x40 to 0x9f.
--
2.21.0

Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw
In reply to Daniel Vetter
Quoted 23 lines · Daniel Vetter
Quoted 21 lines · Juston
Quoted 18 lines · Daniel Vetter
Quoted 6 lines · Juston Li

From: Daniel Stone <[email protected]>

getfb2 allows us to pass multiple planes and modifiers, just like addfb2
over addfb.

Quoted 6 lines

Changes since v1:
- unused modifiers set to 0 instead of DRM_FORMAT_MOD_INVALID
- update ioctl number

Looks all good from a very quick glance (kernel, libdrm, igt), but where's
the userspace? Link to weston/drm_hwc/whatever MR good enough. -Daniel

Quoted 8 lines
Quoted 5 lines

My use case is a screenshot utility in chromiuomos that breaks with y- tiled ccs enabled.
Review linked is just WIP hack for now since it depends on this merging:
https://chromium-review.googlesource.com/c/chromiumos/platform2/+/1815146

Adding Sean & Daniele to confirm this is real cros. -Daniel

Yes, this is useful for cros and not only for the screenshot utility. It is also useful for the transition from the splash screen to Chrome login without flashing the screen black.

Thank you!

Quoted 201 lines
Quoted 201 lines

Thanks
Juston

Quoted 196 lines
Quoted 196 lines
---
 drivers/gpu/drm/drm_crtc_internal.h |   2 +
 drivers/gpu/drm/drm_framebuffer.c   | 110
++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_ioctl.c         |   1 +
 include/uapi/drm/drm.h              |   2 +
 4 files changed, 115 insertions(+)
drivers/gpu/drm/drm_crtc_internal.h +2 -0
index c7d5e4c21423..16f2413403aa 100644
@@ -216,6 +216,8 @@ int drm_mode_rmfb_ioctl(struct drm_device *dev,
                    void *data, struct drm_file *file_priv);
 int drm_mode_getfb(struct drm_device *dev,
               void *data, struct drm_file *file_priv);
+int drm_mode_getfb2_ioctl(struct drm_device *dev,
+                     void *data, struct drm_file *file_priv);
 int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
                       void *data, struct drm_file *file_priv);
 
drivers/gpu/drm/drm_framebuffer.c +33 -0
index 57564318ceea..6db54f177443 100644
@@ -31,6 +31,7 @@
 #include <drm/drm_file.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
+#include <drm/drm_gem.h>
 #include <drm/drm_print.h>
 #include <drm/drm_util.h>
 
@@ -548,7 +549,116 @@ int drm_mode_getfb(struct drm_device *dev,
 
 out:
    drm_framebuffer_put(fb);
+   return ret;
+}
+
+/**
+ * drm_mode_getfb2 - get extended FB info
+ * @dev: drm device for the ioctl
+ * @data: data pointer for the ioctl
+ * @file_priv: drm file for the ioctl call
+ *
+ * Lookup the FB given its ID and return info about it.
+ *
+ * Called by the user via ioctl.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_getfb2_ioctl(struct drm_device *dev,
+                     void *data, struct drm_file *file_priv)
+{
+   struct drm_mode_fb_cmd2 *r = data;
+   struct drm_framebuffer *fb;
+   unsigned int i;
+   int ret;
+
+   if (!drm_core_check_feature(dev, DRIVER_MODESET))
+           return -EINVAL;
+
+   fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id);
+   if (!fb)
+           return -ENOENT;
+
+   /* For multi-plane framebuffers, we require the driver to place

the
+ * GEM objects directly in the drm_framebuffer. For single-
plane

drivers/gpu/drm/drm_framebuffer.c +4 -0
+    * framebuffers, we can fall back to create_handle.
+    */
+   if (!fb->obj[0] &&
+       (fb->format->num_planes > 1 || !fb->funcs->create_handle))

{

drivers/gpu/drm/drm_framebuffer.c +27 -0
+           ret = -ENODEV;
+           goto out;
+   }
+
+   r->height = fb->height;
+   r->width = fb->width;
+   r->pixel_format = fb->format->format;
+
+   r->flags = 0;
+   if (dev->mode_config.allow_fb_modifiers)
+           r->flags |= DRM_MODE_FB_MODIFIERS;
+
+   for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
+           r->handles[i] = 0;
+           r->pitches[i] = 0;
+           r->offsets[i] = 0;
+           r->modifier[i] = 0;
+   }
 
+   for (i = 0; i < fb->format->num_planes; i++) {
+           int j;
+
+           r->pitches[i] = fb->pitches[i];
+           r->offsets[i] = fb->offsets[i];
+           if (dev->mode_config.allow_fb_modifiers)
+                   r->modifier[i] = fb->modifier;
+
+           /* If we reuse the same object for multiple planes,

also

drivers/gpu/drm/drm_framebuffer.c +14 -0
+            * return the same handle.
+            */
+           for (j = 0; j < i; j++) {
+                   if (fb->obj[i] == fb->obj[j]) {
+                           r->handles[i] = r->handles[j];
+                           break;
+                   }
+           }
+
+           if (r->handles[i])
+                   continue;
+
+           if (fb->obj[i]) {
+                   ret = drm_gem_handle_create(file_priv, fb-
Quoted 1 line

obj[i],

drivers/gpu/drm/drm_framebuffer.c +19 -0
+                                               &r->handles[i]);
+           } else {
+                   WARN_ON(i > 0);
+                   ret = fb->funcs->create_handle(fb, file_priv,
+                                                  &r->handles[i]);
+           }
+
+           if (ret != 0)
+                   goto out;
+   }
+
+out:
+   if (ret != 0) {
+           /* Delete any previously-created handles on failure. */
+           for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
+                   int j;
+
+                   if (r->handles[i])
+                           drm_gem_handle_delete(file_priv, r-
Quoted 1 line

handles[i]);

drivers/gpu/drm/drm_framebuffer.c +2 -0
+
+                   /* Zero out any handles identical to the one we

just

drivers/gpu/drm/drm_framebuffer.c +3 -0
+                    * deleted.
+                    */
+                   for (j = i + 1; j < ARRAY_SIZE(r->handles);

j++) {

drivers/gpu/drm/drm_framebuffer.c +7 -0
+                           if (r->handles[j] == r->handles[i])
+                                   r->handles[j] = 0;
+                   }
+           }
+   }
+
+   drm_framebuffer_put(fb);
    return ret;
 }
drivers/gpu/drm/drm_ioctl.c +1 -0
index fcd728d7cf72..b1fafce3ad8c 100644
@@ -671,6 +671,7 @@ static const struct drm_ioctl_desc drm_ioctls[]
 = {
    DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETPROPERTY,
 drm_connector_property_set_ioctl, DRM_MASTER),
    DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPBLOB,
 drm_mode_getblob_ioctl, 0),
    DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB, drm_mode_getfb, 0),
+   DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB2, drm_mode_getfb2_ioctl, 0),

DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB, drm_mode_addfb_ioctl, 0), DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB2, drm_mode_addfb2_ioctl, 0), DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb_ioctl, 0),

include/uapi/drm/drm.h +2 -0
index 8a5b2f8f8eb9..021f33675ba2 100644
@@ -947,6 +947,8 @@ extern "C" {
 #define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct
 drm_syncobj_transfer)
 #define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL  DRM_IOWR(0xCD, struct
 drm_syncobj_timeline_array)
 
+#define DRM_IOCTL_MODE_GETFB2              DRM_IOWR(0xCE, struct
 drm_mode_fb_cmd2)
+

/**
* Device specific ioctls should only be in their respective
headers
* The device specific ioctl range is from 0x40 to 0x9f.
--
2.21.0

Quoted 11 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw
In reply to Daniel Vetter
Quoted 10 lines · Daniel Vetter
Quoted 9 lines · Juston Li

From: Daniel Stone <[email protected]>

getfb2 allows us to pass multiple planes and modifiers, just like addfb2 over addfb.

Changes since v1:
- unused modifiers set to 0 instead of DRM_FORMAT_MOD_INVALID
- update ioctl number

Quoted 6 lines
Quoted 2 lines

Looks all good from a very quick glance (kernel, libdrm, igt), but where's the userspace? Link to weston/drm_hwc/whatever MR good enough. -Daniel

xserver too

https://lists.x.org/archives/xorg-devel/2018-March/056363.html

to fix

https://gitlab.freedesktop.org/xorg/xserver/issues/33

which forces Ubuntu to disable CCS compression, and I'd like to get rid of that patch.

Thanks Juston for pushing this!

Signature · 5 lines
t
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Acked-by
#9 lore raw
Quoted 23 lines · Timo Aaltonen
Quoted 10 lines · Daniel Vetter
Quoted 9 lines · Juston Li

From: Daniel Stone <[email protected]>

getfb2 allows us to pass multiple planes and modifiers, just like addfb2 over addfb.

Changes since v1:
- unused modifiers set to 0 instead of DRM_FORMAT_MOD_INVALID
- update ioctl number

Quoted 6 lines
Quoted 2 lines

Looks all good from a very quick glance (kernel, libdrm, igt), but where's the userspace? Link to weston/drm_hwc/whatever MR good enough. -Daniel

xserver too

https://lists.x.org/archives/xorg-devel/2018-March/056363.html

Quoted 8 lines

to fix

https://gitlab.freedesktop.org/xorg/xserver/issues/33

which forces Ubuntu to disable CCS compression, and I'd like to get rid of that patch.

Thanks Juston for pushing this!

... but someone needs to review all the patches and make sure kernel patch + igt work and pass intel CI and then push it all, and given the pile of committers we have that's not me I think. Just in case people expect me to push this forward, I only jumped in here to make sure new uapi is done by the book and checks all the boxes.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
author
#10 lore raw
Quoted 38 lines · Daniel Vetter
Quoted 26 lines · Timo Aaltonen
Quoted 11 lines · Daniel Vetter
Quoted 10 lines · Juston Li

From: Daniel Stone <[email protected]>

getfb2 allows us to pass multiple planes and modifiers, just like addfb2
over addfb.

Changes since v1:
- unused modifiers set to 0 instead of DRM_FORMAT_MOD_INVALID
- update ioctl number

Quoted 7 lines
Quoted 2 lines

Looks all good from a very quick glance (kernel, libdrm, igt), but where's
the userspace? Link to weston/drm_hwc/whatever MR good enough. -Daniel

xserver too

https://lists.x.org/archives/xorg-devel/2018-March/056363.html

to fix

Quoted 7 lines

https://gitlab.freedesktop.org/xorg/xserver/issues/33

which forces Ubuntu to disable CCS compression, and I'd like to get rid
of that patch.

Thanks Juston for pushing this!

Quoted 8 lines

... but someone needs to review all the patches and make sure kernel patch + igt work and pass intel CI and then push it all, and given the
pile of committers we have that's not me I think. Just in case people expect me to push this forward, I only jumped in here to make sure new
uapi is done by the book and checks all the boxes.
-Daniel

Thanks for clarifying Daniel, I'll try to find someone to review.

Juston
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#11 lore raw
In reply to Juston Li
Quoted 122 lines · Juston Li

From: Daniel Stone <[email protected]>

getfb2 allows us to pass multiple planes and modifiers, just like addfb2 over addfb.

Changes since v1:
- unused modifiers set to 0 instead of DRM_FORMAT_MOD_INVALID
- update ioctl number

---
 drivers/gpu/drm/drm_crtc_internal.h |   2 +
 drivers/gpu/drm/drm_framebuffer.c   | 110 ++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_ioctl.c         |   1 +
 include/uapi/drm/drm.h              |   2 +
 4 files changed, 115 insertions(+)
drivers/gpu/drm/drm_crtc_internal.h +2 -0
index c7d5e4c21423..16f2413403aa 100644
@@ -216,6 +216,8 @@ int drm_mode_rmfb_ioctl(struct drm_device *dev,
 			void *data, struct drm_file *file_priv);
 int drm_mode_getfb(struct drm_device *dev,
 		   void *data, struct drm_file *file_priv);
+int drm_mode_getfb2_ioctl(struct drm_device *dev,
+			  void *data, struct drm_file *file_priv);
 int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
 			   void *data, struct drm_file *file_priv);
 
drivers/gpu/drm/drm_framebuffer.c +75 -0
index 57564318ceea..6db54f177443 100644
@@ -31,6 +31,7 @@
 #include <drm/drm_file.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
+#include <drm/drm_gem.h>
 #include <drm/drm_print.h>
 #include <drm/drm_util.h>
 
@@ -548,7 +549,116 @@ int drm_mode_getfb(struct drm_device *dev,
 
 out:
 	drm_framebuffer_put(fb);
+	return ret;
+}
+
+/**
+ * drm_mode_getfb2 - get extended FB info
+ * @dev: drm device for the ioctl
+ * @data: data pointer for the ioctl
+ * @file_priv: drm file for the ioctl call
+ *
+ * Lookup the FB given its ID and return info about it.
+ *
+ * Called by the user via ioctl.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_getfb2_ioctl(struct drm_device *dev,
+			  void *data, struct drm_file *file_priv)
+{
+	struct drm_mode_fb_cmd2 *r = data;
+	struct drm_framebuffer *fb;
+	unsigned int i;
+	int ret;
+
+	if (!drm_core_check_feature(dev, DRIVER_MODESET))
+		return -EINVAL;
+
+	fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id);
+	if (!fb)
+		return -ENOENT;
+
+	/* For multi-plane framebuffers, we require the driver to place the
+	 * GEM objects directly in the drm_framebuffer. For single-plane
+	 * framebuffers, we can fall back to create_handle.
+	 */
+	if (!fb->obj[0] &&
+	    (fb->format->num_planes > 1 || !fb->funcs->create_handle)) {
+		ret = -ENODEV;
+		goto out;
+	}
+
+	r->height = fb->height;
+	r->width = fb->width;
+	r->pixel_format = fb->format->format;
+
+	r->flags = 0;
+	if (dev->mode_config.allow_fb_modifiers)
+		r->flags |= DRM_MODE_FB_MODIFIERS;
+
+	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
+		r->handles[i] = 0;
+		r->pitches[i] = 0;
+		r->offsets[i] = 0;
+		r->modifier[i] = 0;
+	}
 
+	for (i = 0; i < fb->format->num_planes; i++) {
+		int j;
+
+		r->pitches[i] = fb->pitches[i];
+		r->offsets[i] = fb->offsets[i];
+		if (dev->mode_config.allow_fb_modifiers)
+			r->modifier[i] = fb->modifier;
+
+		/* If we reuse the same object for multiple planes, also
+		 * return the same handle.
+		 */
+		for (j = 0; j < i; j++) {
+			if (fb->obj[i] == fb->obj[j]) {
+				r->handles[i] = r->handles[j];
+				break;
+			}
+		}
+
+		if (r->handles[i])

drivers/gpu/drm/drm_framebuffer.c int drm_mode_getfb(struct drm_device *dev, · line 636

Quoted 10 lines
drivers/gpu/drm/drm_framebuffer.c +10 -0
+			continue;
+
+		if (fb->obj[i]) {
+			ret = drm_gem_handle_create(file_priv, fb->obj[i],
+						    &r->handles[i]);
+		} else {
+			WARN_ON(i > 0);
+			ret = fb->funcs->create_handle(fb, file_priv,
+						       &r->handles[i]);
+		}

getfb1 doesn't allow non-master/root to see the handles. Here we don't seem to have that same protection?

drivers/gpu/drm/drm_framebuffer.c int drm_mode_getfb(struct drm_device *dev, · line 639

Quoted 3 lines
drivers/gpu/drm/drm_framebuffer.c +3 -0
+
+		if (ret != 0)
+			goto out;

Could be just 'break;' and then we wouldn't even need the label.

Rest lgtm.

Quoted 52 lines
drivers/gpu/drm/drm_framebuffer.c +22 -0
+	}
+
+out:
+	if (ret != 0) {
+		/* Delete any previously-created handles on failure. */
+		for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
+			int j;
+
+			if (r->handles[i])
+				drm_gem_handle_delete(file_priv, r->handles[i]);
+
+			/* Zero out any handles identical to the one we just
+			 * deleted.
+			 */
+			for (j = i + 1; j < ARRAY_SIZE(r->handles); j++) {
+				if (r->handles[j] == r->handles[i])
+					r->handles[j] = 0;
+			}
+		}
+	}
+
+	drm_framebuffer_put(fb);
 	return ret;
 }
 
drivers/gpu/drm/drm_ioctl.c +1 -0
index fcd728d7cf72..b1fafce3ad8c 100644
@@ -671,6 +671,7 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETPROPERTY, drm_connector_property_set_ioctl, DRM_MASTER),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPBLOB, drm_mode_getblob_ioctl, 0),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB, drm_mode_getfb, 0),
+	DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB2, drm_mode_getfb2_ioctl, 0),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB, drm_mode_addfb_ioctl, 0),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB2, drm_mode_addfb2_ioctl, 0),
 	DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb_ioctl, 0),
include/uapi/drm/drm.h +2 -0
index 8a5b2f8f8eb9..021f33675ba2 100644
@@ -947,6 +947,8 @@ extern "C" {
 #define DRM_IOCTL_SYNCOBJ_TRANSFER	DRM_IOWR(0xCC, struct drm_syncobj_transfer)
 #define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL	DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)
 
+#define DRM_IOCTL_MODE_GETFB2		DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)
+
 /**
  * Device specific ioctls should only be in their respective headers
  * The device specific ioctl range is from 0x40 to 0x9f.
Signature · 1 line
2.21.0
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#12 lore raw
Quoted 136 lines · Ville Syrjälä
Quoted 135 lines · Juston Li

From: Daniel Stone <[email protected]>

getfb2 allows us to pass multiple planes and modifiers, just like addfb2
over addfb.

Changes since v1:
- unused modifiers set to 0 instead of DRM_FORMAT_MOD_INVALID
- update ioctl number

---
 drivers/gpu/drm/drm_crtc_internal.h |   2 +
 drivers/gpu/drm/drm_framebuffer.c   | 110
++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_ioctl.c         |   1 +
 include/uapi/drm/drm.h              |   2 +
 4 files changed, 115 insertions(+)
drivers/gpu/drm/drm_crtc_internal.h +2 -0
index c7d5e4c21423..16f2413403aa 100644
@@ -216,6 +216,8 @@ int drm_mode_rmfb_ioctl(struct drm_device *dev,
 			void *data, struct drm_file *file_priv);
 int drm_mode_getfb(struct drm_device *dev,
 		   void *data, struct drm_file *file_priv);
+int drm_mode_getfb2_ioctl(struct drm_device *dev,
+			  void *data, struct drm_file *file_priv);
 int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
 			   void *data, struct drm_file *file_priv);
 
drivers/gpu/drm/drm_framebuffer.c +33 -0
index 57564318ceea..6db54f177443 100644
@@ -31,6 +31,7 @@
 #include <drm/drm_file.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
+#include <drm/drm_gem.h>
 #include <drm/drm_print.h>
 #include <drm/drm_util.h>
 
@@ -548,7 +549,116 @@ int drm_mode_getfb(struct drm_device *dev,
 
 out:
 	drm_framebuffer_put(fb);
+	return ret;
+}
+
+/**
+ * drm_mode_getfb2 - get extended FB info
+ * @dev: drm device for the ioctl
+ * @data: data pointer for the ioctl
+ * @file_priv: drm file for the ioctl call
+ *
+ * Lookup the FB given its ID and return info about it.
+ *
+ * Called by the user via ioctl.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_getfb2_ioctl(struct drm_device *dev,
+			  void *data, struct drm_file *file_priv)
+{
+	struct drm_mode_fb_cmd2 *r = data;
+	struct drm_framebuffer *fb;
+	unsigned int i;
+	int ret;
+
+	if (!drm_core_check_feature(dev, DRIVER_MODESET))
+		return -EINVAL;
+
+	fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id);
+	if (!fb)
+		return -ENOENT;
+
+	/* For multi-plane framebuffers, we require the driver to place

the

drivers/gpu/drm/drm_framebuffer.c +1 -0
+	 * GEM objects directly in the drm_framebuffer. For single-

plane

drivers/gpu/drm/drm_framebuffer.c +4 -0
+	 * framebuffers, we can fall back to create_handle.
+	 */
+	if (!fb->obj[0] &&
+	    (fb->format->num_planes > 1 || !fb->funcs->create_handle))

{

drivers/gpu/drm/drm_framebuffer.c +27 -0
+		ret = -ENODEV;
+		goto out;
+	}
+
+	r->height = fb->height;
+	r->width = fb->width;
+	r->pixel_format = fb->format->format;
+
+	r->flags = 0;
+	if (dev->mode_config.allow_fb_modifiers)
+		r->flags |= DRM_MODE_FB_MODIFIERS;
+
+	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
+		r->handles[i] = 0;
+		r->pitches[i] = 0;
+		r->offsets[i] = 0;
+		r->modifier[i] = 0;
+	}
 
+	for (i = 0; i < fb->format->num_planes; i++) {
+		int j;
+
+		r->pitches[i] = fb->pitches[i];
+		r->offsets[i] = fb->offsets[i];
+		if (dev->mode_config.allow_fb_modifiers)
+			r->modifier[i] = fb->modifier;
+
+		/* If we reuse the same object for multiple planes,

also

drivers/gpu/drm/drm_framebuffer.c +14 -0
+		 * return the same handle.
+		 */
+		for (j = 0; j < i; j++) {
+			if (fb->obj[i] == fb->obj[j]) {
+				r->handles[i] = r->handles[j];
+				break;
+			}
+		}
+
+		if (r->handles[i])
+			continue;
+
+		if (fb->obj[i]) {
+			ret = drm_gem_handle_create(file_priv, fb-
Quoted 1 line

obj[i],

Quoted 10 lines

drivers/gpu/drm/drm_framebuffer.c int drm_mode_getfb(struct drm_device *dev, · line 636

Quoted 6 lines
drivers/gpu/drm/drm_framebuffer.c +6 -0
+						    &r->handles[i]);
+		} else {
+			WARN_ON(i > 0);
+			ret = fb->funcs->create_handle(fb, file_priv,
+						       &r->handles[i]);
+		}

getfb1 doesn't allow non-master/root to see the handles. Here we don't
seem to have that same protection?

Hmm yeah sorry I missed the protections handling.
I think we can just set the getfb2 ioctl flags as
DRM_MASTER|DRM_ROOT_ONLY

Quoted 5 lines

drivers/gpu/drm/drm_framebuffer.c int drm_mode_getfb(struct drm_device *dev, · line 639

Quoted 3 lines
drivers/gpu/drm/drm_framebuffer.c +3 -0
+
+		if (ret != 0)
+			goto out;

Could be just 'break;' and then we wouldn't even need the label.

Will do.

Quoted 3 lines

Rest lgtm.

Much appreciated
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#13 lore raw
Quoted 148 lines · Juston
Quoted 136 lines · Ville Syrjälä
Quoted 135 lines · Juston Li

From: Daniel Stone <[email protected]>

getfb2 allows us to pass multiple planes and modifiers, just like addfb2
over addfb.

Changes since v1:
- unused modifiers set to 0 instead of DRM_FORMAT_MOD_INVALID
- update ioctl number

---
 drivers/gpu/drm/drm_crtc_internal.h |   2 +
 drivers/gpu/drm/drm_framebuffer.c   | 110
++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_ioctl.c         |   1 +
 include/uapi/drm/drm.h              |   2 +
 4 files changed, 115 insertions(+)
drivers/gpu/drm/drm_crtc_internal.h +2 -0
index c7d5e4c21423..16f2413403aa 100644
@@ -216,6 +216,8 @@ int drm_mode_rmfb_ioctl(struct drm_device *dev,
 			void *data, struct drm_file *file_priv);
 int drm_mode_getfb(struct drm_device *dev,
 		   void *data, struct drm_file *file_priv);
+int drm_mode_getfb2_ioctl(struct drm_device *dev,
+			  void *data, struct drm_file *file_priv);
 int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
 			   void *data, struct drm_file *file_priv);
 
drivers/gpu/drm/drm_framebuffer.c +33 -0
index 57564318ceea..6db54f177443 100644
@@ -31,6 +31,7 @@
 #include <drm/drm_file.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
+#include <drm/drm_gem.h>
 #include <drm/drm_print.h>
 #include <drm/drm_util.h>
 
@@ -548,7 +549,116 @@ int drm_mode_getfb(struct drm_device *dev,
 
 out:
 	drm_framebuffer_put(fb);
+	return ret;
+}
+
+/**
+ * drm_mode_getfb2 - get extended FB info
+ * @dev: drm device for the ioctl
+ * @data: data pointer for the ioctl
+ * @file_priv: drm file for the ioctl call
+ *
+ * Lookup the FB given its ID and return info about it.
+ *
+ * Called by the user via ioctl.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_mode_getfb2_ioctl(struct drm_device *dev,
+			  void *data, struct drm_file *file_priv)
+{
+	struct drm_mode_fb_cmd2 *r = data;
+	struct drm_framebuffer *fb;
+	unsigned int i;
+	int ret;
+
+	if (!drm_core_check_feature(dev, DRIVER_MODESET))
+		return -EINVAL;
+
+	fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id);
+	if (!fb)
+		return -ENOENT;
+
+	/* For multi-plane framebuffers, we require the driver to place

the

drivers/gpu/drm/drm_framebuffer.c +1 -0
+	 * GEM objects directly in the drm_framebuffer. For single-

plane

drivers/gpu/drm/drm_framebuffer.c +4 -0
+	 * framebuffers, we can fall back to create_handle.
+	 */
+	if (!fb->obj[0] &&
+	    (fb->format->num_planes > 1 || !fb->funcs->create_handle))

{

drivers/gpu/drm/drm_framebuffer.c +27 -0
+		ret = -ENODEV;
+		goto out;
+	}
+
+	r->height = fb->height;
+	r->width = fb->width;
+	r->pixel_format = fb->format->format;
+
+	r->flags = 0;
+	if (dev->mode_config.allow_fb_modifiers)
+		r->flags |= DRM_MODE_FB_MODIFIERS;
+
+	for (i = 0; i < ARRAY_SIZE(r->handles); i++) {
+		r->handles[i] = 0;
+		r->pitches[i] = 0;
+		r->offsets[i] = 0;
+		r->modifier[i] = 0;
+	}
 
+	for (i = 0; i < fb->format->num_planes; i++) {
+		int j;
+
+		r->pitches[i] = fb->pitches[i];
+		r->offsets[i] = fb->offsets[i];
+		if (dev->mode_config.allow_fb_modifiers)
+			r->modifier[i] = fb->modifier;
+
+		/* If we reuse the same object for multiple planes,

also

drivers/gpu/drm/drm_framebuffer.c +14 -0
+		 * return the same handle.
+		 */
+		for (j = 0; j < i; j++) {
+			if (fb->obj[i] == fb->obj[j]) {
+				r->handles[i] = r->handles[j];
+				break;
+			}
+		}
+
+		if (r->handles[i])
+			continue;
+
+		if (fb->obj[i]) {
+			ret = drm_gem_handle_create(file_priv, fb-
Quoted 1 line

obj[i],

Quoted 10 lines

drivers/gpu/drm/drm_framebuffer.c int drm_mode_getfb(struct drm_device *dev, · line 636

Quoted 6 lines
drivers/gpu/drm/drm_framebuffer.c +6 -0
+						    &r->handles[i]);
+		} else {
+			WARN_ON(i > 0);
+			ret = fb->funcs->create_handle(fb, file_priv,
+						       &r->handles[i]);
+		}

getfb1 doesn't allow non-master/root to see the handles. Here we don't
seem to have that same protection?

Quoted 3 lines

Hmm yeah sorry I missed the protections handling.
I think we can just set the getfb2 ioctl flags as
DRM_MASTER|DRM_ROOT_ONLY

Since this was missed, can you pls extend the igt to test for this? Iirc the getfb igt makes sure non-root doesn't get this ...

Also for consistency I think doing the same as getfb would be good. Fewer surprises.
-Daniel

Quoted 18 lines
Quoted 6 lines

drivers/gpu/drm/drm_framebuffer.c int drm_mode_getfb(struct drm_device *dev, · line 639

Quoted 4 lines
drivers/gpu/drm/drm_framebuffer.c +3 -0
+
+		if (ret != 0)
+			goto out;

Could be just 'break;' and then we wouldn't even need the label.

Will do.

Quoted 3 lines

Rest lgtm.

Much appreciated
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx