Skip to content

Commit

Permalink
drm: sti: Add DRM driver itself
Browse files Browse the repository at this point in the history
Make the link between all the hardware drivers and DRM/KMS interface.
Create the driver itself and make it register all the sub-components.
Use GEM CMA helpers for buffer allocation.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Reviewed-by: Rob Clark <robdclark@gmail.com>
  • Loading branch information
Benjamin Gaignard committed Jul 31, 2014
1 parent d219673 commit 9bbf86f
Show file tree
Hide file tree
Showing 9 changed files with 985 additions and 3 deletions.
8 changes: 8 additions & 0 deletions drivers/gpu/drm/sti/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
config DRM_STI
tristate "DRM Support for STMicroelectronics SoC stiH41x Series"
depends on DRM && (SOC_STIH415 || SOC_STIH416 || ARCH_MULTIPLATFORM)
select DRM_KMS_HELPER
select DRM_GEM_CMA_HELPER
select DRM_KMS_CMA_HELPER
help
Choose this option to enable DRM on STM stiH41x chipset

config DRM_STI_FBDEV
bool "DRM frame buffer device for STMicroelectronics SoC stiH41x Serie"
depends on DRM_STI
help
Choose this option to enable FBDEV on top of DRM for STM stiH41x chipset
7 changes: 5 additions & 2 deletions drivers/gpu/drm/sti/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ sticompositor-y := \
sti_mixer.o \
sti_gdp.o \
sti_vid.o \
sti_compositor.o
sti_compositor.o \
sti_drm_crtc.o \
sti_drm_plane.o

stihdmi-y := sti_hdmi.o \
sti_hdmi_tx3g0c55phy.o \
Expand All @@ -15,4 +17,5 @@ obj-$(CONFIG_DRM_STI) = \
stihdmi.o \
sti_hda.o \
sti_tvout.o \
sticompositor.o
sticompositor.o \
sti_drm_drv.o
45 changes: 44 additions & 1 deletion drivers/gpu/drm/sti/sti_compositor.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#include <drm/drmP.h>

#include "sti_compositor.h"
#include "sti_drm_crtc.h"
#include "sti_drm_drv.h"
#include "sti_drm_plane.h"
#include "sti_gdp.h"
#include "sti_vtg.h"

Expand Down Expand Up @@ -87,12 +90,51 @@ static int sti_compositor_bind(struct device *dev, struct device *master,
struct sti_compositor *compo = dev_get_drvdata(dev);
struct drm_device *drm_dev = data;
unsigned int i, crtc = 0, plane = 0;
struct sti_drm_private *dev_priv = drm_dev->dev_private;
struct drm_plane *cursor = NULL;
struct drm_plane *primary = NULL;

dev_priv->compo = compo;

for (i = 0; i < compo->nb_layers; i++) {
if (compo->layer[i]) {
enum sti_layer_desc desc = compo->layer[i]->desc;
enum sti_layer_type type = desc & STI_LAYER_TYPE_MASK;
enum drm_plane_type plane_type = DRM_PLANE_TYPE_OVERLAY;

if (compo->mixer[crtc])
plane_type = DRM_PLANE_TYPE_PRIMARY;

switch (type) {
case STI_CUR:
cursor = sti_drm_plane_init(drm_dev,
compo->layer[i],
(1 << crtc) - 1,
DRM_PLANE_TYPE_CURSOR);
break;
case STI_GDP:
case STI_VID:
primary = sti_drm_plane_init(drm_dev,
compo->layer[i],
(1 << crtc) - 1, plane_type);
plane++;
break;
}

/* The first planes are reserved for primary planes*/
if (compo->mixer[crtc]) {
sti_drm_crtc_init(drm_dev, compo->mixer[crtc],
primary, cursor);
crtc++;
cursor = NULL;
}
}
}

drm_vblank_init(drm_dev, crtc);
/* Allow usage of vblank without having to call drm_irq_install */
drm_dev->irq_enabled = 1;


DRM_DEBUG_DRIVER("Initialized %d DRM CRTC(s) and %d DRM plane(s)\n",
crtc, plane);
DRM_DEBUG_DRIVER("DRM plane(s) for VID/VDP not created yet\n");
Expand Down Expand Up @@ -139,6 +181,7 @@ static int sti_compositor_probe(struct platform_device *pdev)
return -ENOMEM;
}
compo->dev = dev;
compo->vtg_vblank_nb.notifier_call = sti_drm_crtc_vblank_cb;

/* populate data structure depending on compatibility */
BUG_ON(!of_match_node(compositor_of_match, np)->data);
Expand Down
Loading

0 comments on commit 9bbf86f

Please sign in to comment.