Commit c11b8989 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'omapdrm-4.5-resolved' of...

Merge tag 'omapdrm-4.5-resolved' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux into drm-next

omapdrm changes for v4.5

* enable DRIVER_ATOMIC
* improved TILER performance
* cleanups preparing for DMAbuf import
* fbdev emulation is now optional
* minor fixes

* tag 'omapdrm-4.5-resolved' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux:
  drm/omap: remove obsolete manager assignment
  drm/omap: set DRIVER_ATOMIC for omapdrm
  drm/omap: remove unused plugin defines
  drm/omap: Use bitmaps for TILER placement
  drm: omapdrm: gem: Remove check for impossible condition
  drm: omapdrm: gem: Simplify error handling when creating GEM object
  drm: omapdrm: gem: Don't free mmap offset twice
  drm: omapdrm: gem: Fix GEM object destroy in error path
  drm: omapdrm: gem: Free the correct memory object
  drm: omapdrm: gem: Mask out private flags passed from userspace
  drm: omapdrm: gem: Move global usergart variable to omap_drm_private
  drm: omapdrm: gem: Group functions by purpose
  drm: omapdrm: gem: Remove forward declarations
  drm: omapdrm: gem: Remove unused function prototypes
  drm: omapdrm: Make fbdev emulation optional
  drm: omapdrm: Fix plane state free in plane reset handler
  drm: omapdrm: move omap_plane_reset()
  drm/omap: Use platform_register/unregister_drivers()
  drm: omapdrm: tiler: Remove unneded module alias for tiler
