drm: add generic zpos property
Subsystems (4)
cover drm: add generic zpos property
The original patches have been done by Marek:
https://lists.freedesktop.org/archives/dri-devel/2016-January/099572.html
I have just adapt them to make zpos depend on plane and no more on drm core.
Since zpos range can be define per plane normalize function takes care of the min and max before compute normalized zpos value.
Benjamin Gaignard (2):
drm: add generic zpos property
drm: sti: use generic zpos for plane
Documentation/DocBook/gpu.tmpl | 10 ++ drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/drm_atomic.c | 4 + drivers/gpu/drm/drm_atomic_helper.c | 6 + drivers/gpu/drm/drm_blend.c | 242 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_crtc_internal.h | 3 + drivers/gpu/drm/sti/sti_mixer.c | 2 +- drivers/gpu/drm/sti/sti_plane.c | 82 +++++------- drivers/gpu/drm/sti/sti_plane.h | 2 - include/drm/drm_crtc.h | 17 +++ 10 files changed, 314 insertions(+), 56 deletions(-) create mode 100644 drivers/gpu/drm/drm_blend.c
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/2 drm: add generic zpos property
This patch adds support for generic plane's zpos property property with well-defined semantics:
- added zpos properties to plane and plane state structures
- added helpers for normalizing zpos properties of given set of planes
- well defined semantics: planes are sorted by zpos values and then plane id value if zpos equals
Normalized zpos values are calculated automatically when generic mutable zpos property has been initialized. Drivers can simply use plane_state->normalized_zpos in their atomic_check and/or plane_update callbacks without any additional calls to DRM core.
--- Documentation/DocBook/gpu.tmpl | 10 ++ drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/drm_atomic.c | 4 + drivers/gpu/drm/drm_atomic_helper.c | 6 + drivers/gpu/drm/drm_blend.c | 242 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_crtc_internal.h | 3 + include/drm/drm_crtc.h | 17 +++ 7 files changed, 283 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/drm_blend.c
Documentation/DocBook/gpu.tmpl +10 -0
@@ -2147,6 +2147,16 @@ void intel_crt_init(struct drm_device *dev) the underlying hardware).</td> </tr> <tr> + <td valign="top" > "zpos" </td> + <td valign="top" >RANGE</td> + <td valign="top" >Min= driver dependent, Max= driver dependent</td> + <td valign="top" >Plane</td> + <td valign="top" >Plane's 'z' position during blending operation (0 for background, highest for frontmost). + If two planes assigned to same CRTC have equal zpos values, the plane with higher plane + id is treated as closer to front. Can be IMMUTABLE if driver doesn't support changing + planes' order. Exact value range is driver dependent.</td> + </tr> + <tr> <td rowspan="20" valign="top" >i915</td> <td rowspan="2" valign="top" >Generic</td> <td valign="top" >"Broadcast RGB"</td>
drivers/gpu/drm/Makefile +1 -1
@@ -2,7 +2,7 @@ # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. -drm-y := drm_auth.o drm_bufs.o drm_cache.o \ +drm-y := drm_auth.o drm_bufs.o drm_blend.o drm_cache.o \ drm_context.o drm_dma.o \ drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \ drm_lock.o drm_memory.o drm_drv.o drm_vm.o \
drivers/gpu/drm/drm_atomic.c +4 -0
@@ -701,6 +701,8 @@ int drm_atomic_plane_set_property(struct drm_plane *plane, state->src_h = val; }else if (property == config->rotation_property) { state->rotation = val; + }else if (property == plane->zpos_property) { + state->zpos = val; }else if (plane->funcs->atomic_set_property) {return plane->funcs->atomic_set_property (plane, state, property, val);
@@ -757,6 +759,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane, *val = state->src_h; }else if (property == config->rotation_property) { *val = state->rotation; + }else if (property == plane->zpos_property) { + *val = state->zpos; }else if (plane->funcs->atomic_get_property) {return plane->funcs->atomic_get_property (plane, state, property, val); }else {
drivers/gpu/drm/drm_atomic_helper.c +6 -0
@@ -32,6 +32,8 @@#include <drm/drm_atomic_helper.h> #include <linux/fence.h> +#include "drm_crtc_internal.h" +/** * DOC: overview *
@@ -587,6 +589,10 @@ drm_atomic_helper_check_planes(struct drm_device *dev,struct drm_plane_state *plane_state;int i, ret =0 ; + ret =drm_atomic_helper_normalize_zpos (dev, state); +if (ret) +return ret; +for_each_plane_in_state (state, plane, plane_state, i) {const struct drm_plane_helper_funcs *funcs;
drivers/gpu/drm/drm_blend.c new file +242 -0
242 lines not on this page · raw message
drivers/gpu/drm/drm_crtc_internal.h +3 -0
@@ -42,3 +42,6 @@ int drm_atomic_get_property(struct drm_mode_object *obj,int drm_mode_atomic_ioctl (struct drm_device *dev,void *data,struct drm_file *file_priv); +/* drm_blend.c */ +int drm_atomic_helper_normalize_zpos (struct drm_device *dev, +struct drm_atomic_state *state);
include/drm/drm_crtc.h +17 -0
@@ -305,6 +305,7 @@ struct drm_plane_helper_funcs;* @mode_changed: crtc_state->mode or crtc_state->enable has been changed * @active_changed: crtc_state->active has been toggled. * @connectors_changed: connectors to this crtc have been updated +* @zpos_changed: zpos values of planes on this crtc have been updated * @color_mgmt_changed: color management properties have changed (degamma or * gamma LUT or CSC matrix) * @plane_mask: bitmask of (1 << drm_plane_index(plane)) of attached planes
@@ -340,6 +341,7 @@ struct drm_crtc_state { bool mode_changed : 1; bool active_changed : 1; bool connectors_changed : 1; + bool zpos_changed : 1; bool color_mgmt_changed : 1;/* attached planes bitmask:
@@ -1263,6 +1265,9 @@ struct drm_connector {* plane (in 16.16) * @src_w: width of visible portion of plane (in 16.16) * @src_h: height of visible portion of plane (in 16.16) +* @zpos: priority of the given plane on crtc (optional) +* @normalized_zpos: normalized value of zpos: unique, range from 0 to N +* for given crtc * @state: backpointer to global drm_atomic_state */ struct drm_plane_state {
@@ -1283,6 +1288,10 @@ struct drm_plane_state {/* Plane rotation */ unsigned int rotation; +/* Plane zpos */ +unsigned int zpos; +unsigned int normalized_zpos; +struct drm_atomic_state *state; };
@@ -1514,6 +1523,7 @@ enum drm_plane_type {* drm_mode_set_config_internal() to implement correct refcounting. * @funcs: helper functions * @properties: property tracking for this plane +* @zpos_property: attached zpos property for this plane * @type: type of plane (overlay, primary, cursor) * @state: current atomic state for this plane */
@@ -1540,6 +1550,7 @@ struct drm_plane {const struct drm_plane_funcs *funcs;struct drm_object_properties properties; +struct drm_property *zpos_property;enum drm_plane_type type;
@@ -2551,6 +2562,12 @@ extern struct drm_property *drm_mode_create_rotation_property(struct drm_deviceextern unsigned int drm_rotation_simplify (unsigned int rotation,unsigned int supported_rotations); +extern int drm_plane_create_zpos_property (struct drm_plane *plane, +unsigned int min,unsigned int max); +extern int drm_plane_create_zpos_immutable_property (struct drm_plane *plane, +unsigned int min, +unsigned int max); +/* Helpers */ static inline struct drm_plane *drm_plane_find(struct drm_device *dev,
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/2 drm: sti: use generic zpos for plane
In reply to Benjamin Gaignardremove private zpos property and use instead the generic new. zpos range is now fixed per plane type and normalized before being using in mixer.
--- drivers/gpu/drm/sti/sti_mixer.c | 2 +- drivers/gpu/drm/sti/sti_plane.c | 82 +++++++++++++++-------------------------- drivers/gpu/drm/sti/sti_plane.h | 2 - 3 files changed, 31 insertions(+), 55 deletions(-)
drivers/gpu/drm/sti/sti_mixer.c +1 -1
@@ -245,7 +245,7 @@ static void sti_mixer_set_background_area(struct sti_mixer *mixer,int sti_mixer_set_plane_depth (struct sti_mixer *mixer,struct sti_plane *plane) { -int plane_id, depth = plane->zorder; +int plane_id, depth = plane->drm_plane.state->normalized_zpos +1 ;unsigned int i;u32 mask, val;
drivers/gpu/drm/sti/sti_plane.c +30 -52
114 lines not on this page · raw message
drivers/gpu/drm/sti/sti_plane.h +0 -2
@@ -68,14 +68,12 @@ struct sti_fps_info {* @plane: drm plane it is bound to (if any) * @desc: plane type & id * @status: to know the status of the plane -* @zorder: plane z-order * @fps_info: frame per second info */ struct sti_plane {struct drm_plane drm_plane;enum sti_plane_desc desc;enum sti_plane_status status; -int zorder;struct sti_fps_info fps_info; };
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 2 lines · Benjamin Gaignard
The original patches have been done by Marek:
https://lists.freedesktop.org/archives/dri-devel/2016-January/099572.html
It's good practice to mention this in the commit message of the patch that you've reworked because the git repository won't contain the text from the cover letter. Typically you'd add something like this:
Based on work by Marek Szyprowski <[email protected]>
Thierry
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hello,
Quoted 7 lines · Benjamin Gaignard
The original patches have been done by Marek:
https://lists.freedesktop.org/archives/dri-devel/2016-January/099572.htmlI have just adapt them to make zpos depend on plane and no more on drm core.
Since zpos range can be define per plane normalize function takes care of the min and max before compute normalized zpos value.
Thanks for handling this. I was terribly busy with internal stuff and had no time to check all my emails. Usually if one continues someone else patches, it is a good practice to somehow credit the original author in the final patch.
If changes are small, I usually keep the original authorship and only add note before my signoff (see commit 855ed04a3758b205e84b269f92d26ab36ed8e2f7 for the example). When the whole code has been rewritten, modified or heavily extended, I changed authorship and added respective note to the commit message (see commit e8d9d1f5485b52ec3c4d7af839e6914438f6c285 for such example). Feel free to use any of those styles.
Quoted 15 lines
Benjamin Gaignard (2):
drm: add generic zpos property
drm: sti: use generic zpos for planeDocumentation/DocBook/gpu.tmpl | 10 ++ drivers/gpu/drm/Makefile | 2 +- drivers/gpu/drm/drm_atomic.c | 4 + drivers/gpu/drm/drm_atomic_helper.c | 6 + drivers/gpu/drm/drm_blend.c | 242 ++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_crtc_internal.h | 3 + drivers/gpu/drm/sti/sti_mixer.c | 2 +- drivers/gpu/drm/sti/sti_plane.c | 82 +++++------- drivers/gpu/drm/sti/sti_plane.h | 2 - include/drm/drm_crtc.h | 17 +++ 10 files changed, 314 insertions(+), 56 deletions(-)
Quoted 2 lines
create mode 100644
drivers/gpu/drm/drm_blend.c
Best regards
Signature · 7 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Benjamin,
Quoted 12 lines · Benjamin Gaignard
The original patches have been done by Marek:
https://lists.freedesktop.org/archives/dri-devel/2016-January/099572.htmlI have just adapt them to make zpos depend on plane and no more on drm core.
Since zpos range can be define per plane normalize function takes care of the min and max before compute normalized zpos value.
Benjamin Gaignard (2):
drm: add generic zpos property
drm: sti: use generic zpos for plane
From a quick look it seems that you've updated the patches as opposed to rewriting them, correct ? If so shouldn't the authorship be preserved and a changelog added within the patch (before or after the --- line) ?
Thanks
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 12 lines · Emil Velikov
Hi Benjamin,
Quoted 8 lines · Benjamin Gaignard
The original patches have been done by Marek:
https://lists.freedesktop.org/archives/dri-devel/2016-January/099572.htmlI have just adapt them to make zpos depend on plane and no more on drm core.
Since zpos range can be define per plane normalize function takes care of the min and max before compute normalized zpos value.
Quoted 9 lines
Quoted 4 lines
Benjamin Gaignard (2):
drm: add generic zpos property
drm: sti: use generic zpos for planeFrom a quick look it seems that you've updated the patches as opposed to rewriting them, correct ? If so shouldn't the authorship be preserved and a changelog added within the patch (before or after the --- line) ?
The remainder of the thread just showed up in my inbox. Apologies for the noise.
-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel