diff mbox

[drm/qxl,6/6] qxl: Allow resolution which are not multiple of 8

Message ID 20161028121227.16904-7-cfergeau@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Christophe Fergeau Oct. 28, 2016, 12:12 p.m. UTC
The use of drm_cvt_mode() in qxl_add_monitors_config_modes() means that
the resolutions we are going to present to user-space are going to be
rounded down to a multiple of 8. In the QXL arbitrary resolution case,
this is not useful.
This commit forces the actual width/height that was requested by the
client in the drm_display_mode structure rather than keeping the
rounded version.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
---

I know this is very hacky, but I have no idea what is important to be set in the mode struct,
if there is a better way to create it without getting the rounding to a multiple of 8, ...


 drivers/gpu/drm/qxl/qxl_display.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Frediano Ziglio Oct. 31, 2016, 11:35 a.m. UTC | #1
> 
> The use of drm_cvt_mode() in qxl_add_monitors_config_modes() means that
> the resolutions we are going to present to user-space are going to be
> rounded down to a multiple of 8. In the QXL arbitrary resolution case,
> this is not useful.
> This commit forces the actual width/height that was requested by the
> client in the drm_display_mode structure rather than keeping the
> rounded version.
> 
> Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
> ---
> 
> I know this is very hacky, but I have no idea what is important to be set in
> the mode struct,
> if there is a better way to create it without getting the rounding to a
> multiple of 8, ...
> 
> 
>  drivers/gpu/drm/qxl/qxl_display.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/qxl/qxl_display.c
> b/drivers/gpu/drm/qxl/qxl_display.c
> index edb90f6..fc5b01e 100644
> --- a/drivers/gpu/drm/qxl/qxl_display.c
> +++ b/drivers/gpu/drm/qxl/qxl_display.c
> @@ -202,6 +202,9 @@ static int qxl_add_monitors_config_modes(struct
> drm_connector *connector,
>  	mode = drm_cvt_mode(dev, head->width, head->height, 60, false, false,
>  			    false);
>  	mode->type |= DRM_MODE_TYPE_PREFERRED;
> +	mode->hdisplay = head->width;
> +	mode->vdisplay = head->height;
> +	drm_mode_set_name(mode);
>  	*pwidth = head->width;
>  	*pheight = head->height;
>  	drm_mode_probed_add(connector, mode);

If I remember I was discussing with Pavel some time ago about the implementation
of this.
And if I remember he tested some code.
Pavel, do you remember something about?

Frediano
Pavel Grunt Oct. 31, 2016, 11:49 a.m. UTC | #2
On Mon, 2016-10-31 at 07:35 -0400, Frediano Ziglio wrote:
> > 
> > The use of drm_cvt_mode() in qxl_add_monitors_config_modes() means
> > that
> > the resolutions we are going to present to user-space are going to
> > be
> > rounded down to a multiple of 8. In the QXL arbitrary resolution
> > case,
> > this is not useful.
> > This commit forces the actual width/height that was requested by
> > the
> > client in the drm_display_mode structure rather than keeping the
> > rounded version.
> > 
> > Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
> > ---
> > 
> > I know this is very hacky, but I have no idea what is important to
> > be set in
> > the mode struct,
> > if there is a better way to create it without getting the rounding
> > to a
> > multiple of 8, ...
> > 
> > 
> >  drivers/gpu/drm/qxl/qxl_display.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/qxl/qxl_display.c
> > b/drivers/gpu/drm/qxl/qxl_display.c
> > index edb90f6..fc5b01e 100644
> > --- a/drivers/gpu/drm/qxl/qxl_display.c
> > +++ b/drivers/gpu/drm/qxl/qxl_display.c
> > @@ -202,6 +202,9 @@ static int
> > qxl_add_monitors_config_modes(struct
> > drm_connector *connector,
> >  	mode = drm_cvt_mode(dev, head->width, head->height, 60,
> > false, false,
> >  			    false);
> >  	mode->type |= DRM_MODE_TYPE_PREFERRED;
> > +	mode->hdisplay = head->width;
> > +	mode->vdisplay = head->height;
> > +	drm_mode_set_name(mode);
> >  	*pwidth = head->width;
> >  	*pheight = head->height;
> >  	drm_mode_probed_add(connector, mode);
> 
> If I remember I was discussing with Pavel some time ago about the
> implementation
> of this.
> And if I remember he tested some code.
> Pavel, do you remember something about?

I found out that there is a function fixup_mode_1366x768() in
drivers/gpu/drm/drm_edid.c setting the mode->hdisplay and also
adjusting the mode->hsync

This patch is doing something similar. It just ignores the sync part.

Pavel
diff mbox

Patch

diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index edb90f6..fc5b01e 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -202,6 +202,9 @@  static int qxl_add_monitors_config_modes(struct drm_connector *connector,
 	mode = drm_cvt_mode(dev, head->width, head->height, 60, false, false,
 			    false);
 	mode->type |= DRM_MODE_TYPE_PREFERRED;
+	mode->hdisplay = head->width;
+	mode->vdisplay = head->height;
+	drm_mode_set_name(mode);
 	*pwidth = head->width;
 	*pheight = head->height;
 	drm_mode_probed_add(connector, mode);