Commit db26d53c authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'drm-misc-fixes-2019-08-28' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes



drm-misc-fixes for v5.3 (rc7?):
- Make qxl reservel the vga ports using vgaargb to prevent switching to vga compatibility mode.
- Fix omap port lookup for SDI output
- Use virtio_max_dma_size to fix an issue with swiotlb.
- Compiler fixes to komeda.
- Add missing of_node_get() call in komeda.
- Reorder the komeda de-init functions.
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/f187c28b-6279-2c4f-3e53-296ee899133b@linux.intel.com
parents a55aa89a 6978bce0
...@@ -127,7 +127,7 @@ static int komeda_parse_pipe_dt(struct komeda_dev *mdev, struct device_node *np) ...@@ -127,7 +127,7 @@ static int komeda_parse_pipe_dt(struct komeda_dev *mdev, struct device_node *np)
pipe->of_output_port = pipe->of_output_port =
of_graph_get_port_by_id(np, KOMEDA_OF_PORT_OUTPUT); of_graph_get_port_by_id(np, KOMEDA_OF_PORT_OUTPUT);
pipe->of_node = np; pipe->of_node = of_node_get(np);
return 0; return 0;
} }
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_irq.h> #include <drm/drm_irq.h>
#include <drm/drm_vblank.h>
#include <drm/drm_probe_helper.h> #include <drm/drm_probe_helper.h>
#include <drm/drm_vblank.h>
#include "komeda_dev.h" #include "komeda_dev.h"
#include "komeda_framebuffer.h" #include "komeda_framebuffer.h"
...@@ -147,7 +147,6 @@ static int komeda_crtc_normalize_zpos(struct drm_crtc *crtc, ...@@ -147,7 +147,6 @@ static int komeda_crtc_normalize_zpos(struct drm_crtc *crtc,
struct komeda_crtc_state *kcrtc_st = to_kcrtc_st(crtc_st); struct komeda_crtc_state *kcrtc_st = to_kcrtc_st(crtc_st);
struct komeda_plane_state *kplane_st; struct komeda_plane_state *kplane_st;
struct drm_plane_state *plane_st; struct drm_plane_state *plane_st;
struct drm_framebuffer *fb;
struct drm_plane *plane; struct drm_plane *plane;
struct list_head zorder_list; struct list_head zorder_list;
int order = 0, err; int order = 0, err;
...@@ -173,7 +172,6 @@ static int komeda_crtc_normalize_zpos(struct drm_crtc *crtc, ...@@ -173,7 +172,6 @@ static int komeda_crtc_normalize_zpos(struct drm_crtc *crtc,
list_for_each_entry(kplane_st, &zorder_list, zlist_node) { list_for_each_entry(kplane_st, &zorder_list, zlist_node) {
plane_st = &kplane_st->base; plane_st = &kplane_st->base;
fb = plane_st->fb;
plane = plane_st->plane; plane = plane_st->plane;
plane_st->normalized_zpos = order++; plane_st->normalized_zpos = order++;
...@@ -206,7 +204,7 @@ static int komeda_kms_check(struct drm_device *dev, ...@@ -206,7 +204,7 @@ static int komeda_kms_check(struct drm_device *dev,
struct drm_atomic_state *state) struct drm_atomic_state *state)
{ {
struct drm_crtc *crtc; struct drm_crtc *crtc;
struct drm_crtc_state *old_crtc_st, *new_crtc_st; struct drm_crtc_state *new_crtc_st;
int i, err; int i, err;
err = drm_atomic_helper_check_modeset(dev, state); err = drm_atomic_helper_check_modeset(dev, state);
...@@ -217,7 +215,7 @@ static int komeda_kms_check(struct drm_device *dev, ...@@ -217,7 +215,7 @@ static int komeda_kms_check(struct drm_device *dev,
* so need to add all affected_planes (even unchanged) to * so need to add all affected_planes (even unchanged) to
* drm_atomic_state. * drm_atomic_state.
*/ */
for_each_oldnew_crtc_in_state(state, crtc, old_crtc_st, new_crtc_st, i) { for_each_new_crtc_in_state(state, crtc, new_crtc_st, i) {
err = drm_atomic_add_affected_planes(state, crtc); err = drm_atomic_add_affected_planes(state, crtc);
if (err) if (err)
return err; return err;
...@@ -308,11 +306,11 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev) ...@@ -308,11 +306,11 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev)
komeda_kms_irq_handler, IRQF_SHARED, komeda_kms_irq_handler, IRQF_SHARED,
drm->driver->name, drm); drm->driver->name, drm);
if (err) if (err)
goto cleanup_mode_config; goto free_component_binding;
err = mdev->funcs->enable_irq(mdev); err = mdev->funcs->enable_irq(mdev);
if (err) if (err)
goto cleanup_mode_config; goto free_component_binding;
drm->irq_enabled = true; drm->irq_enabled = true;
...@@ -320,15 +318,21 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev) ...@@ -320,15 +318,21 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev)
err = drm_dev_register(drm, 0); err = drm_dev_register(drm, 0);
if (err) if (err)
goto cleanup_mode_config; goto free_interrupts;
return kms; return kms;
cleanup_mode_config: free_interrupts:
drm_kms_helper_poll_fini(drm); drm_kms_helper_poll_fini(drm);
drm->irq_enabled = false; drm->irq_enabled = false;
mdev->funcs->disable_irq(mdev);
free_component_binding:
component_unbind_all(mdev->dev, drm);
cleanup_mode_config:
drm_mode_config_cleanup(drm); drm_mode_config_cleanup(drm);
komeda_kms_cleanup_private_objs(kms); komeda_kms_cleanup_private_objs(kms);
drm->dev_private = NULL;
drm_dev_put(drm);
free_kms: free_kms:
kfree(kms); kfree(kms);
return ERR_PTR(err); return ERR_PTR(err);
...@@ -339,13 +343,14 @@ void komeda_kms_detach(struct komeda_kms_dev *kms) ...@@ -339,13 +343,14 @@ void komeda_kms_detach(struct komeda_kms_dev *kms)
struct drm_device *drm = &kms->base; struct drm_device *drm = &kms->base;
struct komeda_dev *mdev = drm->dev_private; struct komeda_dev *mdev = drm->dev_private;
drm->irq_enabled = false;
mdev->funcs->disable_irq(mdev);
drm_dev_unregister(drm); drm_dev_unregister(drm);
drm_kms_helper_poll_fini(drm); drm_kms_helper_poll_fini(drm);
drm_atomic_helper_shutdown(drm);
drm->irq_enabled = false;
mdev->funcs->disable_irq(mdev);
component_unbind_all(mdev->dev, drm); component_unbind_all(mdev->dev, drm);
komeda_kms_cleanup_private_objs(kms);
drm_mode_config_cleanup(drm); drm_mode_config_cleanup(drm);
komeda_kms_cleanup_private_objs(kms);
drm->dev_private = NULL; drm->dev_private = NULL;
drm_dev_put(drm); drm_dev_put(drm);
} }
...@@ -480,6 +480,7 @@ void komeda_pipeline_dump_register(struct komeda_pipeline *pipe, ...@@ -480,6 +480,7 @@ void komeda_pipeline_dump_register(struct komeda_pipeline *pipe,
struct seq_file *sf); struct seq_file *sf);
/* component APIs */ /* component APIs */
extern __printf(10, 11)
struct komeda_component * struct komeda_component *
komeda_component_add(struct komeda_pipeline *pipe, komeda_component_add(struct komeda_pipeline *pipe,
size_t comp_sz, u32 id, u32 hw_id, size_t comp_sz, u32 id, u32 hw_id,
......
...@@ -148,7 +148,7 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms, ...@@ -148,7 +148,7 @@ static int komeda_wb_connector_add(struct komeda_kms_dev *kms,
if (!kcrtc->master->wb_layer) if (!kcrtc->master->wb_layer)
return 0; return 0;
kwb_conn = kzalloc(sizeof(*wb_conn), GFP_KERNEL); kwb_conn = kzalloc(sizeof(*kwb_conn), GFP_KERNEL);
if (!kwb_conn) if (!kwb_conn)
return -ENOMEM; return -ENOMEM;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* Author: Archit Taneja <archit@ti.com> * Author: Archit Taneja <archit@ti.com>
*/ */
#include <linux/bitops.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -20,7 +21,8 @@ int omapdss_device_init_output(struct omap_dss_device *out) ...@@ -20,7 +21,8 @@ int omapdss_device_init_output(struct omap_dss_device *out)
{ {
struct device_node *remote_node; struct device_node *remote_node;
remote_node = of_graph_get_remote_node(out->dev->of_node, 0, 0); remote_node = of_graph_get_remote_node(out->dev->of_node,
ffs(out->of_ports) - 1, 0);
if (!remote_node) { if (!remote_node) {
dev_dbg(out->dev, "failed to find video sink\n"); dev_dbg(out->dev, "failed to find video sink\n");
return 0; return 0;
......
...@@ -59,6 +59,11 @@ module_param_named(num_heads, qxl_num_crtc, int, 0400); ...@@ -59,6 +59,11 @@ module_param_named(num_heads, qxl_num_crtc, int, 0400);
static struct drm_driver qxl_driver; static struct drm_driver qxl_driver;
static struct pci_driver qxl_pci_driver; static struct pci_driver qxl_pci_driver;
static bool is_vga(struct pci_dev *pdev)
{
return pdev->class == PCI_CLASS_DISPLAY_VGA << 8;
}
static int static int
qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{ {
...@@ -83,9 +88,17 @@ qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -83,9 +88,17 @@ qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (ret) if (ret)
goto disable_pci; goto disable_pci;
if (is_vga(pdev)) {
ret = vga_get_interruptible(pdev, VGA_RSRC_LEGACY_IO);
if (ret) {
DRM_ERROR("can't get legacy vga ioports\n");
goto disable_pci;
}
}
ret = qxl_device_init(qdev, &qxl_driver, pdev); ret = qxl_device_init(qdev, &qxl_driver, pdev);
if (ret) if (ret)
goto disable_pci; goto put_vga;
ret = qxl_modeset_init(qdev); ret = qxl_modeset_init(qdev);
if (ret) if (ret)
...@@ -105,6 +118,9 @@ qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -105,6 +118,9 @@ qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
qxl_modeset_fini(qdev); qxl_modeset_fini(qdev);
unload: unload:
qxl_device_fini(qdev); qxl_device_fini(qdev);
put_vga:
if (is_vga(pdev))
vga_put(pdev, VGA_RSRC_LEGACY_IO);
disable_pci: disable_pci:
pci_disable_device(pdev); pci_disable_device(pdev);
free_dev: free_dev:
...@@ -122,6 +138,8 @@ qxl_pci_remove(struct pci_dev *pdev) ...@@ -122,6 +138,8 @@ qxl_pci_remove(struct pci_dev *pdev)
qxl_modeset_fini(qdev); qxl_modeset_fini(qdev);
qxl_device_fini(qdev); qxl_device_fini(qdev);
if (is_vga(pdev))
vga_put(pdev, VGA_RSRC_LEGACY_IO);
dev->dev_private = NULL; dev->dev_private = NULL;
kfree(qdev); kfree(qdev);
......
...@@ -204,6 +204,7 @@ int virtio_gpu_object_get_sg_table(struct virtio_gpu_device *qdev, ...@@ -204,6 +204,7 @@ int virtio_gpu_object_get_sg_table(struct virtio_gpu_device *qdev,
.interruptible = false, .interruptible = false,
.no_wait_gpu = false .no_wait_gpu = false
}; };
size_t max_segment;
/* wtf swapping */ /* wtf swapping */
if (bo->pages) if (bo->pages)
...@@ -215,8 +216,13 @@ int virtio_gpu_object_get_sg_table(struct virtio_gpu_device *qdev, ...@@ -215,8 +216,13 @@ int virtio_gpu_object_get_sg_table(struct virtio_gpu_device *qdev,
if (!bo->pages) if (!bo->pages)
goto out; goto out;
ret = sg_alloc_table_from_pages(bo->pages, pages, nr_pages, 0, max_segment = virtio_max_dma_size(qdev->vdev);
nr_pages << PAGE_SHIFT, GFP_KERNEL); max_segment &= PAGE_MASK;
if (max_segment > SCATTERLIST_MAX_SEGMENT)
max_segment = SCATTERLIST_MAX_SEGMENT;
ret = __sg_alloc_table_from_pages(bo->pages, pages, nr_pages, 0,
nr_pages << PAGE_SHIFT,
max_segment, GFP_KERNEL);
if (ret) if (ret)
goto out; goto out;
return 0; return 0;
......
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