parents 54255e81 9c8e566e
...@@ -12,10 +12,11 @@ omapdrm-y := omap_drv.o \ ...@@ -12,10 +12,11 @@ omapdrm-y := omap_drv.o \
omap_encoder.o \ omap_encoder.o \
omap_connector.o \ omap_connector.o \
omap_fb.o \ omap_fb.o \
omap_fbdev.o \
omap_gem.o \ omap_gem.o \
omap_gem_dmabuf.o \ omap_gem_dmabuf.o \
omap_dmm_tiler.o \ omap_dmm_tiler.o \
tcm-sita.o tcm-sita.o
omapdrm-$(CONFIG_DRM_FBDEV_EMULATION) += omap_fbdev.o
obj-$(CONFIG_DRM_OMAP) += omapdrm.o obj-$(CONFIG_DRM_OMAP) += omapdrm.o
...@@ -51,6 +51,7 @@ static int mm_show(struct seq_file *m, void *arg) ...@@ -51,6 +51,7 @@ static int mm_show(struct seq_file *m, void *arg)
return drm_mm_dump_table(m, &dev->vma_offset_manager->vm_addr_space_mm); return drm_mm_dump_table(m, &dev->vma_offset_manager->vm_addr_space_mm);
} }
#ifdef CONFIG_DRM_FBDEV_EMULATION
static int fb_show(struct seq_file *m, void *arg) static int fb_show(struct seq_file *m, void *arg)
{ {
struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_info_node *node = (struct drm_info_node *) m->private;
...@@ -73,12 +74,15 @@ static int fb_show(struct seq_file *m, void *arg) ...@@ -73,12 +74,15 @@ static int fb_show(struct seq_file *m, void *arg)
return 0; return 0;
} }
#endif
/* list of debufs files that are applicable to all devices */ /* list of debufs files that are applicable to all devices */
static struct drm_info_list omap_debugfs_list[] = { static struct drm_info_list omap_debugfs_list[] = {
{"gem", gem_show, 0}, {"gem", gem_show, 0},
{"mm", mm_show, 0}, {"mm", mm_show, 0},
#ifdef CONFIG_DRM_FBDEV_EMULATION
{"fb", fb_show, 0}, {"fb", fb_show, 0},
#endif
}; };
/* list of debugfs files that are specific to devices with dmm/tiler */ /* list of debugfs files that are specific to devices with dmm/tiler */
......
...@@ -363,6 +363,7 @@ struct tiler_block *tiler_reserve_2d(enum tiler_fmt fmt, uint16_t w, ...@@ -363,6 +363,7 @@ struct tiler_block *tiler_reserve_2d(enum tiler_fmt fmt, uint16_t w,
u32 min_align = 128; u32 min_align = 128;
int ret; int ret;
unsigned long flags; unsigned long flags;
size_t slot_bytes;
BUG_ON(!validfmt(fmt)); BUG_ON(!validfmt(fmt));
...@@ -371,13 +372,15 @@ struct tiler_block *tiler_reserve_2d(enum tiler_fmt fmt, uint16_t w, ...@@ -371,13 +372,15 @@ struct tiler_block *tiler_reserve_2d(enum tiler_fmt fmt, uint16_t w,
h = DIV_ROUND_UP(h, geom[fmt].slot_h); h = DIV_ROUND_UP(h, geom[fmt].slot_h);
/* convert alignment to slots */ /* convert alignment to slots */
min_align = max(min_align, (geom[fmt].slot_w * geom[fmt].cpp)); slot_bytes = geom[fmt].slot_w * geom[fmt].cpp;
align = ALIGN(align, min_align); min_align = max(min_align, slot_bytes);
align /= geom[fmt].slot_w * geom[fmt].cpp; align = (align > min_align) ? ALIGN(align, min_align) : min_align;
align /= slot_bytes;
block->fmt = fmt; block->fmt = fmt;
ret = tcm_reserve_2d(containers[fmt], w, h, align, &block->area); ret = tcm_reserve_2d(containers[fmt], w, h, align, -1, slot_bytes,
&block->area);
if (ret) { if (ret) {
kfree(block); kfree(block);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -739,8 +742,7 @@ static int omap_dmm_probe(struct platform_device *dev) ...@@ -739,8 +742,7 @@ static int omap_dmm_probe(struct platform_device *dev)
programming during reill operations */ programming during reill operations */
for (i = 0; i < omap_dmm->num_lut; i++) { for (i = 0; i < omap_dmm->num_lut; i++) {
omap_dmm->tcm[i] = sita_init(omap_dmm->container_width, omap_dmm->tcm[i] = sita_init(omap_dmm->container_width,
omap_dmm->container_height, omap_dmm->container_height);
NULL);
if (!omap_dmm->tcm[i]) { if (!omap_dmm->tcm[i]) {
dev_err(&dev->dev, "failed to allocate container\n"); dev_err(&dev->dev, "failed to allocate container\n");
...@@ -1030,4 +1032,3 @@ struct platform_driver omap_dmm_driver = { ...@@ -1030,4 +1032,3 @@ struct platform_driver omap_dmm_driver = {
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Andy Gross <andy.gross@ti.com>"); MODULE_AUTHOR("Andy Gross <andy.gross@ti.com>");
MODULE_DESCRIPTION("OMAP DMM/Tiler Driver"); MODULE_DESCRIPTION("OMAP DMM/Tiler Driver");
MODULE_ALIAS("platform:" DMM_DRIVER_NAME);
...@@ -547,14 +547,19 @@ static int ioctl_set_param(struct drm_device *dev, void *data, ...@@ -547,14 +547,19 @@ static int ioctl_set_param(struct drm_device *dev, void *data,
return 0; return 0;
} }
#define OMAP_BO_USER_MASK 0x00ffffff /* flags settable by userspace */
static int ioctl_gem_new(struct drm_device *dev, void *data, static int ioctl_gem_new(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_omap_gem_new *args = data; struct drm_omap_gem_new *args = data;
u32 flags = args->flags & OMAP_BO_USER_MASK;
VERB("%p:%p: size=0x%08x, flags=%08x", dev, file_priv, VERB("%p:%p: size=0x%08x, flags=%08x", dev, file_priv,
args->size.bytes, args->flags); args->size.bytes, flags);
return omap_gem_new_handle(dev, file_priv, args->size,
args->flags, &args->handle); return omap_gem_new_handle(dev, file_priv, args->size, flags,
&args->handle);
} }
static int ioctl_gem_cpu_prep(struct drm_device *dev, void *data, static int ioctl_gem_cpu_prep(struct drm_device *dev, void *data,
...@@ -692,10 +697,6 @@ static int dev_load(struct drm_device *dev, unsigned long flags) ...@@ -692,10 +697,6 @@ static int dev_load(struct drm_device *dev, unsigned long flags)
drm_crtc_vblank_off(priv->crtcs[i]); drm_crtc_vblank_off(priv->crtcs[i]);
priv->fbdev = omap_fbdev_init(dev); priv->fbdev = omap_fbdev_init(dev);
if (!priv->fbdev) {
dev_warn(dev->dev, "omap_fbdev_init failed\n");
/* well, limp along without an fbdev.. maybe X11 will work? */
}
/* store off drm_device for use in pm ops */ /* store off drm_device for use in pm ops */
dev_set_drvdata(dev->dev, dev); dev_set_drvdata(dev->dev, dev);
...@@ -831,7 +832,8 @@ static const struct file_operations omapdriver_fops = { ...@@ -831,7 +832,8 @@ static const struct file_operations omapdriver_fops = {
}; };
static struct drm_driver omap_drm_driver = { static struct drm_driver omap_drm_driver = {
.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME, .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
DRIVER_ATOMIC,
.load = dev_load, .load = dev_load,
.unload = dev_unload, .unload = dev_unload,
.open = dev_open, .open = dev_open,
...@@ -928,35 +930,23 @@ static struct platform_driver pdev = { ...@@ -928,35 +930,23 @@ static struct platform_driver pdev = {
.remove = pdev_remove, .remove = pdev_remove,
}; };
static struct platform_driver * const drivers[] = {
&omap_dmm_driver,
&pdev,
};
static int __init omap_drm_init(void) static int __init omap_drm_init(void)
{ {
int r;
DBG("init"); DBG("init");
r = platform_driver_register(&omap_dmm_driver); return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
if (r) {
pr_err("DMM driver registration failed\n");
return r;
}
r = platform_driver_register(&pdev);
if (r) {
pr_err("omapdrm driver registration failed\n");
platform_driver_unregister(&omap_dmm_driver);
return r;
}
return 0;
} }
static void __exit omap_drm_fini(void) static void __exit omap_drm_fini(void)
{ {
DBG("fini"); DBG("fini");
platform_driver_unregister(&pdev); platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
platform_driver_unregister(&omap_dmm_driver);
} }
/* need late_initcall() so we load after dss_driver's are loaded */ /* need late_initcall() so we load after dss_driver's are loaded */
......
...@@ -36,11 +36,7 @@ ...@@ -36,11 +36,7 @@
#define MODULE_NAME "omapdrm" #define MODULE_NAME "omapdrm"
/* max # of mapper-id's that can be assigned.. todo, come up with a better struct omap_drm_usergart;
* (but still inexpensive) way to store/access per-buffer mapper private
* data..
*/
#define MAX_MAPPERS 2
/* parameters which describe (unrotated) coordinates of scanout within a fb: */ /* parameters which describe (unrotated) coordinates of scanout within a fb: */
struct omap_drm_window { struct omap_drm_window {
...@@ -97,6 +93,7 @@ struct omap_drm_private { ...@@ -97,6 +93,7 @@ struct omap_drm_private {
/* list of GEM objects: */ /* list of GEM objects: */
struct list_head obj_list; struct list_head obj_list;
struct omap_drm_usergart *usergart;
bool has_dmm; bool has_dmm;
/* properties: */ /* properties: */
...@@ -138,8 +135,18 @@ void omap_irq_unregister(struct drm_device *dev, struct omap_drm_irq *irq); ...@@ -138,8 +135,18 @@ void omap_irq_unregister(struct drm_device *dev, struct omap_drm_irq *irq);
void omap_drm_irq_uninstall(struct drm_device *dev); void omap_drm_irq_uninstall(struct drm_device *dev);
int omap_drm_irq_install(struct drm_device *dev); int omap_drm_irq_install(struct drm_device *dev);
#ifdef CONFIG_DRM_FBDEV_EMULATION
struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev); struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev);
void omap_fbdev_free(struct drm_device *dev); void omap_fbdev_free(struct drm_device *dev);
#else
static inline struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev)
{
return NULL;
}
static inline void omap_fbdev_free(struct drm_device *dev)
{
}
#endif
struct omap_video_timings *omap_crtc_timings(struct drm_crtc *crtc); struct omap_video_timings *omap_crtc_timings(struct drm_crtc *crtc);
enum omap_channel omap_crtc_channel(struct drm_crtc *crtc); enum omap_channel omap_crtc_channel(struct drm_crtc *crtc);
......
...@@ -110,8 +110,6 @@ static int omap_encoder_update(struct drm_encoder *encoder, ...@@ -110,8 +110,6 @@ static int omap_encoder_update(struct drm_encoder *encoder,
struct omap_dss_driver *dssdrv = dssdev->driver; struct omap_dss_driver *dssdrv = dssdev->driver;
int ret; int ret;
dssdev->src->manager = omap_dss_get_overlay_manager(channel);
if (dssdrv->check_timings) { if (dssdrv->check_timings) {
ret = dssdrv->check_timings(dssdev, timings); ret = dssdrv->check_timings(dssdev, timings);
} else { } else {
......
...@@ -295,6 +295,10 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev) ...@@ -295,6 +295,10 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev)
drm_fb_helper_fini(helper); drm_fb_helper_fini(helper);
fail: fail:
kfree(fbdev); kfree(fbdev);
dev_warn(dev->dev, "omap_fbdev_init failed\n");
/* well, limp along without an fbdev.. maybe X11 will work? */
return NULL; return NULL;
} }
......
This diff is collapsed.
...@@ -188,33 +188,6 @@ static const struct drm_plane_helper_funcs omap_plane_helper_funcs = { ...@@ -188,33 +188,6 @@ static const struct drm_plane_helper_funcs omap_plane_helper_funcs = {
.atomic_disable = omap_plane_atomic_disable, .atomic_disable = omap_plane_atomic_disable,
}; };
static void omap_plane_reset(struct drm_plane *plane)
{
struct omap_plane *omap_plane = to_omap_plane(plane);
struct omap_plane_state *omap_state;
if (plane->state && plane->state->fb)
drm_framebuffer_unreference(plane->state->fb);
kfree(plane->state);
plane->state = NULL;
omap_state = kzalloc(sizeof(*omap_state), GFP_KERNEL);
if (omap_state == NULL)
return;
/*
* Set defaults depending on whether we are a primary or overlay
* plane.
*/
omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
? 0 : omap_plane->id;
omap_state->base.rotation = BIT(DRM_ROTATE_0);
plane->state = &omap_state->base;
plane->state->plane = plane;
}
static void omap_plane_destroy(struct drm_plane *plane) static void omap_plane_destroy(struct drm_plane *plane)
{ {
struct omap_plane *omap_plane = to_omap_plane(plane); struct omap_plane *omap_plane = to_omap_plane(plane);
...@@ -270,6 +243,32 @@ static void omap_plane_atomic_destroy_state(struct drm_plane *plane, ...@@ -270,6 +243,32 @@ static void omap_plane_atomic_destroy_state(struct drm_plane *plane,
kfree(to_omap_plane_state(state)); kfree(to_omap_plane_state(state));
} }
static void omap_plane_reset(struct drm_plane *plane)
{
struct omap_plane *omap_plane = to_omap_plane(plane);
struct omap_plane_state *omap_state;
if (plane->state) {
omap_plane_atomic_destroy_state(plane, plane->state);
plane->state = NULL;
}
omap_state = kzalloc(sizeof(*omap_state), GFP_KERNEL);
if (omap_state == NULL)
return;
/*
* Set defaults depending on whether we are a primary or overlay
* plane.
*/
omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
? 0 : omap_plane->id;
omap_state->base.rotation = BIT(DRM_ROTATE_0);
plane->state = &omap_state->base;
plane->state->plane = plane;
}
static int omap_plane_atomic_set_property(struct drm_plane *plane, static int omap_plane_atomic_set_property(struct drm_plane *plane,
struct drm_plane_state *state, struct drm_plane_state *state,
struct drm_property *property, struct drm_property *property,
......
This diff is collapsed.
...@@ -61,18 +61,17 @@ struct tcm { ...@@ -61,18 +61,17 @@ struct tcm {
unsigned int y_offset; /* offset to use for y coordinates */ unsigned int y_offset; /* offset to use for y coordinates */
/* 'pvt' structure shall contain any tcm details (attr) along with spinlock_t lock;
linked list of allocated areas and mutex for mutually exclusive access unsigned long *bitmap;
to the list. It may also contain copies of width and height to notice size_t map_size;
any changes to the publicly available width and height fields. */
void *pvt;
/* function table */ /* function table */
s32 (*reserve_2d)(struct tcm *tcm, u16 height, u16 width, u8 align, s32 (*reserve_2d)(struct tcm *tcm, u16 height, u16 width, u16 align,
int16_t offset, uint16_t slot_bytes,
struct tcm_area *area); struct tcm_area *area);
s32 (*reserve_1d)(struct tcm *tcm, u32 slots, struct tcm_area *area); s32 (*reserve_1d)(struct tcm *tcm, u32 slots, struct tcm_area *area);
s32 (*free) (struct tcm *tcm, struct tcm_area *area); s32 (*free)(struct tcm *tcm, struct tcm_area *area);
void (*deinit) (struct tcm *tcm); void (*deinit)(struct tcm *tcm);
}; };
/*============================================================================= /*=============================================================================
...@@ -91,7 +90,7 @@ struct tcm { ...@@ -91,7 +90,7 @@ struct tcm {
* *
*/ */
struct tcm *sita_init(u16 width, u16 height, struct tcm_pt *attr); struct tcm *sita_init(u16 width, u16 height);
/** /**
...@@ -120,6 +119,9 @@ static inline void tcm_deinit(struct tcm *tcm) ...@@ -120,6 +119,9 @@ static inline void tcm_deinit(struct tcm *tcm)
* all values may be supported by the container manager, * all values may be supported by the container manager,
* but it must support 0 (1), 32 and 64. * but it must support 0 (1), 32 and 64.
* 0 value is equivalent to 1. * 0 value is equivalent to 1.
* @param offset Offset requirement, in bytes. This is the offset
* from a 4KiB aligned virtual address.
* @param slot_bytes Width of slot in bytes
* @param area Pointer to where the reserved area should be stored. * @param area Pointer to where the reserved area should be stored.
* *
* @return 0 on success. Non-0 error code on failure. Also, * @return 0 on success. Non-0 error code on failure. Also,
...@@ -129,7 +131,8 @@ static inline void tcm_deinit(struct tcm *tcm) ...@@ -129,7 +131,8 @@ static inline void tcm_deinit(struct tcm *tcm)
* allocation. * allocation.
*/ */
static inline s32 tcm_reserve_2d(struct tcm *tcm, u16 width, u16 height, static inline s32 tcm_reserve_2d(struct tcm *tcm, u16 width, u16 height,
u16 align, struct tcm_area *area) u16 align, int16_t offset, uint16_t slot_bytes,
struct tcm_area *area)
{ {
/* perform rudimentary error checking */ /* perform rudimentary error checking */
s32 res = tcm == NULL ? -ENODEV : s32 res = tcm == NULL ? -ENODEV :
...@@ -140,7 +143,8 @@ static inline s32 tcm_reserve_2d(struct tcm *tcm, u16 width, u16 height, ...@@ -140,7 +143,8 @@ static inline s32 tcm_reserve_2d(struct tcm *tcm, u16 width, u16 height,
if (!res) { if (!res) {
area->is2d = true; area->is2d = true;
res = tcm->reserve_2d(tcm, height, width, align, area); res = tcm->reserve_2d(tcm, height, width, align, offset,
slot_bytes, area);
area->tcm = res ? NULL : tcm; area->tcm = res ? NULL : tcm;
} }
......
...@@ -101,9 +101,6 @@ struct drm_omap_gem_info { ...@@ -101,9 +101,6 @@ struct drm_omap_gem_info {
#define DRM_OMAP_GET_PARAM 0x00 #define DRM_OMAP_GET_PARAM 0x00
#define DRM_OMAP_SET_PARAM 0x01 #define DRM_OMAP_SET_PARAM 0x01
/* placeholder for plugin-api
#define DRM_OMAP_GET_BASE 0x02
*/
#define DRM_OMAP_GEM_NEW 0x03 #define DRM_OMAP_GEM_NEW 0x03
#define DRM_OMAP_GEM_CPU_PREP 0x04 #define DRM_OMAP_GEM_CPU_PREP 0x04
#define DRM_OMAP_GEM_CPU_FINI 0x05 #define DRM_OMAP_GEM_CPU_FINI 0x05
...@@ -112,9 +109,6 @@ struct drm_omap_gem_info { ...@@ -112,9 +109,6 @@ struct drm_omap_gem_info {
#define DRM_IOCTL_OMAP_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GET_PARAM, struct drm_omap_param) #define DRM_IOCTL_OMAP_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GET_PARAM, struct drm_omap_param)
#define DRM_IOCTL_OMAP_SET_PARAM DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_SET_PARAM, struct drm_omap_param) #define DRM_IOCTL_OMAP_SET_PARAM DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_SET_PARAM, struct drm_omap_param)
/* placeholder for plugin-api
#define DRM_IOCTL_OMAP_GET_BASE DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GET_BASE, struct drm_omap_get_base)
*/
#define DRM_IOCTL_OMAP_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_NEW, struct drm_omap_gem_new) #define DRM_IOCTL_OMAP_GEM_NEW DRM_IOWR(DRM_COMMAND_BASE + DRM_OMAP_GEM_NEW, struct drm_omap_gem_new)
#define DRM_IOCTL_OMAP_GEM_CPU_PREP DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_PREP, struct drm_omap_gem_cpu_prep) #define DRM_IOCTL_OMAP_GEM_CPU_PREP DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_PREP, struct drm_omap_gem_cpu_prep)
#define DRM_IOCTL_OMAP_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_FINI, struct drm_omap_gem_cpu_fini) #define DRM_IOCTL_OMAP_GEM_CPU_FINI DRM_IOW (DRM_COMMAND_BASE + DRM_OMAP_GEM_CPU_FINI, struct drm_omap_gem_cpu_fini)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment