Skip to contentSkip to conversation

drm: Extract drm_plane.[hc]

PATCH Applied Daniel Vetter 6 participants 18 messages Sep 21, 2016 – Sep 28, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/7 drm: Extract drm_plane.[hc]

Just pure code movement, cleanup and polish will happen in later patches.

v2: Don't forget all the ioctl! To extract those cleanly I decided to put check_src_coords into drm_framebuffer.c (and give it a drm_framebuffer_ prefix), since that just checks framebuffer constraints.

v3: rebase over PAGE_FLIP_TARGET.

---
 Documentation/gpu/drm-kms.rst       |  12 +
 drivers/gpu/drm/Makefile            |   3 +-
 drivers/gpu/drm/drm_crtc.c          | 991 +-----------------------------------
 drivers/gpu/drm/drm_crtc_internal.h |  38 +-
 drivers/gpu/drm/drm_framebuffer.c   |  26 +
 drivers/gpu/drm/drm_plane.c         | 990 +++++++++++++++++++++++++++++++++++
 include/drm/drm_atomic.h            | 154 ++++++
 include/drm/drm_crtc.h              | 583 +--------------------
 include/drm/drm_plane.h             | 470 +++++++++++++++++
 9 files changed, 1681 insertions(+), 1586 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_plane.c
 create mode 100644 include/drm/drm_plane.h
Documentation/gpu/drm-kms.rst +12 -0
index f9a991bb87d4..33181be97151 100644
@@ -110,6 +110,18 @@ Note that dumb objects may not be used for gpu acceleration, as has been
 attempted on some ARM embedded platforms. Such drivers really must have
 a hardware-specific ioctl to allocate suitable buffer objects.
 
+Plane Abstraction
+=================
+
+Plane Functions Reference
+-------------------------
+
+.. kernel-doc:: include/drm/drm_plane.h
+   :internal:
+
+.. kernel-doc:: drivers/gpu/drm/drm_plane.c
+   :export:
+
 Display Modes Function Reference
 ================================
 
drivers/gpu/drm/Makefile +2 -1
index 439d89b25ae0..8eeb07a35798 100644
@@ -14,7 +14,8 @@ drm-y       :=	drm_auth.o drm_bufs.o drm_cache.o \
 		drm_rect.o drm_vma_manager.o drm_flip_work.o \
 		drm_modeset_lock.o drm_atomic.o drm_bridge.o \
 		drm_framebuffer.o drm_connector.o drm_blend.o \
-		drm_encoder.o drm_mode_object.o drm_property.o
+		drm_encoder.o drm_mode_object.o drm_property.o \
+		drm_plane.o
 
 drm-$(CONFIG_COMPAT) += drm_ioc32.o
 drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
drivers/gpu/drm/drm_crtc.c +3 -988

1,027 lines not on this page · raw message

drivers/gpu/drm/drm_crtc_internal.h +23 -15
index 5079073c9599..cc717b70e43b 100644
@@ -36,8 +36,6 @@
 int drm_mode_crtc_set_obj_prop(struct drm_mode_object *obj,
 			       struct drm_property *property,
 			       uint64_t value);
