Skip to content

Commit

Permalink
drm/exynos: added possible_clones setup function.
Browse files Browse the repository at this point in the history
basically, all crtcs are possible to clone each other.

Signed-off-by: Inki Dae <[email protected]>
Signed-off-by: Kyungmin Park <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
  • Loading branch information
daeinki authored and airlied committed Feb 16, 2012
1 parent 6f81150 commit d081f56
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/gpu/drm/exynos/exynos_drm_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ int exynos_drm_subdrv_register(struct exynos_drm_subdrv *subdrv)
return err;
}

/* setup possible_clones. */
exynos_drm_encoder_setup(drm_dev);

/*
* if any specific driver such as fimd or hdmi driver called
* exynos_drm_subdrv_register() later than drm_load(),
Expand Down
4 changes: 4 additions & 0 deletions drivers/gpu/drm/exynos/exynos_drm_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include "exynos_drm_drv.h"
#include "exynos_drm_crtc.h"
#include "exynos_drm_encoder.h"
#include "exynos_drm_fbdev.h"
#include "exynos_drm_fb.h"
#include "exynos_drm_gem.h"
Expand Down Expand Up @@ -99,6 +100,9 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
if (ret)
goto err_vblank;

/* setup possible_clones. */
exynos_drm_encoder_setup(dev);

/*
* create and configure fb helper and also exynos specific
* fbdev object.
Expand Down
34 changes: 34 additions & 0 deletions drivers/gpu/drm/exynos/exynos_drm_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,40 @@ static struct drm_encoder_funcs exynos_encoder_funcs = {
.destroy = exynos_drm_encoder_destroy,
};

static unsigned int exynos_drm_encoder_clones(struct drm_encoder *encoder)
{
struct drm_encoder *clone;
struct drm_device *dev = encoder->dev;
struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
struct exynos_drm_display_ops *display_ops =
exynos_encoder->manager->display_ops;
unsigned int clone_mask = 0;
int cnt = 0;

list_for_each_entry(clone, &dev->mode_config.encoder_list, head) {
switch (display_ops->type) {
case EXYNOS_DISPLAY_TYPE_LCD:
case EXYNOS_DISPLAY_TYPE_HDMI:
clone_mask |= (1 << (cnt++));
break;
default:
continue;
}
}

return clone_mask;
}

void exynos_drm_encoder_setup(struct drm_device *dev)
{
struct drm_encoder *encoder;

DRM_DEBUG_KMS("%s\n", __FILE__);

list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
encoder->possible_clones = exynos_drm_encoder_clones(encoder);
}

struct drm_encoder *
exynos_drm_encoder_create(struct drm_device *dev,
struct exynos_drm_manager *manager,
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/exynos/exynos_drm_encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

struct exynos_drm_manager;

void exynos_drm_encoder_setup(struct drm_device *dev);
struct drm_encoder *exynos_drm_encoder_create(struct drm_device *dev,
struct exynos_drm_manager *mgr,
unsigned int possible_crtcs);
Expand Down

0 comments on commit d081f56

Please sign in to comment.