Two regression fixes here: a fb format regression on nouveau and a 4.16-rc1

regression with on LVDS with one sun4i device. Plus a sun4i and  a virtio-gpu
 fixes.
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJalr4FAAoJEEN0HIUfOBk0kfwQAJaUiAihz3aahzRAlbN+9u94
 mPWkjr24pQg6BJ92mO/y3z81IIfXrJqNFnw3CU6CYTQxhqA5gp7LqlWfaH9Vnyut
 SMVqLVzqc+JPHoh2HKaA0XqM2lpJtWTIhDhWklN3tU3hr+mIHAnExVyX5okSu09l
 irah/n4ZWAfF6VBOFN/af9u/pS9DRhX1O619DcZchTFMVvGDScJAvyVUnJDa5BZK
 Oix2JQxyuUBxCXcKg+pTwcWaegcqKD05s4cmM2E7vmsES+LSeN6+StEmtjK6zNZC
 cEkzGsRI0KIU+Dc2tIukUK+A1ez0LDrOog6llYBA4ZqveBS261cgpTbjdzynb5cx
 xxcxt0O0+CwO24BV71ZTLRX0Hqxb6d5csTzFgFtAUU+iU7aNfYN8NKtHxIdTZxcT
 pcIAurFk+qiHVEV716hiLNBFvObAZMSJtyKJ0EWp3L70yFTXzU9eeUuk0r7CE4Jh
 mZDy2t2Z9J1uyXPv+lEfwhjwMEN/+BdPUmnAFZbrPZlqTZABMsTgEadrIXasRWcr
 3uE0q7SMWIPUlZioUWnXxnPVLqi5EjUNHtAYEzBupy2cf3eMB6WrHr7q1Blqe2JV
 r3gnJReAUQTlYVF0SWpT3EJfFgJaVytF7ZS5N4K5KRH0GMsTCDj2ivRfxIk1ujcW
 RIJV0IfBx8m8qAVK58gn
 =57h5
 -----END PGP SIGNATURE-----

Merge tag 'drm-misc-fixes-2018-02-28' of git://people.freedesktop.org/drm-misc into drm-fixes

Two regression fixes here: a fb format regression on nouveau and a 4.16-rc1
regression with on LVDS with one sun4i device. Plus a sun4i and  a virtio-gpu
fixes.

* tag 'drm-misc-fixes-2018-02-28' of git://people.freedesktop.org/drm-misc:
  virtio-gpu: fix ioctl and expose the fixed status to userspace.
  drm/sun4i: Protect the TCON pixel clocks
  drm/sun4i: Enable the output on the pins (tcon0)
  drm/nouveau: prefer XBGR2101010 for addfb ioctl
This commit is contained in:
Dave Airlie 2018-03-01 14:02:32 +10:00
commit 2679b96ae4
6 changed files with 23 additions and 8 deletions

View file

@ -121,6 +121,10 @@ int drm_mode_addfb(struct drm_device *dev,
r.pixel_format = drm_mode_legacy_fb_format(or->bpp, or->depth);
r.handles[0] = or->handle;
if (r.pixel_format == DRM_FORMAT_XRGB2101010 &&
dev->driver->driver_features & DRIVER_PREFER_XBGR_30BPP)
r.pixel_format = DRM_FORMAT_XBGR2101010;
ret = drm_mode_addfb2(dev, &r, file_priv);
if (ret)
return ret;

View file

@ -4477,6 +4477,7 @@ nv50_display_create(struct drm_device *dev)
nouveau_display(dev)->fini = nv50_display_fini;
disp->disp = &nouveau_display(dev)->disp;
dev->mode_config.funcs = &nv50_disp_func;
dev->driver->driver_features |= DRIVER_PREFER_XBGR_30BPP;
if (nouveau_atomic)
dev->driver->driver_features |= DRIVER_ATOMIC;

View file

@ -260,7 +260,7 @@ static void sun4i_tcon0_mode_set_common(struct sun4i_tcon *tcon,
const struct drm_display_mode *mode)
{
/* Configure the dot clock */
clk_set_rate(tcon->dclk, mode->crtc_clock * 1000);
clk_set_rate_exclusive(tcon->dclk, mode->crtc_clock * 1000);
/* Set the resolution */
regmap_write(tcon->regs, SUN4I_TCON0_BASIC0_REG,
@ -335,6 +335,9 @@ static void sun4i_tcon0_mode_set_lvds(struct sun4i_tcon *tcon,
regmap_update_bits(tcon->regs, SUN4I_TCON_GCTL_REG,
SUN4I_TCON_GCTL_IOMAP_MASK,
SUN4I_TCON_GCTL_IOMAP_TCON0);
/* Enable the output on the pins */
regmap_write(tcon->regs, SUN4I_TCON0_IO_TRI_REG, 0xe0000000);
}
static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
@ -418,7 +421,7 @@ static void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
WARN_ON(!tcon->quirks->has_channel_1);
/* Configure the dot clock */
clk_set_rate(tcon->sclk1, mode->crtc_clock * 1000);
clk_set_rate_exclusive(tcon->sclk1, mode->crtc_clock * 1000);
/* Adjust clock delay */
clk_delay = sun4i_tcon_get_clk_delay(mode, 1);

View file

@ -197,6 +197,9 @@ static int virtio_gpu_getparam_ioctl(struct drm_device *dev, void *data,
case VIRTGPU_PARAM_3D_FEATURES:
value = vgdev->has_virgl_3d == true ? 1 : 0;
break;
case VIRTGPU_PARAM_CAPSET_QUERY_FIX:
value = 1;
break;
default:
return -EINVAL;
}
@ -472,7 +475,7 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
{
struct virtio_gpu_device *vgdev = dev->dev_private;
struct drm_virtgpu_get_caps *args = data;
int size;
unsigned size, host_caps_size;
int i;
int found_valid = -1;
int ret;
@ -481,6 +484,10 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
if (vgdev->num_capsets == 0)
return -ENOSYS;
/* don't allow userspace to pass 0 */
if (args->size == 0)
return -EINVAL;
spin_lock(&vgdev->display_info_lock);
for (i = 0; i < vgdev->num_capsets; i++) {
if (vgdev->capsets[i].id == args->cap_set_id) {
@ -496,11 +503,9 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
return -EINVAL;
}
size = vgdev->capsets[found_valid].max_size;
if (args->size > size) {
spin_unlock(&vgdev->display_info_lock);
return -EINVAL;
}
host_caps_size = vgdev->capsets[found_valid].max_size;
/* only copy to user the minimum of the host caps size or the guest caps size */
size = min(args->size, host_caps_size);
list_for_each_entry(cache_ent, &vgdev->cap_cache, head) {
if (cache_ent->id == args->cap_set_id &&

View file

@ -56,6 +56,7 @@ struct drm_printer;
#define DRIVER_ATOMIC 0x10000
#define DRIVER_KMS_LEGACY_CONTEXT 0x20000
#define DRIVER_SYNCOBJ 0x40000
#define DRIVER_PREFER_XBGR_30BPP 0x80000
/**
* struct drm_driver - DRM driver structure

View file

@ -63,6 +63,7 @@ struct drm_virtgpu_execbuffer {
};
#define VIRTGPU_PARAM_3D_FEATURES 1 /* do we have 3D features in the hw */
#define VIRTGPU_PARAM_CAPSET_QUERY_FIX 2 /* do we have the capset fix */
struct drm_virtgpu_getparam {
__u64 param;