aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2018-02-28 23:02:32 -0500
committerDave Airlie <airlied@redhat.com>2018-02-28 23:02:32 -0500
commit2679b96ae4c055b8cfc27da8c9f703de08ce5c4b (patch)
treefdbb872bf211f06719ee91abe33e1c52d2350b18
parent4757d972d9667bc6dbdc2859ce3f1721dbcc3dd6 (diff)
parent9a191b114906457c4b2494c474f58ae4142d4e67 (diff)
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
-rw-r--r--drivers/gpu/drm/drm_framebuffer.c4
-rw-r--r--drivers/gpu/drm/nouveau/nv50_display.c1
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_tcon.c7
-rw-r--r--drivers/gpu/drm/virtio/virtgpu_ioctl.c17
-rw-r--r--include/drm/drm_drv.h1
-rw-r--r--include/uapi/drm/virtgpu_drm.h1
6 files changed, 23 insertions, 8 deletions
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index 5a13ff29f4f0..c0530a1af5e3 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -121,6 +121,10 @@ int drm_mode_addfb(struct drm_device *dev,
121 r.pixel_format = drm_mode_legacy_fb_format(or->bpp, or->depth); 121 r.pixel_format = drm_mode_legacy_fb_format(or->bpp, or->depth);
122 r.handles[0] = or->handle; 122 r.handles[0] = or->handle;
123 123
124 if (r.pixel_format == DRM_FORMAT_XRGB2101010 &&
125 dev->driver->driver_features & DRIVER_PREFER_XBGR_30BPP)
126 r.pixel_format = DRM_FORMAT_XBGR2101010;
127
124 ret = drm_mode_addfb2(dev, &r, file_priv); 128 ret = drm_mode_addfb2(dev, &r, file_priv);
125 if (ret) 129 if (ret)
126 return ret; 130 return ret;
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index dd8d4352ed99..caddce88d2d8 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -4477,6 +4477,7 @@ nv50_display_create(struct drm_device *dev)
4477 nouveau_display(dev)->fini = nv50_display_fini; 4477 nouveau_display(dev)->fini = nv50_display_fini;
4478 disp->disp = &nouveau_display(dev)->disp; 4478 disp->disp = &nouveau_display(dev)->disp;
4479 dev->mode_config.funcs = &nv50_disp_func; 4479 dev->mode_config.funcs = &nv50_disp_func;
4480 dev->driver->driver_features |= DRIVER_PREFER_XBGR_30BPP;
4480 if (nouveau_atomic) 4481 if (nouveau_atomic)
4481 dev->driver->driver_features |= DRIVER_ATOMIC; 4482 dev->driver->driver_features |= DRIVER_ATOMIC;
4482 4483
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index 3c15cf24b503..b3960118deb9 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -260,7 +260,7 @@ static void sun4i_tcon0_mode_set_common(struct sun4i_tcon *tcon,
260 const struct drm_display_mode *mode) 260 const struct drm_display_mode *mode)
261{ 261{
262 /* Configure the dot clock */ 262 /* Configure the dot clock */
263 clk_set_rate(tcon->dclk, mode->crtc_clock * 1000); 263 clk_set_rate_exclusive(tcon->dclk, mode->crtc_clock * 1000);
264 264
265 /* Set the resolution */ 265 /* Set the resolution */
266 regmap_write(tcon->regs, SUN4I_TCON0_BASIC0_REG, 266 regmap_write(tcon->regs, SUN4I_TCON0_BASIC0_REG,
@@ -335,6 +335,9 @@ static void sun4i_tcon0_mode_set_lvds(struct sun4i_tcon *tcon,
335 regmap_update_bits(tcon->regs, SUN4I_TCON_GCTL_REG, 335 regmap_update_bits(tcon->regs, SUN4I_TCON_GCTL_REG,
336 SUN4I_TCON_GCTL_IOMAP_MASK, 336 SUN4I_TCON_GCTL_IOMAP_MASK,
337 SUN4I_TCON_GCTL_IOMAP_TCON0); 337 SUN4I_TCON_GCTL_IOMAP_TCON0);
338
339 /* Enable the output on the pins */
340 regmap_write(tcon->regs, SUN4I_TCON0_IO_TRI_REG, 0xe0000000);
338} 341}
339 342
340static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, 343static 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 WARN_ON(!tcon->quirks->has_channel_1); 421 WARN_ON(!tcon->quirks->has_channel_1);
419 422
420 /* Configure the dot clock */ 423 /* Configure the dot clock */
421 clk_set_rate(tcon->sclk1, mode->crtc_clock * 1000); 424 clk_set_rate_exclusive(tcon->sclk1, mode->crtc_clock * 1000);
422 425
423 /* Adjust clock delay */ 426 /* Adjust clock delay */
424 clk_delay = sun4i_tcon_get_clk_delay(mode, 1); 427 clk_delay = sun4i_tcon_get_clk_delay(mode, 1);
diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index 5720a0d4ac0a..677ac16c8a6d 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -197,6 +197,9 @@ static int virtio_gpu_getparam_ioctl(struct drm_device *dev, void *data,
197 case VIRTGPU_PARAM_3D_FEATURES: 197 case VIRTGPU_PARAM_3D_FEATURES:
198 value = vgdev->has_virgl_3d == true ? 1 : 0; 198 value = vgdev->has_virgl_3d == true ? 1 : 0;
199 break; 199 break;
200 case VIRTGPU_PARAM_CAPSET_QUERY_FIX:
201 value = 1;
202 break;
200 default: 203 default:
201 return -EINVAL; 204 return -EINVAL;
202 } 205 }
@@ -472,7 +475,7 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
472{ 475{
473 struct virtio_gpu_device *vgdev = dev->dev_private; 476 struct virtio_gpu_device *vgdev = dev->dev_private;
474 struct drm_virtgpu_get_caps *args = data; 477 struct drm_virtgpu_get_caps *args = data;
475 int size; 478 unsigned size, host_caps_size;
476 int i; 479 int i;
477 int found_valid = -1; 480 int found_valid = -1;
478 int ret; 481 int ret;
@@ -481,6 +484,10 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
481 if (vgdev->num_capsets == 0) 484 if (vgdev->num_capsets == 0)
482 return -ENOSYS; 485 return -ENOSYS;
483 486
487 /* don't allow userspace to pass 0 */
488 if (args->size == 0)
489 return -EINVAL;
490
484 spin_lock(&vgdev->display_info_lock); 491 spin_lock(&vgdev->display_info_lock);
485 for (i = 0; i < vgdev->num_capsets; i++) { 492 for (i = 0; i < vgdev->num_capsets; i++) {
486 if (vgdev->capsets[i].id == args->cap_set_id) { 493 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 return -EINVAL; 503 return -EINVAL;
497 } 504 }
498 505
499 size = vgdev->capsets[found_valid].max_size; 506 host_caps_size = vgdev->capsets[found_valid].max_size;
500 if (args->size > size) { 507 /* only copy to user the minimum of the host caps size or the guest caps size */
501 spin_unlock(&vgdev->display_info_lock); 508 size = min(args->size, host_caps_size);
502 return -EINVAL;
503 }
504 509
505 list_for_each_entry(cache_ent, &vgdev->cap_cache, head) { 510 list_for_each_entry(cache_ent, &vgdev->cap_cache, head) {
506 if (cache_ent->id == args->cap_set_id && 511 if (cache_ent->id == args->cap_set_id &&
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index d32b688eb346..d23dcdd1bd95 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -56,6 +56,7 @@ struct drm_printer;
56#define DRIVER_ATOMIC 0x10000 56#define DRIVER_ATOMIC 0x10000
57#define DRIVER_KMS_LEGACY_CONTEXT 0x20000 57#define DRIVER_KMS_LEGACY_CONTEXT 0x20000
58#define DRIVER_SYNCOBJ 0x40000 58#define DRIVER_SYNCOBJ 0x40000
59#define DRIVER_PREFER_XBGR_30BPP 0x80000
59 60
60/** 61/**
61 * struct drm_driver - DRM driver structure 62 * struct drm_driver - DRM driver structure
diff --git a/include/uapi/drm/virtgpu_drm.h b/include/uapi/drm/virtgpu_drm.h
index 91a31ffed828..9a781f0611df 100644
--- a/include/uapi/drm/virtgpu_drm.h
+++ b/include/uapi/drm/virtgpu_drm.h
@@ -63,6 +63,7 @@ struct drm_virtgpu_execbuffer {
63}; 63};
64 64
65#define VIRTGPU_PARAM_3D_FEATURES 1 /* do we have 3D features in the hw */ 65#define VIRTGPU_PARAM_3D_FEATURES 1 /* do we have 3D features in the hw */
66#define VIRTGPU_PARAM_CAPSET_QUERY_FIX 2 /* do we have the capset fix */
66 67
67struct drm_virtgpu_getparam { 68struct drm_virtgpu_getparam {
68 __u64 param; 69 __u64 param;