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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 &&
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user