-int drm_plane_check_pixel_format(const struct drm_plane *plane,
-				 u32 format);
 int drm_crtc_check_viewport(const struct drm_crtc *crtc,
 			    int x, int y,
 			    const struct drm_display_mode *mode,
@@ -56,28 +54,15 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
 /* IOCTLs */
 int drm_mode_getresources(struct drm_device *dev,
 			  void *data, struct drm_file *file_priv);
-int drm_mode_getplane_res(struct drm_device *dev, void *data,
-			  struct drm_file *file_priv);
 int drm_mode_getcrtc(struct drm_device *dev,
 		     void *data, struct drm_file *file_priv);
 int drm_mode_setcrtc(struct drm_device *dev,
 		     void *data, struct drm_file *file_priv);
-int drm_mode_getplane(struct drm_device *dev,
-		      void *data, struct drm_file *file_priv);
-int drm_mode_setplane(struct drm_device *dev,
-		      void *data, struct drm_file *file_priv);
-int drm_mode_cursor_ioctl(struct drm_device *dev,
-			  void *data, struct drm_file *file_priv);
-int drm_mode_cursor2_ioctl(struct drm_device *dev,
-			   void *data, struct drm_file *file_priv);
 int drm_mode_gamma_get_ioctl(struct drm_device *dev,
 			     void *data, struct drm_file *file_priv);
 int drm_mode_gamma_set_ioctl(struct drm_device *dev,
 			     void *data, struct drm_file *file_priv);
 
-int drm_mode_page_flip_ioctl(struct drm_device *dev,
-			     void *data, struct drm_file *file_priv);
-
 /* drm_property.c */
 void drm_property_destroy_user_blobs(struct drm_device *dev,
 				     struct drm_file *file_priv);
@@ -155,6 +140,9 @@ drm_internal_framebuffer_create(struct drm_device *dev,
 				const struct drm_mode_fb_cmd2 *r,
 				struct drm_file *file_priv);
 void drm_framebuffer_free(struct kref *kref);
+int drm_framebuffer_check_src_coords(uint32_t src_x, uint32_t src_y,
+				     uint32_t src_w, uint32_t src_h,
+				     const struct drm_framebuffer *fb);
 
 /* IOCTL */
 int drm_mode_addfb(struct drm_device *dev,
@@ -181,3 +169,23 @@ void drm_modeset_unregister_all(struct drm_device *dev);
 /* drm_blend.c */
 int drm_atomic_normalize_zpos(struct drm_device *dev,
 			      struct drm_atomic_state *state);
+
+/* drm_plane.c */
+int drm_plane_register_all(struct drm_device *dev);
+void drm_plane_unregister_all(struct drm_device *dev);
+int drm_plane_check_pixel_format(const struct drm_plane *plane,
+				 u32 format);
+
+/* IOCTL */
+int drm_mode_getplane_res(struct drm_device *dev, void *data,
+			  struct drm_file *file_priv);
+int drm_mode_getplane(struct drm_device *dev,
+		      void *data, struct drm_file *file_priv);
+int drm_mode_setplane(struct drm_device *dev,
+		      void *data, struct drm_file *file_priv);
+int drm_mode_cursor_ioctl(struct drm_device *dev,
+			  void *data, struct drm_file *file_priv);
+int drm_mode_cursor2_ioctl(struct drm_device *dev,
+			   void *data, struct drm_file *file_priv);
+int drm_mode_page_flip_ioctl(struct drm_device *dev,
+			     void *data, struct drm_file *file_priv);
drivers/gpu/drm/drm_framebuffer.c +26 -0
index 20a8dd4d021b..5b3cc9b55d63 100644
@@ -62,6 +62,32 @@
  * &drm_framebuffer.
  */
 
+int drm_framebuffer_check_src_coords(uint32_t src_x, uint32_t src_y,
+				     uint32_t src_w, uint32_t src_h,
+				     const struct drm_framebuffer *fb)
+{
+	unsigned int fb_width, fb_height;
+
+	fb_width = fb->width << 16;
+	fb_height = fb->height << 16;
+
+	/* Make sure source coordinates are inside the fb. */
+	if (src_w > fb_width ||
+	    src_x > fb_width - src_w ||
+	    src_h > fb_height ||
+	    src_y > fb_height - src_h) {
+		DRM_DEBUG_KMS("Invalid source coordinates "
+			      "%u.%06ux%u.%06u+%u.%06u+%u.%06u\n",
+			      src_w >> 16, ((src_w & 0xffff) * 15625) >> 10,
+			      src_h >> 16, ((src_h & 0xffff) * 15625) >> 10,
+			      src_x >> 16, ((src_x & 0xffff) * 15625) >> 10,
+			      src_y >> 16, ((src_y & 0xffff) * 15625) >> 10);
+		return -ENOSPC;
+	}
+
+	return 0;
+}
+
 /**
  * drm_mode_addfb - add an FB to the graphics configuration
  * @dev: drm device for the ioctl
drivers/gpu/drm/drm_plane.c new file +990 -0

990 lines not on this page · raw message

include/drm/drm_atomic.h +154 -0

160 lines not on this page · raw message

include/drm/drm_crtc.h +1 -582

626 lines not on this page · raw message

include/drm/drm_plane.h new file +470 -0

70 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 6 lines
2.7.4

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

Part of the diff is not shown here. View the raw message.

#1 lore raw

PATCH 2/7 drm/doc: Polish for drm_plane.[hc]

Big thing is untangling and carefully documenting the different uapi types of planes. I also sprinkled a few more cross references around to make this easier to discover.

As usual, remove the kerneldoc for internal functions which are not exported. Aside: We should probably go OCD on all the ioctl handlers and consistenly give them an _ioctl postfix.

---
 Documentation/gpu/drm-kms.rst |  47 +--------------
 drivers/gpu/drm/drm_crtc.c    |   6 +-
 drivers/gpu/drm/drm_plane.c   | 132 ++++++++----------------------------------
 include/drm/drm_plane.h       |  57 +++++++++++++++++-
 4 files changed, 86 insertions(+), 156 deletions(-)
Documentation/gpu/drm-kms.rst +3 -44
index 33181be97151..b1029e292e5c 100644
@@ -113,6 +113,9 @@ a hardware-specific ioctl to allocate suitable buffer objects.
 Plane Abstraction
 =================
 
+.. kernel-doc:: drivers/gpu/drm/drm_plane.c
+   :doc: overview
+
 Plane Functions Reference
 -------------------------
 
@@ -189,50 +192,6 @@ allocated and zeroed by the driver, possibly as part of a larger
 structure, and registered with a call to :c:func:`drm_crtc_init()`
 with a pointer to CRTC functions.
 
-Planes (:c:type:`struct drm_plane <drm_plane>`)
------------------------------------------------
-
-A plane represents an image source that can be blended with or overlayed
-on top of a CRTC during the scanout process. Planes are associated with
-a frame buffer to crop a portion of the image memory (source) and
-optionally scale it to a destination size. The result is then blended
-with or overlayed on top of a CRTC.
-
-The DRM core recognizes three types of planes:
-
--  DRM_PLANE_TYPE_PRIMARY represents a "main" plane for a CRTC.
-   Primary planes are the planes operated upon by CRTC modesetting and
-   flipping operations described in the page_flip hook in
-   :c:type:`struct drm_crtc_funcs <drm_crtc_funcs>`.
--  DRM_PLANE_TYPE_CURSOR represents a "cursor" plane for a CRTC.
-   Cursor planes are the planes operated upon by the
-   DRM_IOCTL_MODE_CURSOR and DRM_IOCTL_MODE_CURSOR2 ioctls.
--  DRM_PLANE_TYPE_OVERLAY represents all non-primary, non-cursor
-   planes. Some drivers refer to these types of planes as "sprites"
-   internally.
-
-For compatibility with legacy userspace, only overlay planes are made
-available to userspace by default. Userspace clients may set the
-DRM_CLIENT_CAP_UNIVERSAL_PLANES client capability bit to indicate
-that they wish to receive a universal plane list containing all plane
-types.
-
-Plane Initialization
-~~~~~~~~~~~~~~~~~~~~
-
-To create a plane, a KMS drivers allocates and zeroes an instances of
-:c:type:`struct drm_plane <drm_plane>` (possibly as part of a
-larger structure) and registers it with a call to
-:c:func:`drm_universal_plane_init()`. The function takes a
-bitmask of the CRTCs that can be associated with the plane, a pointer to
-the plane functions, a list of format supported formats, and the type of
-plane (primary, cursor, or overlay) being initialized.
-
-Cursor and overlay planes are optional. All drivers should provide one
-primary plane per CRTC (although this requirement may change in the
-future); drivers that do not wish to provide special handling for
-primary planes may make use of the helper functions described in ? to
-create and register a primary plane with standard capabilities.
 
 Cleanup
 -------
drivers/gpu/drm/drm_crtc.c +5 -1
index 513ab4729683..9ef7955032db 100644
@@ -151,7 +151,11 @@ static void drm_crtc_unregister_all(struct drm_device *dev)
  * @funcs: callbacks for the new CRTC
  * @name: printf style format string for the CRTC name, or NULL for default name
  *
- * Inits a new object created as base part of a driver crtc object.
+ * Inits a new object created as base part of a driver crtc object. Drivers
+ * should use this function instead of drm_crtc_init(), which is only provided
+ * for backwards compatibility with drivers which do not yet support universal
+ * planes). For really simple hardware which has only 1 plane look at
+ * drm_simple_display_pipe_init() instead.
  *
  * Returns:
  * Zero on success, error code on failure.
drivers/gpu/drm/drm_plane.c +23 -109

189 lines not on this page · raw message

include/drm/drm_plane.h +55 -2

76 lines not on this page · raw message

Signature · 6 lines
2.7.4

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

Re: [PATCH 2/7] drm/doc: Polish for drm_plane.[hc]

Hi Daniel,

Quoted 42 lines · Daniel Vetter
include/drm/drm_plane.h +31 -1
index 1407715736a5..256219bfd07b 100644
@@ -319,10 +319,48 @@ struct drm_plane_funcs {
 	void (*early_unregister)(struct drm_plane *plane);
 };
 
+/**
+ * enum drm_plane_type - uapi plane type enumeration
+ *
+ * For historical reasons not all planes are made the same. This enumeration is
+ * used to tell the different types of planes apart to implement the different
+ * uapi semantics for them. For userspace which is universal plane aware and
+ * which is using that atomic IOCTL there's no difference between these planes
+ * (beyong what the driver and hardware can support of course).
+ *
+ * For compatibility with legacy userspace, only overlay planes are made
+ * available to userspace by default. Userspace clients may set the
+ * DRM_CLIENT_CAP_UNIVERSAL_PLANES client capability bit to indicate that they
+ * wish to receive a universal plane list containing all plane types. See also
+ * drm_for_each_legacy_plane().
+ */
 enum drm_plane_type {
-	DRM_PLANE_TYPE_OVERLAY,
+	/**
+	 * @DRM_PLANE_TYPE_PRIMARY:
+	 *
+	 * Primary planes represent a "main" plane for a CRTC.  Primary planes
+	 * are the planes operated upon by CRTC modesetting and flipping
+	 * operations described in the page_flip and set_config hooks in struct
+	 * &drm_crtc_funcs.
+	 */
 	DRM_PLANE_TYPE_PRIMARY,
+
+	/**
+	 * @DRM_PLANE_TYPE_CURSOR:
+	 *
+	 * Cursor planes represent a "cursor" plane for a CRTC.  Cursor planes
+	 * are the planes operated upon by the DRM_IOCTL_MODE_CURSOR and
+	 * DRM_IOCTL_MODE_CURSOR2 IOCTLs.
+	 */

include/drm/drm_plane.h struct drm_plane_funcs { · line 364

Quoted 10 lines
include/drm/drm_plane.h +8 -0
 	DRM_PLANE_TYPE_CURSOR,
+
+	/**
+	 * @DRM_PLANE_TYPE_OVERLAY:
+	 *
+	 * Overlay planes represent all non-primary, non-cursor planes. Some
+	 * drivers refer to these types of planes as "sprites" internally.
+	 */
+	DRM_PLANE_TYPE_OVERLAY,
 };

This is changing the order (and consequently the values) of these enums. But it is not updated in libdrm. I noticed this is causing an issue when playing with robclark's version of kmscube (branch atomic):

https://github.com/robclark/kmscube/tree/atomic

It looks like IGT also uses this macro from libdrm:

$ git grep -n DRM_PLANE_TYPE_PRIMARY
lib/igt_kms.c:1398:                     case DRM_PLANE_TYPE_PRIMARY:
tests/kms_frontbuffer_tracking.c:2302:              drm.plane_types[i] == DRM_PLANE_TYPE_PRIMARY)
tests/kms_frontbuffer_tracking.c:2602:              drm.plane_types[i] == DRM_PLANE_TYPE_PRIMARY) {
tests/kms_frontbuffer_tracking.c:2741:              drm.plane_types[i] == DRM_PLANE_TYPE_PRIMARY)

Anyway, should we update it on libdrm, bring the order back to its original values, or something else? Or am I missing something?

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

#3 lore raw

Re: [PATCH 2/7] drm/doc: Polish for drm_plane.[hc]

Quoted 64 lines · Rafael Antognolli

Hi Daniel,

Quoted 42 lines · Daniel Vetter
include/drm/drm_plane.h +31 -1
index 1407715736a5..256219bfd07b 100644
@@ -319,10 +319,48 @@ struct drm_plane_funcs {
 	void (*early_unregister)(struct drm_plane *plane);
 };
 
+/**
+ * enum drm_plane_type - uapi plane type enumeration
+ *
+ * For historical reasons not all planes are made the same. This enumeration is
+ * used to tell the different types of planes apart to implement the different
+ * uapi semantics for them. For userspace which is universal plane aware and
+ * which is using that atomic IOCTL there's no difference between these planes
+ * (beyong what the driver and hardware can support of course).
+ *
+ * For compatibility with legacy userspace, only overlay planes are made
+ * available to userspace by default. Userspace clients may set the
+ * DRM_CLIENT_CAP_UNIVERSAL_PLANES client capability bit to indicate that they
+ * wish to receive a universal plane list containing all plane types. See also
+ * drm_for_each_legacy_plane().
+ */
 enum drm_plane_type {
-	DRM_PLANE_TYPE_OVERLAY,
+	/**
+	 * @DRM_PLANE_TYPE_PRIMARY:
+	 *
+	 * Primary planes represent a "main" plane for a CRTC.  Primary planes
+	 * are the planes operated upon by CRTC modesetting and flipping
+	 * operations described in the page_flip and set_config hooks in struct
+	 * &drm_crtc_funcs.
+	 */
 	DRM_PLANE_TYPE_PRIMARY,
+
+	/**
+	 * @DRM_PLANE_TYPE_CURSOR:
+	 *
+	 * Cursor planes represent a "cursor" plane for a CRTC.  Cursor planes
+	 * are the planes operated upon by the DRM_IOCTL_MODE_CURSOR and
+	 * DRM_IOCTL_MODE_CURSOR2 IOCTLs.
+	 */

include/drm/drm_plane.h struct drm_plane_funcs { · line 364

Quoted 10 lines
include/drm/drm_plane.h +8 -0
 	DRM_PLANE_TYPE_CURSOR,
+
+	/**
+	 * @DRM_PLANE_TYPE_OVERLAY:
+	 *
+	 * Overlay planes represent all non-primary, non-cursor planes. Some
+	 * drivers refer to these types of planes as "sprites" internally.
+	 */
+	DRM_PLANE_TYPE_OVERLAY,
 };

This is changing the order (and consequently the values) of these enums. But it is not updated in libdrm. I noticed this is causing an issue when playing with robclark's version of kmscube (branch atomic):

https://github.com/robclark/kmscube/tree/atomic

It looks like IGT also uses this macro from libdrm:

Quoted 8 lines
$ git grep -n DRM_PLANE_TYPE_PRIMARY
lib/igt_kms.c:1398:                     case DRM_PLANE_TYPE_PRIMARY:
tests/kms_frontbuffer_tracking.c:2302:              drm.plane_types[i] == DRM_PLANE_TYPE_PRIMARY)
tests/kms_frontbuffer_tracking.c:2602:              drm.plane_types[i] == DRM_PLANE_TYPE_PRIMARY) {
tests/kms_frontbuffer_tracking.c:2741:              drm.plane_types[i] == DRM_PLANE_TYPE_PRIMARY)

Anyway, should we update it on libdrm, bring the order back to its original values, or something else? Or am I missing something?

You're absolutely right. But you're missing the fix has already landed in drm-misc tree:

commit 226714dc7c6af6d0acee449eb2afce08d128edad

Author: Daniel Vetter <[email protected]>
Date:   Fri Sep 23 08:35:25 2016 +0200

drm: Fix plane type uabi breakage

BR,
Jani.

Quoted 7 lines

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

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw

Re: [PATCH 2/7] drm/doc: Polish for drm_plane.[hc]

Quoted 77 lines · Jani Nikula
Quoted 64 lines · Rafael Antognolli

Hi Daniel,

Quoted 42 lines · Daniel Vetter
include/drm/drm_plane.h +31 -1
index 1407715736a5..256219bfd07b 100644
@@ -319,10 +319,48 @@ struct drm_plane_funcs {
 	void (*early_unregister)(struct drm_plane *plane);
 };
 
+/**
+ * enum drm_plane_type - uapi plane type enumeration
+ *
+ * For historical reasons not all planes are made the same. This enumeration is
+ * used to tell the different types of planes apart to implement the different
+ * uapi semantics for them. For userspace which is universal plane aware and
+ * which is using that atomic IOCTL there's no difference between these planes
+ * (beyong what the driver and hardware can support of course).
+ *
+ * For compatibility with legacy userspace, only overlay planes are made
+ * available to userspace by default. Userspace clients may set the
+ * DRM_CLIENT_CAP_UNIVERSAL_PLANES client capability bit to indicate that they
+ * wish to receive a universal plane list containing all plane types. See also
+ * drm_for_each_legacy_plane().
+ */
 enum drm_plane_type {
-	DRM_PLANE_TYPE_OVERLAY,
+	/**
+	 * @DRM_PLANE_TYPE_PRIMARY:
+	 *
+	 * Primary planes represent a "main" plane for a CRTC.  Primary planes
+	 * are the planes operated upon by CRTC modesetting and flipping
+	 * operations described in the page_flip and set_config hooks in struct
+	 * &drm_crtc_funcs.
+	 */
 	DRM_PLANE_TYPE_PRIMARY,
+
+	/**
+	 * @DRM_PLANE_TYPE_CURSOR:
+	 *
+	 * Cursor planes represent a "cursor" plane for a CRTC.  Cursor planes
+	 * are the planes operated upon by the DRM_IOCTL_MODE_CURSOR and
+	 * DRM_IOCTL_MODE_CURSOR2 IOCTLs.
+	 */

include/drm/drm_plane.h struct drm_plane_funcs { · line 364

Quoted 10 lines
include/drm/drm_plane.h +8 -0
 	DRM_PLANE_TYPE_CURSOR,
+
+	/**
+	 * @DRM_PLANE_TYPE_OVERLAY:
+	 *
+	 * Overlay planes represent all non-primary, non-cursor planes. Some
+	 * drivers refer to these types of planes as "sprites" internally.
+	 */
+	DRM_PLANE_TYPE_OVERLAY,
 };

This is changing the order (and consequently the values) of these enums. But it is not updated in libdrm. I noticed this is causing an issue when playing with robclark's version of kmscube (branch atomic):

https://github.com/robclark/kmscube/tree/atomic

It looks like IGT also uses this macro from libdrm:

Quoted 8 lines
$ git grep -n DRM_PLANE_TYPE_PRIMARY
lib/igt_kms.c:1398:                     case DRM_PLANE_TYPE_PRIMARY:
tests/kms_frontbuffer_tracking.c:2302:              drm.plane_types[i] == DRM_PLANE_TYPE_PRIMARY)
tests/kms_frontbuffer_tracking.c:2602:              drm.plane_types[i] == DRM_PLANE_TYPE_PRIMARY) {
tests/kms_frontbuffer_tracking.c:2741:              drm.plane_types[i] == DRM_PLANE_TYPE_PRIMARY)

Anyway, should we update it on libdrm, bring the order back to its original values, or something else? Or am I missing something?

