Commit 2679b96a authored by Dave Airlie's avatar Dave Airlie

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
parents 4757d972 9a191b11
...@@ -121,6 +121,10 @@ int drm_mode_addfb(struct drm_device *dev, ...@@ -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.pixel_format = drm_mode_legacy_fb_format(or->bpp, or->depth);
r.handles[0] = or->handle; 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); ret = drm_mode_addfb2(dev, &r, file_priv);
if (ret) if (ret)
return ret; return ret;
......
...@@ -4477,6 +4477,7 @@ nv50_display_create(struct drm_device *dev) ...@@ -4477,6 +4477,7 @@ nv50_display_create(struct drm_device *dev)
nouveau_display(dev)->fini = nv50_display_fini; nouveau_display(dev)->fini = nv50_display_fini;
disp->disp = &nouveau_display(dev)->disp; disp->disp = &nouveau_display(dev)->disp;
dev->mode_config.funcs = &nv50_disp_func; dev->mode_config.funcs = &nv50_disp_func;
dev->driver->driver_features |= DRIVER_PREFER_XBGR_30BPP;
if (nouveau_atomic) if (nouveau_atomic)
dev->driver->driver_features |= DRIVER_ATOMIC; dev->driver->driver_features |= DRIVER_ATOMIC;
......
...@@ -260,7 +260,7 @@ static void sun4i_tcon0_mode_set_common(struct sun4i_tcon *tcon, ...@@ -260,7 +260,7 @@ static void sun4i_tcon0_mode_set_common(struct sun4i_tcon *tcon,
const struct drm_display_mode *mode) const struct drm_display_mode *mode)
{ {
/* Configure the dot clock */ /* 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 */ /* Set the resolution */
regmap_write(tcon->regs, SUN4I_TCON0_BASIC0_REG, regmap_write(tcon->regs, SUN4I_TCON0_BASIC0_REG,
...@@ -335,6 +335,9 @@ static void sun4i_tcon0_mode_set_lvds(struct sun4i_tcon *tcon, ...@@ -335,6 +335,9 @@ static void sun4i_tcon0_mode_set_lvds(struct sun4i_tcon *tcon,
regmap_update_bits(tcon->regs, SUN4I_TCON_GCTL_REG, regmap_update_bits(tcon->regs, SUN4I_TCON_GCTL_REG,
SUN4I_TCON_GCTL_IOMAP_MASK, SUN4I_TCON_GCTL_IOMAP_MASK,
SUN4I_TCON_GCTL_IOMAP_TCON0); 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, 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, ...@@ -418,7 +421,7 @@ static void sun4i_tcon1_mode_set(struct sun4i_tcon *tcon,
WARN_ON(!tcon->quirks->has_channel_1); WARN_ON(!tcon->quirks->has_channel_1);
/* Configure the dot clock */ /* 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 */ /* Adjust clock delay */
clk_delay = sun4i_tcon_get_clk_delay(mode, 1); clk_delay = sun4i_tcon_get_clk_delay(mode, 1);
......
...@@ -197,6 +197,9 @@ static int virtio_gpu_getparam_ioctl(struct drm_device *dev, void *data, ...@@ -197,6 +197,9 @@ static int virtio_gpu_getparam_ioctl(struct drm_device *dev, void *data,
case VIRTGPU_PARAM_3D_FEATURES: case VIRTGPU_PARAM_3D_FEATURES:
value = vgdev->has_virgl_3d == true ? 1 : 0; value = vgdev->has_virgl_3d == true ? 1 : 0;
break; break;
case VIRTGPU_PARAM_CAPSET_QUERY_FIX:
value = 1;
break;
default: default:
return -EINVAL; return -EINVAL;
} }
...@@ -472,7 +475,7 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev, ...@@ -472,7 +475,7 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
{ {
struct virtio_gpu_device *vgdev = dev->dev_private; struct virtio_gpu_device *vgdev = dev->dev_private;
struct drm_virtgpu_get_caps *args = data; struct drm_virtgpu_get_caps *args = data;
int size; unsigned size, host_caps_size;
int i; int i;
int found_valid = -1; int found_valid = -1;
int ret; int ret;
...@@ -481,6 +484,10 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev, ...@@ -481,6 +484,10 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
if (vgdev->num_capsets == 0) if (vgdev->num_capsets == 0)
return -ENOSYS; return -ENOSYS;
/* don't allow userspace to pass 0 */
if (args->size == 0)
return -EINVAL;
spin_lock(&vgdev->display_info_lock); spin_lock(&vgdev->display_info_lock);
for (i = 0; i < vgdev->num_capsets; i++) { for (i = 0; i < vgdev->num_capsets; i++) {
if (vgdev->capsets[i].id == args->cap_set_id) { if (vgdev->capsets[i].id == args->cap_set_id) {
...@@ -496,11 +503,9 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev, ...@@ -496,11 +503,9 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
return -EINVAL; return -EINVAL;
} }
size = vgdev->capsets[found_valid].max_size; host_caps_size = vgdev->capsets[found_valid].max_size;
if (args->size > size) { /* only copy to user the minimum of the host caps size or the guest caps size */
spin_unlock(&vgdev->display_info_lock); size = min(args->size, host_caps_size);
return -EINVAL;
}
list_for_each_entry(cache_ent, &vgdev->cap_cache, head) { list_for_each_entry(cache_ent, &vgdev->cap_cache, head) {
if (cache_ent->id == args->cap_set_id && if (cache_ent->id == args->cap_set_id &&
......
...@@ -56,6 +56,7 @@ struct drm_printer; ...@@ -56,6 +56,7 @@ struct drm_printer;
#define DRIVER_ATOMIC 0x10000 #define DRIVER_ATOMIC 0x10000
#define DRIVER_KMS_LEGACY_CONTEXT 0x20000 #define DRIVER_KMS_LEGACY_CONTEXT 0x20000
#define DRIVER_SYNCOBJ 0x40000 #define DRIVER_SYNCOBJ 0x40000
#define DRIVER_PREFER_XBGR_30BPP 0x80000
/** /**
* struct drm_driver - DRM driver structure * struct drm_driver - DRM driver structure
......
...@@ -63,6 +63,7 @@ struct drm_virtgpu_execbuffer { ...@@ -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_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 { struct drm_virtgpu_getparam {
__u64 param; __u64 param;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment