drm/omap: updates for addfb2 and plane support
cover drm/omap: updates for addfb2 and plane support
From: Rob Clark <[email protected]>
The first patch updates omapdrm for API changes introduced when addfb2 support (for multi-planar fb's) was added (in drm-next). The next patch adds drm plane (overlay) support, with CRTCs using private plane objects to avoid code duplication between the CRTC and plane. (This depends on the "drm: add support for private planes" patch.) The final patch adds support for YUV and multi-planar YUV formats.
This updated patch set rebases on drm-next as of today, and makes a small correction for a mistake in the color formats table which Ville Syrjälä pointed out. These patches replace the last patchset sent on 20 Dec 2011. I think pretty much everything that will change in drm-next should be in now so I think this should be the last rebase and should be fine to pull to staging tree when drm-next is pulled to Linus's tree.
Rob Clark (3):
drm/omap: drm API update: addfb2
drm/omap: add drm_plane support
drm/omap: multiplanar and YUV support
drivers/staging/omapdrm/Makefile | 1 + drivers/staging/omapdrm/omap_crtc.c | 191 +++++--------------- drivers/staging/omapdrm/omap_drv.c | 53 ++++-- drivers/staging/omapdrm/omap_drv.h | 46 ++++- drivers/staging/omapdrm/omap_fb.c | 224 +++++++++++++++++------ drivers/staging/omapdrm/omap_fbdev.c | 55 ++++-- drivers/staging/omapdrm/omap_gem.c | 5 + drivers/staging/omapdrm/omap_plane.c | 329 ++++++++++++++++++++++++++++++++++ drivers/staging/omapdrm/omap_priv.h | 12 +- 9 files changed, 665 insertions(+), 251 deletions(-) create mode 100644 drivers/staging/omapdrm/omap_plane.c
Signature · 1 line
1.7.5.4
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/3 drm/omap: drm API update: addfb2
From: Rob Clark <[email protected]>
Update to reflect changes in:
"drm: add an fb creation ioctl that takes a pixel format v5"
--- drivers/staging/omapdrm/omap_drv.h | 30 +++++++++- drivers/staging/omapdrm/omap_fb.c | 103 ++++++++++++++++++++++++++-------- drivers/staging/omapdrm/omap_fbdev.c | 55 ++++++++++++------- 3 files changed, 143 insertions(+), 45 deletions(-)
drivers/staging/omapdrm/omap_drv.h +28 -2
@@ -24,6 +24,7 @@#include <linux/module.h> #include <linux/types.h> #include <drm/drmP.h> +#include <drm/drm_crtc_helper.h> #include "omap_drm.h" #include "omap_priv.h"
@@ -80,9 +81,9 @@ void omap_connector_flush(struct drm_connector *connector, int x, int y, int w, int h);struct drm_framebuffer *omap_framebuffer_create (struct drm_device *dev, -struct drm_file *file,struct drm_mode_fb_cmd *mode_cmd); +struct drm_file *file,struct drm_mode_fb_cmd2 *mode_cmd);struct drm_framebuffer *omap_framebuffer_init (struct drm_device *dev, -struct drm_mode_fb_cmd *mode_cmd,struct drm_gem_object *bo); +struct drm_mode_fb_cmd2 *mode_cmd,struct drm_gem_object **bos);struct drm_gem_object *omap_framebuffer_bo (struct drm_framebuffer *fb);int omap_framebuffer_get_buffer (struct drm_framebuffer *fb,int x,int y,void **vaddr,dma_addr_t *paddr,unsigned int *screen_width);
@@ -132,4 +133,29 @@ static inline int align_pitch(int pitch, int width, int bpp) return ALIGN(pitch, 8 * bytespp); } +/* should these be made into common util helpers? +*/ + +static inline int objects_lookup (struct drm_device *dev, +struct drm_file *filp,uint32_t pixel_format, +struct drm_gem_object **bos,uint32_t *handles) +{ +int i, n =drm_format_num_planes (pixel_format); + +for (i =0 ; i < n; i++) { + bos[i] =drm_gem_object_lookup (dev, filp, handles[i]); +if (!bos[i]) { + goto fail; + } + } + +return 0 ; + +fail: +while (--i >0 ) { +drm_gem_object_unreference_unlocked (bos[i]); + } +return -ENOENT ; +} +#endif /* __OMAP_DRV_H__ */
drivers/staging/omapdrm/omap_fb.c +80 -23
172 lines not on this page · raw message
drivers/staging/omapdrm/omap_fbdev.c +35 -20
99 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH 2/3 drm/omap: add drm_plane support
In reply to Rob ClarkFrom: Rob Clark <[email protected]>
Because framebuffer layer and overlay scanout video pipes are basically thing in OMAP display subsystem (the only difference being that the first video pipe does not support scaling or YUV formats), much of the CRTC code is pulled into the plane implementation, and a private plane object is used by the CRTC object. This avoids code duplication between the plane and CRTC.
--- drivers/staging/omapdrm/Makefile | 1 + drivers/staging/omapdrm/omap_crtc.c | 189 +++++---------------- drivers/staging/omapdrm/omap_drv.c | 53 ++++--- drivers/staging/omapdrm/omap_drv.h | 8 +- drivers/staging/omapdrm/omap_plane.c | 308 ++++++++++++++++++++++++++++++++++ drivers/staging/omapdrm/omap_priv.h | 12 +- 6 files changed, 403 insertions(+), 168 deletions(-) create mode 100644 drivers/staging/omapdrm/omap_plane.c
drivers/staging/omapdrm/Makefile +1 -0
@@ -7,6 +7,7 @@ ccflags-y := -Iinclude/drm -Werror omapdrm-y := omap_drv.o \ omap_debugfs.o \ omap_crtc.o \ + omap_plane.o \ omap_encoder.o \ omap_connector.o \ omap_fb.o \
drivers/staging/omapdrm/omap_crtc.c +44 -145
284 lines not on this page · raw message
drivers/staging/omapdrm/omap_drv.c +33 -20
89 lines not on this page · raw message
drivers/staging/omapdrm/omap_drv.h +7 -1
@@ -42,6 +42,8 @@struct omap_drm_private {unsigned int num_crtcs;struct drm_crtc *crtcs[8 ]; +unsigned int num_planes; +struct drm_plane *planes[8 ];unsigned int num_encoders;struct drm_encoder *encoders[8 ];unsigned int num_connectors;
@@ -62,7 +64,11 @@ void omap_fbdev_free(struct drm_device *dev);struct drm_crtc *omap_crtc_init (struct drm_device *dev,struct omap_overlay *ovl,int id); -struct omap_overlay *omap_crtc_get_overlay (struct drm_crtc *crtc); + +struct drm_plane *omap_plane_init (struct drm_device *dev, +struct omap_overlay *ovl,unsigned int possible_crtcs, +bool priv); +int omap_plane_dpms (struct drm_plane *plane,int mode);struct drm_encoder *omap_encoder_init (struct drm_device *dev,struct omap_overlay_manager *mgr);
drivers/staging/omapdrm/omap_plane.c new file +308 -0
308 lines not on this page · raw message
drivers/staging/omapdrm/omap_priv.h +10 -2
@@ -27,14 +27,22 @@* pipes/overlays/CRTCs are used.. if this is not provided, then instead the * first CONFIG_DRM_OMAP_NUM_CRTCS are used, and they are each connected to * one manager, with priority given to managers that are connected to -* detected devices. This should be a good default behavior for most cases, -* but yet there still might be times when you wish to do something different. +* detected devices. Remaining overlays are used as video planes. This +* should be a good default behavior for most cases, but yet there still +* might be times when you wish to do something different. */ struct omap_kms_platform_data { +/* overlays to use as CRTCs: */ int ovl_cnt;const int *ovl_ids; + +/* overlays to use as video planes: */ +int pln_cnt; +const int *pln_ids; +int mgr_cnt;const int *mgr_ids; +int dev_cnt;const char **dev_names; };
Signature · 1 line
1.7.5.4
PATCH 3/3 drm/omap: multiplanar and YUV support
In reply to Rob ClarkFrom: Rob Clark <[email protected]>
Add support in framebuffer objects for other color formats and multi- planar YUV (NV12). Since this requires changing the API between the plane and fb for getting scanout information (paddr, etc), take advantage of the opportunity and put in place a way to allow fb's to be unpinned when they are not being scanned out. Now, before start of scanout the plane calls omap_framebuffer_pin() which takes care to pin all the backing bo's, then omap_framebuffer_update_scanout() however many times to update the scanout address(es), etc, and then when finished omap_framebuffer_unpin().
--- drivers/staging/omapdrm/omap_crtc.c | 2 +- drivers/staging/omapdrm/omap_drv.h | 8 +- drivers/staging/omapdrm/omap_fb.c | 149 +++++++++++++++++++++++----------- drivers/staging/omapdrm/omap_gem.c | 5 + drivers/staging/omapdrm/omap_plane.c | 53 +++++++++---- 5 files changed, 149 insertions(+), 68 deletions(-)
drivers/staging/omapdrm/omap_crtc.c +1 -1
@@ -168,7 +168,7 @@ static int omap_crtc_page_flip_locked(struct drm_crtc *crtc, omap_crtc->event = event; crtc->fb = fb; -omap_gem_op_async (omap_framebuffer_bo (fb),OMAP_GEM_READ , +omap_gem_op_async (omap_framebuffer_bo (fb,0 ),OMAP_GEM_READ , page_flip_cb, crtc);return 0 ;
drivers/staging/omapdrm/omap_drv.h +5 -3
@@ -90,9 +90,11 @@ struct drm_framebuffer *omap_framebuffer_create(struct drm_device *dev, struct drm_file *file, struct drm_mode_fb_cmd2 *mode_cmd);struct drm_framebuffer *omap_framebuffer_init (struct drm_device *dev,struct drm_mode_fb_cmd2 *mode_cmd,struct drm_gem_object **bos); -struct drm_gem_object *omap_framebuffer_bo (struct drm_framebuffer *fb); -int omap_framebuffer_get_buffer (struct drm_framebuffer *fb,int x,int y, -void **vaddr,dma_addr_t *paddr,unsigned int *screen_width); +struct drm_gem_object *omap_framebuffer_bo (struct drm_framebuffer *fb,int p); +int omap_framebuffer_pin (struct drm_framebuffer *fb); +void omap_framebuffer_unpin (struct drm_framebuffer *fb); +void omap_framebuffer_update_scanout (struct drm_framebuffer *fb,int x,int y, +struct omap_overlay_info *info);struct drm_connector *omap_framebuffer_get_next_connector (struct drm_framebuffer *fb,struct drm_connector *from); void omap_framebuffer_flush(struct drm_framebuffer *fb,
drivers/staging/omapdrm/omap_fb.c +101 -48
212 lines not on this page · raw message
drivers/staging/omapdrm/omap_gem.c +5 -0
@@ -1034,6 +1034,11 @@ void omap_gem_free_object(struct drm_gem_object *obj)drm_gem_free_mmap_offset (obj); } +/* this means the object is still pinned.. which really should +* not happen. I think.. +*/ +WARN_ON (omap_obj->paddr_cnt >0 ); +/* don't free externally allocated backing memory */ if (!(omap_obj->flags &OMAP_BO_EXT_MEM )) {if (omap_obj->pages) {
drivers/staging/omapdrm/omap_plane.c +37 -16
92 lines not on this page · raw message
Signature · 1 line
1.7.5.4