[Intel-gfx] [PATCH 14/20] drm: Extract drm_connector.[hc]

2016-08-12 Thread Daniel Vetter
On Wed, Aug 10, 2016 at 11:06:07AM -0400, Sean Paul wrote:
> On Tue, Aug 9, 2016 at 9:41 AM, Daniel Vetter  
> wrote:
> > Pulls in quite a lot of connector related structures (cmdline mode,
> > force/status enums, display info), but I think that all makes perfect
> > sense.
> >
> > Also had to move a few more core kms object stuff into drm_modeset.h.
> >
> > And as a first cleanup remove the kerneldoc for the 2 connector IOCTL
> > - DRM core docs are aimed at drivers, no point documenting internal in
> > excruciating detail.
> >
> > v2: And also pull in all the connector property code.
> >
> 
> \o/
> 
> I picked a few nits below, but nothing functional and nothing that
> wasn't already existing in drm_crtc.c. I twitched at a few other
> really small things while I was reading, so I'll post a follow-on
> cleanup patch for drm_connector. Feel free to disregard my nits below
> and I'll scoop them up later.

I'd like to not change code it code-motion patches. I've added the typo
fix to the drm_connector doc update patch, and will gladly leave the nits
to you in a follow-up.
-Daniel

> 
> Sean
> 
> > Signed-off-by: Daniel Vetter 
> > ---
> >  Documentation/gpu/drm-kms.rst   |9 +
> >  drivers/gpu/drm/Makefile|2 +-
> >  drivers/gpu/drm/drm_connector.c | 1058 
> > +
> >  drivers/gpu/drm/drm_crtc.c  | 1110 
> > +--
> >  drivers/gpu/drm/drm_crtc_internal.h |   26 +-
> >  include/drm/drm_connector.h |  644 
> >  include/drm/drm_crtc.h  |  601 +--
> >  include/drm/drm_modes.h |   16 +-
> >  include/drm/drm_modeset.h   |   36 +-
> >  9 files changed, 1773 insertions(+), 1729 deletions(-)
> >  create mode 100644 drivers/gpu/drm/drm_connector.c
> >  create mode 100644 include/drm/drm_connector.h
> >
> > diff --git a/Documentation/gpu/drm-kms.rst b/Documentation/gpu/drm-kms.rst
> > index d244e03658cc..449acc2517c7 100644
> > --- a/Documentation/gpu/drm-kms.rst
> > +++ b/Documentation/gpu/drm-kms.rst
> > @@ -110,6 +110,15 @@ Display Modes Function Reference
> >  .. kernel-doc:: drivers/gpu/drm/drm_modes.c
> > :export:
> >
> > +Connector Display Sink Abstraction
> > +==
> > +
> > +.. kernel-doc:: include/drm/drm_connector.h
> > +   :internal:
> > +
> > +.. kernel-doc:: drivers/gpu/drm/drm_connector.c
> > +   :export:
> > +
> >  KMS Initialization and Cleanup
> >  ==
> >
> > diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> > index c71ec42ce511..2eff1a33ab63 100644
> > --- a/drivers/gpu/drm/Makefile
> > +++ b/drivers/gpu/drm/Makefile
> > @@ -13,7 +13,7 @@ drm-y   :=drm_auth.o drm_bufs.o drm_cache.o \
> > drm_trace_points.o drm_global.o drm_prime.o \
> > drm_rect.o drm_vma_manager.o drm_flip_work.o \
> > drm_modeset_lock.o drm_atomic.o drm_bridge.o \
> > -   drm_framebuffer.o
> > +   drm_framebuffer.o drm_connector.o
> >
> >  drm-$(CONFIG_COMPAT) += drm_ioc32.o
> >  drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
> > diff --git a/drivers/gpu/drm/drm_connector.c 
> > b/drivers/gpu/drm/drm_connector.c
> > new file mode 100644
> > index ..99ece6758061
> > --- /dev/null
> > +++ b/drivers/gpu/drm/drm_connector.c
> > @@ -0,0 +1,1058 @@
> > +/*
> > + * Copyright (c) 2016 Intel Corporation
> > + *
> > + * Permission to use, copy, modify, distribute, and sell this software and 
> > its
> > + * documentation for any purpose is hereby granted without fee, provided 
> > that
> > + * the above copyright notice appear in all copies and that both that 
> > copyright
> > + * notice and this permission notice appear in supporting documentation, 
> > and
> > + * that the name of the copyright holders not be used in advertising or
> > + * publicity pertaining to distribution of the software without specific,
> > + * written prior permission.  The copyright holders make no representations
> > + * about the suitability of this software for any purpose.  It is provided 
> > "as
> > + * is" without express or implied warranty.
> > + *
> > + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS 
> > SOFTWARE,
> > + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
> > + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
> > + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF 
> > USE,
> > + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
> > + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 
> > PERFORMANCE
> > + * OF THIS SOFTWARE.
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include "drm_crtc_internal.h"
> > +#include "drm_internal.h"
> > +
> > +struct drm_conn_prop_enum_list {
> > +   int type;
> > +   const char *name;
> > +  

[Intel-gfx] [PATCH 14/20] drm: Extract drm_connector.[hc]

2016-08-10 Thread Sean Paul
On Tue, Aug 9, 2016 at 9:41 AM, Daniel Vetter  wrote:
> Pulls in quite a lot of connector related structures (cmdline mode,
> force/status enums, display info), but I think that all makes perfect
> sense.
>
> Also had to move a few more core kms object stuff into drm_modeset.h.
>
> And as a first cleanup remove the kerneldoc for the 2 connector IOCTL
> - DRM core docs are aimed at drivers, no point documenting internal in
> excruciating detail.
>
> v2: And also pull in all the connector property code.
>

\o/

I picked a few nits below, but nothing functional and nothing that
wasn't already existing in drm_crtc.c. I twitched at a few other
really small things while I was reading, so I'll post a follow-on
cleanup patch for drm_connector. Feel free to disregard my nits below
and I'll scoop them up later.

Sean

> Signed-off-by: Daniel Vetter 
> ---
>  Documentation/gpu/drm-kms.rst   |9 +
>  drivers/gpu/drm/Makefile|2 +-
>  drivers/gpu/drm/drm_connector.c | 1058 +
>  drivers/gpu/drm/drm_crtc.c  | 1110 
> +--
>  drivers/gpu/drm/drm_crtc_internal.h |   26 +-
>  include/drm/drm_connector.h |  644 
>  include/drm/drm_crtc.h  |  601 +--
>  include/drm/drm_modes.h |   16 +-
>  include/drm/drm_modeset.h   |   36 +-
>  9 files changed, 1773 insertions(+), 1729 deletions(-)
>  create mode 100644 drivers/gpu/drm/drm_connector.c
>  create mode 100644 include/drm/drm_connector.h
>
> diff --git a/Documentation/gpu/drm-kms.rst b/Documentation/gpu/drm-kms.rst
> index d244e03658cc..449acc2517c7 100644
> --- a/Documentation/gpu/drm-kms.rst
> +++ b/Documentation/gpu/drm-kms.rst
> @@ -110,6 +110,15 @@ Display Modes Function Reference
>  .. kernel-doc:: drivers/gpu/drm/drm_modes.c
> :export:
>
> +Connector Display Sink Abstraction
> +==
> +
> +.. kernel-doc:: include/drm/drm_connector.h
> +   :internal:
> +
> +.. kernel-doc:: drivers/gpu/drm/drm_connector.c
> +   :export:
> +
>  KMS Initialization and Cleanup
>  ==
>
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index c71ec42ce511..2eff1a33ab63 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -13,7 +13,7 @@ drm-y   :=drm_auth.o drm_bufs.o drm_cache.o \
> drm_trace_points.o drm_global.o drm_prime.o \
> drm_rect.o drm_vma_manager.o drm_flip_work.o \
> drm_modeset_lock.o drm_atomic.o drm_bridge.o \
> -   drm_framebuffer.o
> +   drm_framebuffer.o drm_connector.o
>
>  drm-$(CONFIG_COMPAT) += drm_ioc32.o
>  drm-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_gem_cma_helper.o
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> new file mode 100644
> index ..99ece6758061
> --- /dev/null
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -0,0 +1,1058 @@
> +/*
> + * Copyright (c) 2016 Intel Corporation
> + *
> + * Permission to use, copy, modify, distribute, and sell this software and 
> its
> + * documentation for any purpose is hereby granted without fee, provided that
> + * the above copyright notice appear in all copies and that both that 
> copyright
> + * notice and this permission notice appear in supporting documentation, and
> + * that the name of the copyright holders not be used in advertising or
> + * publicity pertaining to distribution of the software without specific,
> + * written prior permission.  The copyright holders make no representations
> + * about the suitability of this software for any purpose.  It is provided 
> "as
> + * is" without express or implied warranty.
> + *
> + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS 
> SOFTWARE,
> + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
> + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
> + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF 
> USE,
> + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
> + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 
> PERFORMANCE
> + * OF THIS SOFTWARE.
> + */
> +
> +#include 
> +#include 
> +#include 
> +
> +#include "drm_crtc_internal.h"
> +#include "drm_internal.h"
> +
> +struct drm_conn_prop_enum_list {
> +   int type;
> +   const char *name;
> +   struct ida ida;
> +};
> +
> +/*
> + * Connector and encoder types.
> + */
> +static struct drm_conn_prop_enum_list drm_connector_enum_list[] = {
> +   { DRM_MODE_CONNECTOR_Unknown, "Unknown" },
> +   { DRM_MODE_CONNECTOR_VGA, "VGA" },
> +   { DRM_MODE_CONNECTOR_DVII, "DVI-I" },
> +   { DRM_MODE_CONNECTOR_DVID, "DVI-D" },
> +   { DRM_MODE_CONNECTOR_DVIA, "DVI-A" },
> +   { DRM_MODE_CONNECTOR_Composite, "Composite" },
> +   { DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO" },