You're absolutely right. But you're missing the fix has already landed in drm-misc tree:

Quoted 8 lines

commit 226714dc7c6af6d0acee449eb2afce08d128edad

Author: Daniel Vetter <[email protected]>
Date:   Fri Sep 23 08:35:25 2016 +0200

drm: Fix plane type uabi breakage

BR,
Jani.

Oh, I was sure I had checked drm-intel-nightly too, but I clearly didn't. Sorry for the noise.

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

#5 lore raw

PATCH 3/7 drm: Conslidate blending properties in drm_blend.[hc]

In reply to Daniel Vetter

Imo zpos, rotatation, blending eq (once we have it) and all that should be in drm_blend.c, since those are all about how exactly the pixels are rendered onto the CRTC's visible area. Also noticed that one exported function accidentally ended up in drm_crtc_internal.h, move it to the right place too.

---
 drivers/gpu/drm/drm_blend.c         | 51 +++++++++++++++++++++++++++++++-
 drivers/gpu/drm/drm_crtc.c          | 49 ------------------------------
 drivers/gpu/drm/drm_crtc_internal.h |  3 --
 include/drm/drm_blend.h             | 59 +++++++++++++++++++++++++++++++++++++
 include/drm/drm_crtc.h              | 27 +----------------
 5 files changed, 110 insertions(+), 79 deletions(-)
 create mode 100644 include/drm/drm_blend.h
drivers/gpu/drm/drm_blend.c +50 -1
index 0a0b9357db35..0b8e227aa175 100644
@@ -25,13 +25,62 @@
  */
 #include <drm/drmP.h>
 #include <drm/drm_atomic.h>
-#include <drm/drm_crtc.h>
+#include <drm/drm_blend.h>
 #include <linux/export.h>
 #include <linux/slab.h>
 #include <linux/sort.h>
 
 #include "drm_crtc_internal.h"
 
+struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
+						       unsigned int supported_rotations)
+{
+	static const struct drm_prop_enum_list props[] = {
+		{ __builtin_ffs(DRM_ROTATE_0) - 1,   "rotate-0" },
+		{ __builtin_ffs(DRM_ROTATE_90) - 1,  "rotate-90" },
+		{ __builtin_ffs(DRM_ROTATE_180) - 1, "rotate-180" },
+		{ __builtin_ffs(DRM_ROTATE_270) - 1, "rotate-270" },
+		{ __builtin_ffs(DRM_REFLECT_X) - 1,  "reflect-x" },
+		{ __builtin_ffs(DRM_REFLECT_Y) - 1,  "reflect-y" },
+	};
+
+	return drm_property_create_bitmask(dev, 0, "rotation",
+					   props, ARRAY_SIZE(props),
+					   supported_rotations);
+}
+EXPORT_SYMBOL(drm_mode_create_rotation_property);
+
+/**
+ * drm_rotation_simplify() - Try to simplify the rotation
+ * @rotation: Rotation to be simplified
+ * @supported_rotations: Supported rotations
+ *
+ * Attempt to simplify the rotation to a form that is supported.
+ * Eg. if the hardware supports everything except DRM_REFLECT_X
+ * one could call this function like this:
+ *
+ * drm_rotation_simplify(rotation, DRM_ROTATE_0 |
+ *                       DRM_ROTATE_90 | DRM_ROTATE_180 |
+ *                       DRM_ROTATE_270 | DRM_REFLECT_Y);
+ *
+ * to eliminate the DRM_ROTATE_X flag. Depending on what kind of
+ * transforms the hardware supports, this function may not
+ * be able to produce a supported transform, so the caller should
+ * check the result afterwards.
+ */
+unsigned int drm_rotation_simplify(unsigned int rotation,
+				   unsigned int supported_rotations)
+{
+	if (rotation & ~supported_rotations) {
+		rotation ^= DRM_REFLECT_X | DRM_REFLECT_Y;
+		rotation = (rotation & DRM_REFLECT_MASK) |
+		           BIT((ffs(rotation & DRM_ROTATE_MASK) + 1) % 4);
+	}
+
+	return rotation;
+}
+EXPORT_SYMBOL(drm_rotation_simplify);
+
 /**
  * drm_plane_create_zpos_property - create mutable zpos property
  * @plane: drm plane
drivers/gpu/drm/drm_crtc.c +0 -49

61 lines not on this page · raw message

drivers/gpu/drm/drm_crtc_internal.h +0 -3
index cc717b70e43b..2e3d02f02ffc 100644
@@ -166,9 +166,6 @@ int drm_atomic_remove_fb(struct drm_framebuffer *fb);
 int drm_modeset_register_all(struct drm_device *dev);
 void drm_modeset_unregister_all(struct drm_device *dev);
 
-/* drm_blend.c */
-int drm_atomic_normalize_zpos(struct drm_device *dev,
-			      struct drm_atomic_state *state);
 
 /* drm_plane.c */
 int drm_plane_register_all(struct drm_device *dev);
include/drm/drm_blend.h new file +59 -0

59 lines not on this page · raw message

include/drm/drm_crtc.h +1 -26
index edc87b8168a0..449ca4e0ff18 100644
@@ -45,6 +45,7 @@
 #include <drm/drm_bridge.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_plane.h>
+#include <drm/drm_blend.h>
 
 struct drm_device;
 struct drm_mode_set;
@@ -63,21 +64,6 @@ static inline uint64_t I642U64(int64_t val)
 	return (uint64_t)*((uint64_t *)&val);
 }
 
-/*
- * Rotation property bits. DRM_ROTATE_<degrees> rotates the image by the
- * specified amount in degrees in counter clockwise direction. DRM_REFLECT_X and
- * DRM_REFLECT_Y reflects the image along the specified axis prior to rotation
- */
-#define DRM_ROTATE_0	BIT(0)
-#define DRM_ROTATE_90	BIT(1)
-#define DRM_ROTATE_180	BIT(2)
-#define DRM_ROTATE_270	BIT(3)
-#define DRM_ROTATE_MASK (DRM_ROTATE_0   | DRM_ROTATE_90 | \
-			 DRM_ROTATE_180 | DRM_ROTATE_270)
-#define DRM_REFLECT_X	BIT(4)
-#define DRM_REFLECT_Y	BIT(5)
-#define DRM_REFLECT_MASK (DRM_REFLECT_X | DRM_REFLECT_Y)
-
 /* data corresponds to displayid vend/prod/serial */
 struct drm_tile_group {
 	struct kref refcount;
@@ -1369,22 +1355,11 @@ extern struct drm_tile_group *drm_mode_get_tile_group(struct drm_device *dev,
 extern void drm_mode_put_tile_group(struct drm_device *dev,
 				   struct drm_tile_group *tg);
 
-extern struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
-							      unsigned int supported_rotations);
-extern unsigned int drm_rotation_simplify(unsigned int rotation,
-					  unsigned int supported_rotations);
 extern void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,
 				       uint degamma_lut_size,
 				       bool has_ctm,
 				       uint gamma_lut_size);
 
-int drm_plane_create_zpos_property(struct drm_plane *plane,
-				   unsigned int zpos,
-				   unsigned int min, unsigned int max);
-
-int drm_plane_create_zpos_immutable_property(struct drm_plane *plane,
-					     unsigned int zpos);
-
 /* Helpers */
 static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
 	uint32_t id)
Signature · 6 lines
2.7.4

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

PATCH 4/7 drm/doc: Polish plane composition property docs

In reply to Daniel Vetter

Try to spec a bit more precisely how they all fit together, now that at least the code is for all the additional properties is in one place.

Also remove the entries for the standardized properties from the table, because that thing is supremely unmaintaineable.

v2: Fix typos Sean spotted.

