Hi Noralf.
On Sun, Jan 20, 2019 at 12:43:10PM +0100, Noralf Trønnes wrote:
> This adds a function that creates a simple connector that has only one
> static mode. Additionally add a helper to set &drm_mode_config width
> and height from the static mode.
>
> Signed-off-by: Noralf Trønnes <[email protected]>
> ---
> drivers/gpu/drm/drm_simple_kms_helper.c | 122 ++++++++++++++++++++++++
> include/drm/drm_simple_kms_helper.h | 6 ++
> 2 files changed, 128 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c
> b/drivers/gpu/drm/drm_simple_kms_helper.c
> index 917812448d1b..ca29975afefe 100644
> --- a/drivers/gpu/drm/drm_simple_kms_helper.c
> +++ b/drivers/gpu/drm/drm_simple_kms_helper.c
> @@ -11,6 +11,8 @@
> #include <drm/drm_atomic.h>
> #include <drm/drm_atomic_helper.h>
> #include <drm/drm_crtc_helper.h>
> +#include <drm/drm_device.h>
> +#include <drm/drm_modes.h>
> #include <drm/drm_plane_helper.h>
> #include <drm/drm_simple_kms_helper.h>
> #include <linux/slab.h>
> @@ -299,4 +301,124 @@ int drm_simple_display_pipe_init(struct drm_device *dev,
> }
> EXPORT_SYMBOL(drm_simple_display_pipe_init);
>
> +static const struct drm_connector_helper_funcs drm_simple_connector_hfuncs =
> {
> + /* dummy for the atomic helper */
> +};
> +
> +static int drm_simple_connector_fill_modes(struct drm_connector *connector,
> + uint32_t maxX, uint32_t maxY)
> +{
> + return 1;
> +}
> +
> +static void drm_simple_connector_destroy(struct drm_connector *connector)
> +{
> + drm_connector_cleanup(connector);
> + kfree(connector);
> +}
> +
> +static const struct drm_connector_funcs drm_simple_connector_funcs = {
> + .reset = drm_atomic_helper_connector_reset,
> + .fill_modes = drm_simple_connector_fill_modes,
> + .destroy = drm_simple_connector_destroy,
> + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> +};
> +
> +/**
> + * drm_simple_connector_create - Create a connector with one static mode
> + * @dev: DRM device
> + * @connector_type: Connector type
> + * @mode: Supported display mode
> + * @rotation: Initial @mode rotation in degrees
Maybe extend the documentation to list valid values?
Have you considered to use the DRM_MODE_ROTATE_XXX constants here?
Current tinydrm do not use these and they may not be applicable...
Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel