[PATCH V3 4/7] Add new mode function in drm backend
Wang, Quanxian
quanxian.wang at intel.com
Sun Apr 13 21:23:26 PDT 2014
Sorry to be later. Thanks for your comment.
On Wed, 2014-04-09 at 08:36 +0200, Hardening wrote:
> Le 08/04/2014 07:03, Quanxian Wang a écrit :
> > provide drm_output_new_mode interface to create new mode from
> > outsite instead of only from edid or configure.
> >
> > Signed-off-by: Quanxian Wang <quanxian.wang at intel.com>
> > ---
> > src/compositor-drm.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 76 insertions(+)
> >
> > diff --git a/src/compositor-drm.c b/src/compositor-drm.c index
> > 154e15e..57e0585 100644
> > --- a/src/compositor-drm.c
> > +++ b/src/compositor-drm.c
> > @@ -1390,6 +1390,80 @@ drm_output_add_mode(struct drm_output *output, drmModeModeInfo *info)
> > }
> >
>
> [...]
>
> > +
> > +static struct weston_mode *
> > +drm_output_new_timing(struct weston_output *output,
> > + uint32_t clock,
> > + int hdisplay,
> > + int hsync_start,
> > + int hsync_end,
> > + int htotal,
> > + int vdisplay,
> > + int vsync_start,
> > + int vsync_end,
> > + int vtotal,
> > + int vscan,
> > + uint32_t flags)
> > +{
> > + drmModeModeInfo *modeinfo;
> > + struct drm_mode *mode = NULL;
> > +
> > + modeinfo = malloc(sizeof(*modeinfo));
> > + if (modeinfo == NULL)
> > + return NULL;
> > + memset(modeinfo, 0x0, sizeof(*modeinfo));
>
> Hardening: you should use zmalloc here
Got that. Thanks
>
> > +
> > + modeinfo->type = DRM_MODE_TYPE_USERDEF;
> > + modeinfo->hskew = 0;
> > + modeinfo->vrefresh = 0;
> > + modeinfo->hdisplay = hdisplay;
>
> [...]
>
> +
> > +static int
> > drm_subpixel_to_wayland(int drm_value)
> > {
> > switch (drm_value) {
> > @@ -2046,6 +2120,8 @@ create_output_for_connector(struct drm_compositor *ec,
> > output->base.assign_planes = drm_assign_planes;
> > output->base.set_dpms = drm_set_dpms;
> > output->base.switch_mode = drm_output_switch_mode;
> > + output->base.new_timing = drm_output_new_timing;
> > + output->base.compare_timing = drm_output_compare_timing;
> >
> > output->base.gamma_size = output->original_crtc->gamma_size;
> > output->base.set_gamma = drm_output_set_gamma;
> >
>
> Regards.
More information about the wayland-devel
mailing list