Cc Ville Syrjälä <[email protected]>
Cc Sean Paul <[email protected]>
Cc Benjamin Gaignard <[email protected]>
---
 Documentation/gpu/drm-kms.rst        |   7 +-
 Documentation/gpu/kms-properties.csv |  15 ----
 drivers/gpu/drm/drm_blend.c          | 146 ++++++++++++++++++++++++++++++-----
 drivers/gpu/drm/drm_plane.c          |   3 +
 4 files changed, 136 insertions(+), 35 deletions(-)
Documentation/gpu/drm-kms.rst +5 -2
index b1029e292e5c..6be8d3359620 100644
@@ -287,8 +287,11 @@ Property Types and Blob Property Support
 .. kernel-doc:: drivers/gpu/drm/drm_property.c
    :export:
 
-Blending and Z-Position properties
-----------------------------------
+Plane Composition Properties
+----------------------------
+
+.. kernel-doc:: drivers/gpu/drm/drm_blend.c
+   :doc: overview
 
 .. kernel-doc:: drivers/gpu/drm/drm_blend.c
    :export:
Documentation/gpu/kms-properties.csv +0 -15
index 4c5ce3edcfd9..1aa2493d1ef9 100644
@@ -1,23 +1,10 @@
 Owner Module/Drivers,Group,Property Name,Type,Property Values,Object attached,Description/Restrictions
-DRM,Generic,“rotation”,BITMASK,"{ 0, ""rotate-0"" }, { 1, ""rotate-90"" }, { 2, ""rotate-180"" }, { 3, ""rotate-270"" }, { 4, ""reflect-x"" }, { 5, ""reflect-y"" }","CRTC, Plane",rotate-(degrees) rotates the image by the specified amount in degrees in counter clockwise direction. reflect-x and reflect-y reflects the image along the specified axis prior to rotation
 ,,“scaling mode”,ENUM,"{ ""None"", ""Full"", ""Center"", ""Full aspect"" }",Connector,"Supported by: amdgpu, gma500, i915, nouveau and radeon."
 ,Connector,“EDID”,BLOB | IMMUTABLE,0,Connector,Contains id of edid blob ptr object.
 ,,“DPMS”,ENUM,"{ “On”, “Standby”, “Suspend”, “Off” }",Connector,Contains DPMS operation mode value.
 ,,“PATH”,BLOB | IMMUTABLE,0,Connector,Contains topology path to a connector.
 ,,“TILE”,BLOB | IMMUTABLE,0,Connector,Contains tiling information for a connector.
 ,,“CRTC_ID”,OBJECT,DRM_MODE_OBJECT_CRTC,Connector,CRTC that connector is attached to (atomic)
-,Plane,“type”,ENUM | IMMUTABLE,"{ ""Overlay"", ""Primary"", ""Cursor"" }",Plane,Plane type
-,,“SRC_X”,RANGE,"Min=0, Max=UINT_MAX",Plane,Scanout source x coordinate in 16.16 fixed point (atomic)
-,,“SRC_Y”,RANGE,"Min=0, Max=UINT_MAX",Plane,Scanout source y coordinate in 16.16 fixed point (atomic)
-,,“SRC_W”,RANGE,"Min=0, Max=UINT_MAX",Plane,Scanout source width in 16.16 fixed point (atomic)
-,,“SRC_H”,RANGE,"Min=0, Max=UINT_MAX",Plane,Scanout source height in 16.16 fixed point (atomic)
-,,“CRTC_X”,SIGNED_RANGE,"Min=INT_MIN, Max=INT_MAX",Plane,Scanout CRTC (destination) x coordinate (atomic)
-,,“CRTC_Y”,SIGNED_RANGE,"Min=INT_MIN, Max=INT_MAX",Plane,Scanout CRTC (destination) y coordinate (atomic)
-,,“CRTC_W”,RANGE,"Min=0, Max=UINT_MAX",Plane,Scanout CRTC (destination) width (atomic)
-,,“CRTC_H”,RANGE,"Min=0, Max=UINT_MAX",Plane,Scanout CRTC (destination) height (atomic)
-,,“FB_ID”,OBJECT,DRM_MODE_OBJECT_FB,Plane,Scanout framebuffer (atomic)
-,,“CRTC_ID”,OBJECT,DRM_MODE_OBJECT_CRTC,Plane,CRTC that plane is attached to (atomic)
-,,“zpos”,RANGE,"Min=0, Max=UINT_MAX","Plane,Z-order of the plane.Planes with higher Z-order values are displayed on top, planes with identical Z-order values are display in an undefined order"
 ,DVI-I,“subconnector”,ENUM,"{ “Unknown”, “DVI-D”, “DVI-A” }",Connector,TBD
 ,,“select subconnector”,ENUM,"{ “Automatic”, “DVI-D”, “DVI-A” }",Connector,TBD
 ,TV,“subconnector”,ENUM,"{ ""Unknown"", ""Composite"", ""SVIDEO"", ""Component"", ""SCART"" }",Connector,TBD
@@ -95,7 +82,6 @@ armada,CRTC,"""CSC_YUV""",ENUM,"{ ""Auto"" , ""CCIR601"", ""CCIR709"" }",CRTC,TB
 ,,"""contrast""",RANGE,"Min=0, Max=0x7fff",Plane,TBD
 ,,"""saturation""",RANGE,"Min=0, Max=0x7fff",Plane,TBD
 exynos,CRTC,“mode”,ENUM,"{ ""normal"", ""blank"" }",CRTC,TBD
-,Overlay,“zpos”,RANGE,"Min=0, Max=MAX_PLANE-1",Plane,TBD
 i2c/ch7006_drv,Generic,“scale”,RANGE,"Min=0, Max=2",Connector,TBD
 ,TV,“mode”,ENUM,"{ ""PAL"", ""PAL-M"",""PAL-N""}, ”PAL-Nc"" , ""PAL-60"", ""NTSC-M"", ""NTSC-J"" }",Connector,TBD
 nouveau,NV10 Overlay,"""colorkey""",RANGE,"Min=0, Max=0x01ffffff",Plane,TBD
@@ -126,4 +112,3 @@ radeon,DVI-I,“coherent”,RANGE,"Min=0, Max=1",Connector,TBD
 ,FMT Dithering,“dither”,ENUM,"{ ""off"", ""on"" }",Connector,TBD
 rcar-du,Generic,"""alpha""",RANGE,"Min=0, Max=255",Plane,TBD
 ,,"""colorkey""",RANGE,"Min=0, Max=0x01ffffff",Plane,TBD
-,,"""zpos""",RANGE,"Min=1, Max=7",Plane,TBD
drivers/gpu/drm/drm_blend.c +128 -18

179 lines not on this page · raw message

drivers/gpu/drm/drm_plane.c +3 -0
index c17c9c2a342e..cd0d475bf3c3 100644
@@ -45,6 +45,9 @@
  * &drm_plane_type for a more in-depth discussion of these special uapi-relevant
  * plane types. Special planes are associated with their CRTC by calling
  * drm_crtc_init_with_planes().
+ *
+ * The type of a plane is exposed in the immutable "type" enumeration property,
+ * which has one of the following values: "Overlay", "Primary", "Cursor".
  */
 
 static unsigned int drm_num_planes(struct drm_device *dev)
Signature · 6 lines
2.7.4

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

PATCH 5/7 drm: Extract drm_color_mgmt.[hc]

In reply to Daniel Vetter

For both the new degamm/lut/gamma atomic combo, and the old legacy gamma tables.

---
 drivers/gpu/drm/Makefile            |   2 +-
 drivers/gpu/drm/drm_color_mgmt.c    | 248 ++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_crtc.c          | 220 --------------------------------
 drivers/gpu/drm/drm_crtc_internal.h |   4 +
 include/drm/drm_color_mgmt.h        |  56 ++++++++
 include/drm/drm_crtc.h              |  28 +---
 6 files changed, 310 insertions(+), 248 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_color_mgmt.c
 create mode 100644 include/drm/drm_color_mgmt.h
drivers/gpu/drm/Makefile +1 -1
index 8eeb07a35798..25c720454017 100644
@@ -15,7 +15,7 @@ drm-y       :=	drm_auth.o drm_bufs.o drm_cache.o \
 		drm_modeset_lock.o drm_atomic.o drm_bridge.o \
 		drm_framebuffer.o drm_connector.o drm_blend.o \
 		drm_encoder.o drm_mode_object.o drm_property.o \
-		drm_plane.o
+		drm_plane.o drm_color_mgmt.o
 
 drm-$(CONFIG_COMPAT) += drm_ioc32.o
 drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
drivers/gpu/drm/drm_color_mgmt.c new file +248 -0

248 lines not on this page · raw message

drivers/gpu/drm/drm_crtc.c +0 -220

229 lines not on this page · raw message

drivers/gpu/drm/drm_crtc_internal.h +4 -0
index 2e3d02f02ffc..14c2f8dff781 100644
@@ -58,6 +58,10 @@ int drm_mode_getcrtc(struct drm_device *dev,
 		     void *data, struct drm_file *file_priv);
 int drm_mode_setcrtc(struct drm_device *dev,
 		     void *data, struct drm_file *file_priv);
+
+/* drm_color_mgmt.c */
+
+/* IOCTLs */
 int drm_mode_gamma_get_ioctl(struct drm_device *dev,
 			     void *data, struct drm_file *file_priv);
 int drm_mode_gamma_set_ioctl(struct drm_device *dev,
include/drm/drm_color_mgmt.h new file +56 -0

56 lines not on this page · raw message

include/drm/drm_crtc.h +1 -27
index 449ca4e0ff18..f88f9a2d05c1 100644
@@ -46,6 +46,7 @@
 #include <drm/drm_edid.h>
 #include <drm/drm_plane.h>
 #include <drm/drm_blend.h>
+#include <drm/drm_color_mgmt.h>
 
 struct drm_device;
 struct drm_mode_set;
@@ -1343,9 +1344,6 @@ extern void drm_mode_config_init(struct drm_device *dev);
 extern void drm_mode_config_reset(struct drm_device *dev);
 extern void drm_mode_config_cleanup(struct drm_device *dev);
 
-extern int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
-					 int gamma_size);
-
 extern int drm_mode_set_config_internal(struct drm_mode_set *set);
 
 extern struct drm_tile_group *drm_mode_create_tile_group(struct drm_device *dev,
@@ -1355,11 +1353,6 @@ extern struct drm_tile_group *drm_mode_get_tile_group(struct drm_device *dev,
 extern void drm_mode_put_tile_group(struct drm_device *dev,
 				   struct drm_tile_group *tg);
 
-extern void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,
-				       uint degamma_lut_size,
-				       bool has_ctm,
-				       uint gamma_lut_size);
-
 /* Helpers */
 static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
 	uint32_t id)
@@ -1369,25 +1362,6 @@ static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
 	return mo ? obj_to_crtc(mo) : NULL;
 }
 
-/*
- * Extract a degamma/gamma LUT value provided by user and round it to the
- * precision supported by the hardware.
- */
-static inline uint32_t drm_color_lut_extract(uint32_t user_input,
-					     uint32_t bit_precision)
-{
-	uint32_t val = user_input;
-	uint32_t max = 0xffff >> (16 - bit_precision);
-
-	/* Round only if we're not using full precision. */
-	if (bit_precision < 16) {
-		val += 1UL << (16 - bit_precision - 1);
-		val >>= 16 - bit_precision;
-	}
-
-	return clamp_val(val, 0, max);
-}
-
 #define drm_for_each_crtc(crtc, dev) \
 	list_for_each_entry(crtc, &(dev)->mode_config.crtc_list, head)
 
Signature · 6 lines
2.7.4

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

PATCH 6/7 drm/doc: Document color space handling

In reply to Daniel Vetter

Again move it from the unmaintainable csv into DOC free-form overview sections.

v2: Types Lionel&Sean spotted.

---
 Documentation/gpu/drm-kms.rst        | 12 +++++++++
 Documentation/gpu/kms-properties.csv |  5 ----
 drivers/gpu/drm/drm_color_mgmt.c     | 48 ++++++++++++++++++++++++++++++++++++
 include/drm/drm_color_mgmt.h         | 11 ++++++---
 4 files changed, 68 insertions(+), 8 deletions(-)
Documentation/gpu/drm-kms.rst +12 -0
index 6be8d3359620..53b872c105d2 100644
@@ -296,6 +296,18 @@ Plane Composition Properties
 .. kernel-doc:: drivers/gpu/drm/drm_blend.c
    :export:
 
+Color Management Properties
+---------------------------
+
+.. kernel-doc:: drivers/gpu/drm/drm_color_mgmt.c
+   :doc: overview
+
+.. kernel-doc:: include/drm/drm_color_mgmt.h
+   :internal:
+
+.. kernel-doc:: drivers/gpu/drm/drm_color_mgmt.c
+   :export:
+
 Existing KMS Properties
 -----------------------
 
Documentation/gpu/kms-properties.csv +0 -5
index 1aa2493d1ef9..1a5729c4af65 100644
@@ -24,11 +24,6 @@ Owner Module/Drivers,Group,Property Name,Type,Property Values,Object attached,De
 ,,“suggested Y”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an Y offset for a connector
 ,Optional,"""aspect ratio""",ENUM,"{ ""None"", ""4:3"", ""16:9"" }",Connector,TDB
 ,,“dirty”,ENUM | IMMUTABLE,"{ ""Off"", ""On"", ""Annotate"" }",Connector,TBD
-,,“DEGAMMA_LUT”,BLOB,0,CRTC,DRM property to set the degamma lookup table (LUT) mapping pixel data from the framebuffer before it is given to the transformation matrix. The data is an interpreted as an array of struct drm_color_lut elements. Hardware might choose not to use the full precision of the LUT elements nor use all the elements of the LUT (for example the hardware might choose to interpolate between LUT[0] and LUT[4]).
-,,“DEGAMMA_LUT_SIZE”,RANGE | IMMUTABLE,"Min=0, Max=UINT_MAX",CRTC,DRM property to gives the size of the lookup table to be set on the DEGAMMA_LUT property (the size depends on the underlying hardware).
-,,“CTM”,BLOB,0,CRTC,DRM property to set the current transformation matrix (CTM) apply to pixel data after the lookup through the degamma LUT and before the lookup through the gamma LUT. The data is an interpreted as a struct drm_color_ctm.
-,,“GAMMA_LUT”,BLOB,0,CRTC,DRM property to set the gamma lookup table (LUT) mapping pixel data after to the transformation matrix to data sent to the connector. The data is an interpreted as an array of struct drm_color_lut elements. Hardware might choose not to use the full precision of the LUT elements nor use all the elements of the LUT (for example the hardware might choose to interpolate between LUT[0] and LUT[4]).
-,,“GAMMA_LUT_SIZE”,RANGE | IMMUTABLE,"Min=0, Max=UINT_MAX",CRTC,DRM property to gives the size of the lookup table to be set on the GAMMA_LUT property (the size depends on the underlying hardware).
 i915,Generic,"""Broadcast RGB""",ENUM,"{ ""Automatic"", ""Full"", ""Limited 16:235"" }",Connector,"When this property is set to Limited 16:235 and CTM is set, the hardware will be programmed with the result of the multiplication of CTM by the limited range matrix to ensure the pixels normaly in the range 0..1.0 are remapped to the range 16/255..235/255."
 ,,“audio”,ENUM,"{ ""force-dvi"", ""off"", ""auto"", ""on"" }",Connector,TBD
 ,SDVO-TV,“mode”,ENUM,"{ ""NTSC_M"", ""NTSC_J"", ""NTSC_443"", ""PAL_B"" } etc.",Connector,TBD
drivers/gpu/drm/drm_color_mgmt.c +48 -0

54 lines not on this page · raw message

include/drm/drm_color_mgmt.h +8 -3
index 1e01c58bbe81..c767238ac9d5 100644
@@ -33,9 +33,14 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc,
 int drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc,
 				 int gamma_size);
 
-/*
- * Extract a degamma/gamma LUT value provided by user and round it to the
- * precision supported by the hardware.
+/**
+ * drm_color_lut_extract - clamp&round LUT entries
+ * @user_input: input value
+ * @bit_precision: number of bits the hw LUT supports
+ *
+ * Extract a degamma/gamma LUT value provided by user (in the form of
+ * &drm_color_lut entries) and round it to the precision supported by the
+ * hardware.
  */
 static inline uint32_t drm_color_lut_extract(uint32_t user_input,
 					     uint32_t bit_precision)
Signature · 6 lines
2.7.4

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

PATCH 7/7 drm: Remove dirty property from docs

In reply to Daniel Vetter

We removed it in

commit 6ab10b76ff6252bd9be0849c40f5865e39a29961

Author: Daniel Vetter <[email protected]>
Date:   Fri Aug 12 22:48:45 2016 +0200

drm/kms: Nuke dirty_info property

---
 Documentation/gpu/kms-properties.csv | 1 -
 1 file changed, 1 deletion(-)
Documentation/gpu/kms-properties.csv +0 -1
index 1a5729c4af65..981873a05d14 100644
@@ -23,7 +23,6 @@ Owner Module/Drivers,Group,Property Name,Type,Property Values,Object attached,De
 ,Virtual GPU,“suggested X”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an X offset for a connector
 ,,“suggested Y”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an Y offset for a connector
 ,Optional,"""aspect ratio""",ENUM,"{ ""None"", ""4:3"", ""16:9"" }",Connector,TDB
-,,“dirty”,ENUM | IMMUTABLE,"{ ""Off"", ""On"", ""Annotate"" }",Connector,TBD
 i915,Generic,"""Broadcast RGB""",ENUM,"{ ""Automatic"", ""Full"", ""Limited 16:235"" }",Connector,"When this property is set to Limited 16:235 and CTM is set, the hardware will be programmed with the result of the multiplication of CTM by the limited range matrix to ensure the pixels normaly in the range 0..1.0 are remapped to the range 16/255..235/255."
 ,,“audio”,ENUM,"{ ""force-dvi"", ""off"", ""auto"", ""on"" }",Connector,TBD
 ,SDVO-TV,“mode”,ENUM,"{ ""NTSC_M"", ""NTSC_J"", ""NTSC_443"", ""PAL_B"" } etc.",Connector,TBD
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Applied
#10 lore raw

Re: [PATCH 7/7] drm: Remove dirty property from docs

Quoted 10 lines · Daniel Vetter

We removed it in

commit 6ab10b76ff6252bd9be0849c40f5865e39a29961

Author: Daniel Vetter <[email protected]>
Date:   Fri Aug 12 22:48:45 2016 +0200

drm/kms: Nuke dirty_info property

Didn't see a cover letter offhand, so arbitrarily picking this one

Applied to -misc (with some amount of effort & consternation).

Sean

Quoted 19 lines
---
 Documentation/gpu/kms-properties.csv | 1 -
 1 file changed, 1 deletion(-)
Documentation/gpu/kms-properties.csv +0 -2
index 1a5729c4af65..981873a05d14 100644
@@ -23,7 +23,6 @@ Owner Module/Drivers,Group,Property Name,Type,Property Values,Object attached,De
 ,Virtual GPU,“suggested X”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an X offset for a connector
 ,,“suggested Y”,RANGE,"Min=0, Max=0xffffffff",Connector,property to suggest an Y offset for a connector
 ,Optional,"""aspect ratio""",ENUM,"{ ""None"", ""4:3"", ""16:9"" }",Connector,TDB
-,,“dirty”,ENUM | IMMUTABLE,"{ ""Off"", ""On"", ""Annotate"" }",Connector,TBD
 i915,Generic,"""Broadcast RGB""",ENUM,"{ ""Automatic"", ""Full"", ""Limited 16:235"" }",Connector,"When this property is set to Limited 16:235 and CTM is set, the hardware will be programmed with the result of the multiplication of CTM by the limited range matrix to ensure the pixels normaly in the range 0..1.0 are remapped to the range 16/255..235/255."
 ,,“audio”,ENUM,"{ ""force-dvi"", ""off"", ""auto"", ""on"" }",Connector,TBD
 ,SDVO-TV,“mode”,ENUM,"{ ""NTSC_M"", ""NTSC_J"", ""NTSC_443"", ""PAL_B"" } etc.",Connector,TBD
--

2.7.4

Quoted 4 lines

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

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

#11 lore raw
In reply to Daniel Vetter
Quoted 24 lines · Daniel Vetter

Just pure code movement, cleanup and polish will happen in later patches.

v2: Don't forget all the ioctl! To extract those cleanly I decided to put check_src_coords into drm_framebuffer.c (and give it a drm_framebuffer_ prefix), since that just checks framebuffer constraints.

v3: rebase over PAGE_FLIP_TARGET.

---
 Documentation/gpu/drm-kms.rst       |  12 +
 drivers/gpu/drm/Makefile            |   3 +-
 drivers/gpu/drm/drm_crtc.c          | 991 +-----------------------------------
 drivers/gpu/drm/drm_crtc_internal.h |  38 +-
 drivers/gpu/drm/drm_framebuffer.c   |  26 +
 drivers/gpu/drm/drm_plane.c         | 990 +++++++++++++++++++++++++++++++++++
 include/drm/drm_atomic.h            | 154 ++++++
 include/drm/drm_crtc.h              | 583 +--------------------
 include/drm/drm_plane.h             | 470 +++++++++++++++++
 9 files changed, 1681 insertions(+), 1586 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_plane.c

<snip>

Quoted 4 lines
include/drm/drm_crtc.h +0 -0
index 2318daa8911d..edc87b8168a0 100644

<snip>

Quoted 22 lines
include/drm/drm_crtc.h +0 -22
-/**
- * struct drm_atomic_state - the global state object for atomic updates
- * @dev: parent DRM device
- * @allow_modeset: allow full modeset
- * @legacy_cursor_update: hint to enforce legacy cursor IOCTL semantics
- * @legacy_set_config: Disable conflicting encoders instead of failing with -EINVAL.
- * @planes: pointer to array of structures with per-plane data
- * @crtcs: pointer to array of CRTC pointers
- * @num_connector: size of the @connectors and @connector_states arrays
- * @connectors: pointer to array of structures with per-connector data
- * @acquire_ctx: acquire context for this atomic modeset state update
- */
-struct drm_atomic_state {
-	struct drm_device *dev;
-	bool allow_modeset : 1;
-	bool legacy_cursor_update : 1;
-	bool legacy_set_config : 1;
-	struct __drm_planes_state *planes;
-	struct __drm_crtcs_state *crtcs;
-	int num_connector;
-	struct __drm_connnectors_state *connectors;
-

include/drm/drm_crtc.h struct drm_crtc { · line 1175

Quoted 10 lines
include/drm/drm_crtc.h +0 -10
-	struct drm_modeset_acquire_ctx *acquire_ctx;
-
-	/**
-	 * @commit_work:
-	 *
-	 * Work item which can be used by the driver or helpers to execute the
-	 * commit without blocking.
-	 */
-	struct work_struct commit_work;
-};

../drivers/gpu/drm/tilcdc/tilcdc_crtc.c: In function ‘tilcdc_crtc_atomic_check’:
../drivers/gpu/drm/tilcdc/tilcdc_crtc.c:484:18: error: dereferencing pointer to incomplete type ../drivers/gpu/drm/tilcdc/tilcdc_crtc.c:485:18: error: dereferencing pointer to incomplete type ../drivers/gpu/drm/tilcdc/tilcdc_crtc.c:486:18: error: dereferencing pointer to incomplete type

:(

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

#12 lore raw

PATCH 1/1 drm/tilcdc: Add atomic and crtc headers to crtc.c

Also reorder alphabetically and fix up drm_flip_work header.

---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/tilcdc/tilcdc_crtc.c +4 -2
index 2087689..cb9df10 100644
@@ -15,9 +15,11 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "drm_flip_work.h"
-#include <drm/drm_plane_helper.h>
+#include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_flip_work.h>
+#include <drm/drm_plane_helper.h>
 
 #include "tilcdc_drv.h"
 #include "tilcdc_regs.h"
Signature · 6 lines
2.8.0.rc3.226.g39d4020

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#13 lore raw

Re: [PATCH] drm/tilcdc: Add atomic and crtc headers to crtc.c

Quoted 3 lines · Sean Paul

Also reorder alphabetically and fix up drm_flip_work header.

Quoted 25 lines
---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/tilcdc/tilcdc_crtc.c +4 -2
index 2087689..cb9df10 100644
@@ -15,9 +15,11 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "drm_flip_work.h"
-#include <drm/drm_plane_helper.h>
+#include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_flip_work.h>
+#include <drm/drm_plane_helper.h>
 
 #include "tilcdc_drv.h"
 #include "tilcdc_regs.h"
Signature · 1 line
2.8.0.rc3.226.g39d4020
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
#14 lore raw

Re: [PATCH] drm/tilcdc: Add atomic and crtc headers to crtc.c

Quoted 7 lines · Daniel Vetter
Quoted 3 lines · Sean Paul

Also reorder alphabetically and fix up drm_flip_work header.

Picked this up. Thanks!

Best regards,
Jyri

Quoted 20 lines
Quoted 20 lines
---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/tilcdc/tilcdc_crtc.c +4 -2
index 2087689..cb9df10 100644
@@ -15,9 +15,11 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "drm_flip_work.h"
-#include <drm/drm_plane_helper.h>
+#include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_flip_work.h>
+#include <drm/drm_plane_helper.h>
 
Quoted 6 lines
Quoted 5 lines
drivers/gpu/drm/tilcdc/tilcdc_crtc.c +0 -0
 #include "tilcdc_drv.h"
 #include "tilcdc_regs.h"
Signature · 1 line
2.8.0.rc3.226.g39d4020

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

#15 lore raw

Re: [PATCH] drm/tilcdc: Add atomic and crtc headers to crtc.c

Quoted 11 lines · Jyri Sarha
Quoted 7 lines · Daniel Vetter
Quoted 3 lines · Sean Paul

Also reorder alphabetically and fix up drm_flip_work header.

Picked this up. Thanks!

Hi Jyri,
I already picked this up through drm-misc to preface Daniel's clean-up patch series.

Could you drop this from your tree and we'll take it through -misc?

Sean

Quoted 30 lines

Best regards,
Jyri

Quoted 26 lines
Quoted 25 lines
---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/tilcdc/tilcdc_crtc.c +4 -3
index 2087689..cb9df10 100644
@@ -15,9 +15,11 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "drm_flip_work.h"
-#include <drm/drm_plane_helper.h>
+#include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_flip_work.h>
+#include <drm/drm_plane_helper.h>
 
 #include "tilcdc_drv.h"
 #include "tilcdc_regs.h"
--

2.8.0.rc3.226.g39d4020

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

#16 lore raw

Re: [PATCH] drm/tilcdc: Add atomic and crtc headers to crtc.c

Quoted 10 lines · Sean Paul
Quoted 9 lines · Jyri Sarha
Quoted 7 lines · Daniel Vetter
Quoted 3 lines · Sean Paul

Also reorder alphabetically and fix up drm_flip_work header.

Quoted 9 lines
Quoted 2 lines

Picked this up. Thanks!

Hi Jyri,
I already picked this up through drm-misc to preface Daniel's clean-up patch series.

Could you drop this from your tree and we'll take it through -misc?

Argh I sent the pull request already. However, Dave has not pulled it yet, so I'll make another and ask him the ignore one with your patch.

BR,
Jyri

Quoted 33 lines

Sean

Quoted 30 lines

Best regards,
Jyri

Quoted 26 lines
Quoted 25 lines
---
 drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/tilcdc/tilcdc_crtc.c +4 -3
index 2087689..cb9df10 100644
@@ -15,9 +15,11 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "drm_flip_work.h"
-#include <drm/drm_plane_helper.h>
+#include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_flip_work.h>
+#include <drm/drm_plane_helper.h>
 
 #include "tilcdc_drv.h"
 #include "tilcdc_regs.h"
--

2.8.0.rc3.226.g39d4020

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

#17 lore raw
In reply to Sean Paul
Quoted 74 lines · Sean Paul
Quoted 24 lines · Daniel Vetter

Just pure code movement, cleanup and polish will happen in later patches.

v2: Don't forget all the ioctl! To extract those cleanly I decided to put check_src_coords into drm_framebuffer.c (and give it a drm_framebuffer_ prefix), since that just checks framebuffer constraints.

v3: rebase over PAGE_FLIP_TARGET.

---
 Documentation/gpu/drm-kms.rst       |  12 +
 drivers/gpu/drm/Makefile            |   3 +-
 drivers/gpu/drm/drm_crtc.c          | 991 +-----------------------------------
 drivers/gpu/drm/drm_crtc_internal.h |  38 +-
 drivers/gpu/drm/drm_framebuffer.c   |  26 +
 drivers/gpu/drm/drm_plane.c         | 990 +++++++++++++++++++++++++++++++++++
 include/drm/drm_atomic.h            | 154 ++++++
 include/drm/drm_crtc.h              | 583 +--------------------
 include/drm/drm_plane.h             | 470 +++++++++++++++++
 9 files changed, 1681 insertions(+), 1586 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_plane.c

<snip>

Quoted 4 lines
include/drm/drm_crtc.h +0 -0
index 2318daa8911d..edc87b8168a0 100644

<snip>

Quoted 22 lines
include/drm/drm_crtc.h +0 -22
-/**
- * struct drm_atomic_state - the global state object for atomic updates
- * @dev: parent DRM device
- * @allow_modeset: allow full modeset
- * @legacy_cursor_update: hint to enforce legacy cursor IOCTL semantics
- * @legacy_set_config: Disable conflicting encoders instead of failing with -EINVAL.
- * @planes: pointer to array of structures with per-plane data
- * @crtcs: pointer to array of CRTC pointers
- * @num_connector: size of the @connectors and @connector_states arrays
- * @connectors: pointer to array of structures with per-connector data
- * @acquire_ctx: acquire context for this atomic modeset state update
- */
-struct drm_atomic_state {
-     struct drm_device *dev;
-     bool allow_modeset : 1;
-     bool legacy_cursor_update : 1;
-     bool legacy_set_config : 1;
-     struct __drm_planes_state *planes;
-     struct __drm_crtcs_state *crtcs;
-     int num_connector;
-     struct __drm_connnectors_state *connectors;
-

include/drm/drm_crtc.h struct drm_crtc { · line 1175

Quoted 10 lines
include/drm/drm_crtc.h +0 -10
-     struct drm_modeset_acquire_ctx *acquire_ctx;
-
-     /**
-      * @commit_work:
-      *
-      * Work item which can be used by the driver or helpers to execute the
-      * commit without blocking.
-      */
-     struct work_struct commit_work;
-};

../drivers/gpu/drm/tilcdc/tilcdc_crtc.c: In function ‘tilcdc_crtc_atomic_check’:
../drivers/gpu/drm/tilcdc/tilcdc_crtc.c:484:18: error: dereferencing pointer to incomplete type ../drivers/gpu/drm/tilcdc/tilcdc_crtc.c:485:18: error: dereferencing pointer to incomplete type ../drivers/gpu/drm/tilcdc/tilcdc_crtc.c:486:18: error: dereferencing pointer to incomplete type

Quoted 1 line

:(

I've posted a patch to precede your series which should fix this up.

Sean

Quoted 6 lines

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

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