diff options
Diffstat (limited to 'drm/nouveau')
-rw-r--r-- | drm/nouveau/dispnv04/dac.c | 4 | ||||
-rw-r--r-- | drm/nouveau/dispnv04/dfp.c | 4 | ||||
-rw-r--r-- | drm/nouveau/dispnv04/tvnv04.c | 4 | ||||
-rw-r--r-- | drm/nouveau/dispnv04/tvnv17.c | 10 | ||||
-rw-r--r-- | drm/nouveau/nouveau_connector.c | 7 | ||||
-rw-r--r-- | drm/nouveau/nouveau_display.c | 45 | ||||
-rw-r--r-- | drm/nouveau/nouveau_display.h | 12 | ||||
-rw-r--r-- | drm/nouveau/nouveau_drm.c | 7 | ||||
-rw-r--r-- | drm/nouveau/nouveau_fbcon.c | 21 | ||||
-rw-r--r-- | drm/nouveau/nouveau_platform.c | 7 | ||||
-rw-r--r-- | drm/nouveau/nv50_display.c | 16 |
11 files changed, 137 insertions, 0 deletions
diff --git a/drm/nouveau/dispnv04/dac.c b/drm/nouveau/dispnv04/dac.c index b48eec395..c02f8c864 100644 --- a/drm/nouveau/dispnv04/dac.c +++ b/drm/nouveau/dispnv04/dac.c @@ -549,8 +549,12 @@ nv04_dac_create(struct drm_connector *connector, struct dcb_output *entry) else helper = &nv04_dac_helper_funcs; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) drm_encoder_init(dev, encoder, &nv04_dac_funcs, DRM_MODE_ENCODER_DAC, NULL); +#else + drm_encoder_init(dev, encoder, &nv04_dac_funcs, DRM_MODE_ENCODER_DAC); +#endif drm_encoder_helper_add(encoder, helper); encoder->possible_crtcs = entry->heads; diff --git a/drm/nouveau/dispnv04/dfp.c b/drm/nouveau/dispnv04/dfp.c index 05bfd151d..3f88afa4e 100644 --- a/drm/nouveau/dispnv04/dfp.c +++ b/drm/nouveau/dispnv04/dfp.c @@ -705,7 +705,11 @@ nv04_dfp_create(struct drm_connector *connector, struct dcb_output *entry) nv_encoder->dcb = entry; nv_encoder->or = ffs(entry->or) - 1; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) drm_encoder_init(connector->dev, encoder, &nv04_dfp_funcs, type, NULL); +#else + drm_encoder_init(connector->dev, encoder, &nv04_dfp_funcs, type); +#endif drm_encoder_helper_add(encoder, helper); encoder->possible_crtcs = entry->heads; diff --git a/drm/nouveau/dispnv04/tvnv04.c b/drm/nouveau/dispnv04/tvnv04.c index 54e9fb9eb..fd6768f9e 100644 --- a/drm/nouveau/dispnv04/tvnv04.c +++ b/drm/nouveau/dispnv04/tvnv04.c @@ -223,8 +223,12 @@ nv04_tv_create(struct drm_connector *connector, struct dcb_output *entry) /* Initialize the common members */ encoder = to_drm_encoder(nv_encoder); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) drm_encoder_init(dev, encoder, &nv04_tv_funcs, DRM_MODE_ENCODER_TVDAC, NULL); +#else + drm_encoder_init(dev, encoder, &nv04_tv_funcs, DRM_MODE_ENCODER_TVDAC); +#endif drm_encoder_helper_add(encoder, &nv04_tv_helper_funcs); nv_encoder->enc_save = drm_i2c_encoder_save; diff --git a/drm/nouveau/dispnv04/tvnv17.c b/drm/nouveau/dispnv04/tvnv17.c index 163317d26..31678682b 100644 --- a/drm/nouveau/dispnv04/tvnv17.c +++ b/drm/nouveau/dispnv04/tvnv17.c @@ -24,6 +24,8 @@ * */ +#include <linux/version.h> + #include <drm/drmP.h> #include <drm/drm_crtc_helper.h> #include "nouveau_drm.h" @@ -656,7 +658,9 @@ static int nv17_tv_create_resources(struct drm_encoder *encoder, nouveau_tv_norm); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) drm_mode_create_tv_properties(dev, num_tv_norms, nv17_tv_norm_names); +#endif drm_object_attach_property(&connector->base, conf->tv_select_subconnector_property, @@ -814,10 +818,16 @@ nv17_tv_create(struct drm_connector *connector, struct dcb_output *entry) tv_enc->base.dcb = entry; tv_enc->base.or = ffs(entry->or) - 1; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) drm_encoder_init(dev, encoder, &nv17_tv_funcs, DRM_MODE_ENCODER_TVDAC, NULL); drm_encoder_helper_add(encoder, &nv17_tv_helper_funcs); to_encoder_slave(encoder)->slave_funcs = &nv17_tv_slave_funcs; +#else + drm_encoder_init(dev, encoder, &nv17_tv_funcs, DRM_MODE_ENCODER_TVDAC); + drm_encoder_helper_add(encoder, &nv17_tv_helper_funcs); + to_encoder_slave(encoder)->slave_funcs = (struct drm_encoder_slave_funcs *)&nv17_tv_slave_funcs; +#endif tv_enc->base.enc_save = nv17_tv_save; tv_enc->base.enc_restore = nv17_tv_restore; diff --git a/drm/nouveau/nouveau_connector.c b/drm/nouveau/nouveau_connector.c index fcebfae5d..f9a5030a0 100644 --- a/drm/nouveau/nouveau_connector.c +++ b/drm/nouveau/nouveau_connector.c @@ -27,6 +27,7 @@ #include <acpi/button.h> #include <linux/pm_runtime.h> +#include <linux/version.h> #include <drm/drmP.h> #include <drm/drm_edid.h> @@ -935,7 +936,11 @@ nouveau_connector_funcs_lvds = { .force = nouveau_connector_force }; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) static int +#else +static void +#endif nouveau_connector_dp_dpms(struct drm_connector *connector, int mode) { struct nouveau_encoder *nv_encoder = NULL; @@ -954,7 +959,9 @@ nouveau_connector_dp_dpms(struct drm_connector *connector, int mode) } } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) return drm_helper_connector_dpms(connector, mode); +#endif } static const struct drm_connector_funcs diff --git a/drm/nouveau/nouveau_display.c b/drm/nouveau/nouveau_display.c index d020a0923..c6a51840b 100644 --- a/drm/nouveau/nouveau_display.c +++ b/drm/nouveau/nouveau_display.c @@ -42,6 +42,8 @@ #include <nvif/cl0046.h> #include <nvif/event.h> +#include <linux/version.h> + static int nouveau_display_vblank_handler(struct nvif_notify *notify) { @@ -52,7 +54,11 @@ nouveau_display_vblank_handler(struct nvif_notify *notify) } int +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) nouveau_display_vblank_enable(struct drm_device *dev, unsigned int pipe) +#else +nouveau_display_vblank_enable(struct drm_device *dev, int pipe) +#endif { struct drm_crtc *crtc; list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { @@ -66,7 +72,11 @@ nouveau_display_vblank_enable(struct drm_device *dev, unsigned int pipe) } void +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) nouveau_display_vblank_disable(struct drm_device *dev, unsigned int pipe) +#else +nouveau_display_vblank_disable(struct drm_device *dev, int pipe) +#endif { struct drm_crtc *crtc; list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { @@ -104,7 +114,9 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos, .base.head = nouveau_crtc(crtc)->index, }; struct nouveau_display *disp = nouveau_display(crtc->dev); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) struct drm_vblank_crtc *vblank = &crtc->dev->vblank[drm_crtc_index(crtc)]; +#endif int ret, retry = 1; do { @@ -118,7 +130,11 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos, break; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) if (retry) ndelay(vblank->linedur_ns); +#else + if (retry) ndelay(crtc->linedur_ns); +#endif } while (retry--); *hpos = args.scan.hline; @@ -133,10 +149,16 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos, } int +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) nouveau_display_scanoutpos(struct drm_device *dev, unsigned int pipe, unsigned int flags, int *vpos, int *hpos, ktime_t *stime, ktime_t *etime, const struct drm_display_mode *mode) +#else +nouveau_display_scanoutpos(struct drm_device *dev, int pipe, + unsigned int flags, int *vpos, int *hpos, + ktime_t *stime, ktime_t *etime) +#endif { struct drm_crtc *crtc; @@ -151,15 +173,24 @@ nouveau_display_scanoutpos(struct drm_device *dev, unsigned int pipe, } int +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) nouveau_display_vblstamp(struct drm_device *dev, unsigned int pipe, int *max_error, struct timeval *time, unsigned flags) +#else +nouveau_display_vblstamp(struct drm_device *dev, int pipe, + int *max_error, struct timeval *time, unsigned flags) +#endif { struct drm_crtc *crtc; list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { if (nouveau_crtc(crtc)->index == pipe) { return drm_calc_vbltimestamp_from_scanoutpos(dev, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) pipe, max_error, time, flags, +#else + pipe, max_error, time, flags, crtc, +#endif &crtc->hwmode); } } @@ -254,7 +285,11 @@ nouveau_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb = &nv_fb->base; int ret; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) drm_helper_mode_fill_fb_struct(fb, mode_cmd); +#else + drm_helper_mode_fill_fb_struct(fb, (struct drm_mode_fb_cmd2 *)mode_cmd); +#endif nv_fb->nvbo = nvbo; ret = drm_framebuffer_init(dev, fb, &nouveau_framebuffer_funcs); @@ -273,7 +308,11 @@ nouveau_framebuffer_init(struct drm_device *dev, static struct drm_framebuffer * nouveau_user_framebuffer_create(struct drm_device *dev, struct drm_file *file_priv, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) const struct drm_mode_fb_cmd2 *mode_cmd) +#else + struct drm_mode_fb_cmd2 *mode_cmd) +#endif { struct nouveau_framebuffer *nouveau_fb; struct drm_gem_object *gem; @@ -840,6 +879,7 @@ nouveau_finish_page_flip(struct nouveau_channel *chan, } s = list_first_entry(&fctx->flip, struct nouveau_page_flip_state, head); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) if (s->event) { if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA) { drm_arm_vblank_event(dev, s->crtc, s->event); @@ -854,6 +894,11 @@ nouveau_finish_page_flip(struct nouveau_channel *chan, /* Give up ownership of vblank for page-flipped crtc */ drm_vblank_put(dev, s->crtc); } +#else + if (s->event) + drm_send_vblank_event(dev, s->crtc, s->event); + drm_vblank_put(dev, s->crtc); +#endif list_del(&s->head); if (ps) diff --git a/drm/nouveau/nouveau_display.h b/drm/nouveau/nouveau_display.h index 5a57d8b47..3fd084f60 100644 --- a/drm/nouveau/nouveau_display.h +++ b/drm/nouveau/nouveau_display.h @@ -5,6 +5,8 @@ #include "nouveau_drm.h" +#include <linux/version.h> + struct nouveau_framebuffer { struct drm_framebuffer base; struct nouveau_bo *nvbo; @@ -65,6 +67,7 @@ int nouveau_display_init(struct drm_device *dev); void nouveau_display_fini(struct drm_device *dev); int nouveau_display_suspend(struct drm_device *dev, bool runtime); void nouveau_display_resume(struct drm_device *dev, bool runtime); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) int nouveau_display_vblank_enable(struct drm_device *, unsigned int); void nouveau_display_vblank_disable(struct drm_device *, unsigned int); int nouveau_display_scanoutpos(struct drm_device *, unsigned int, @@ -72,6 +75,15 @@ int nouveau_display_scanoutpos(struct drm_device *, unsigned int, ktime_t *, const struct drm_display_mode *); int nouveau_display_vblstamp(struct drm_device *, unsigned int, int *, struct timeval *, unsigned); +#else +int nouveau_display_vblank_enable(struct drm_device *, int); +void nouveau_display_vblank_disable(struct drm_device *, int); +int nouveau_display_scanoutpos(struct drm_device *, int, + unsigned int, int *, int *, ktime_t *, + ktime_t *); +int nouveau_display_vblstamp(struct drm_device *, int, int *, + struct timeval *, unsigned); +#endif int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, struct drm_pending_vblank_event *event, diff --git a/drm/nouveau/nouveau_drm.c b/drm/nouveau/nouveau_drm.c index ad72c28ba..e89cc615f 100644 --- a/drm/nouveau/nouveau_drm.c +++ b/drm/nouveau/nouveau_drm.c @@ -28,6 +28,7 @@ #include <linux/pci.h> #include <linux/pm_runtime.h> #include <linux/vga_switcheroo.h> +#include <linux/version.h> #include "drmP.h" #include "drm_crtc_helper.h" @@ -920,6 +921,10 @@ nouveau_driver_fops = { .llseek = noop_llseek, }; +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) +#define DRIVER_KMS_LEGACY_CONTEXT 0 +#endif + static struct drm_driver driver_stub = { .driver_features = @@ -938,7 +943,9 @@ driver_stub = { .debugfs_cleanup = nouveau_drm_debugfs_cleanup, #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) .get_vblank_counter = drm_vblank_no_hw_counter, +#endif .enable_vblank = nouveau_display_vblank_enable, .disable_vblank = nouveau_display_vblank_disable, .get_scanout_position = nouveau_display_scanoutpos, diff --git a/drm/nouveau/nouveau_fbcon.c b/drm/nouveau/nouveau_fbcon.c index 59f27e774..02c5763e9 100644 --- a/drm/nouveau/nouveau_fbcon.c +++ b/drm/nouveau/nouveau_fbcon.c @@ -37,6 +37,7 @@ #include <linux/screen_info.h> #include <linux/vga_switcheroo.h> #include <linux/console.h> +#include <linux/version.h> #include <drm/drmP.h> #include <drm/drm_crtc.h> @@ -84,7 +85,9 @@ nouveau_fbcon_fillrect(struct fb_info *info, const struct fb_fillrect *rect) if (ret != -ENODEV) nouveau_fbcon_gpu_lockup(info); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) drm_fb_helper_cfb_fillrect(info, rect); +#endif } static void @@ -116,7 +119,9 @@ nouveau_fbcon_copyarea(struct fb_info *info, const struct fb_copyarea *image) if (ret != -ENODEV) nouveau_fbcon_gpu_lockup(info); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) drm_fb_helper_cfb_copyarea(info, image); +#endif } static void @@ -148,7 +153,9 @@ nouveau_fbcon_imageblit(struct fb_info *info, const struct fb_image *image) if (ret != -ENODEV) nouveau_fbcon_gpu_lockup(info); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) drm_fb_helper_cfb_imageblit(info, image); +#endif } static int @@ -221,9 +228,11 @@ static struct fb_ops nouveau_fbcon_sw_ops = { .fb_release = nouveau_fbcon_release, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) .fb_fillrect = drm_fb_helper_cfb_fillrect, .fb_copyarea = drm_fb_helper_cfb_copyarea, .fb_imageblit = drm_fb_helper_cfb_imageblit, +#endif .fb_pan_display = drm_fb_helper_pan_display, .fb_blank = drm_fb_helper_blank, .fb_setcmap = drm_fb_helper_setcmap, @@ -388,7 +397,11 @@ nouveau_fbcon_create(struct drm_fb_helper *helper, mutex_lock(&dev->struct_mutex); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) info = drm_fb_helper_alloc_fbi(helper); +#else + info = ERR_PTR(-EINVAL); +#endif if (IS_ERR(info)) { ret = PTR_ERR(info); goto out_unlock; @@ -433,7 +446,11 @@ nouveau_fbcon_create(struct drm_fb_helper *helper, nouveau_fbcon_zfill(dev, fbcon); /* To allow resizeing without swapping buffers */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) NV_INFO(drm, "allocated %dx%d fb: 0x%llx, bo %p\n", +#else + NV_INFO(drm, "allocated %dx%d fb: 0x%lx, bo %p\n", +#endif nouveau_fb->base.width, nouveau_fb->base.height, nvbo->bo.offset, nvbo); @@ -466,8 +483,10 @@ nouveau_fbcon_destroy(struct drm_device *dev, struct nouveau_fbdev *fbcon) { struct nouveau_framebuffer *nouveau_fb = &fbcon->nouveau_fb; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) drm_fb_helper_unregister_fbi(&fbcon->helper); drm_fb_helper_release_fbi(&fbcon->helper); +#endif if (nouveau_fb->nvbo) { nouveau_bo_unmap(nouveau_fb->nvbo); @@ -505,7 +524,9 @@ nouveau_fbcon_set_suspend(struct drm_device *dev, int state) console_lock(); if (state == FBINFO_STATE_RUNNING) nouveau_fbcon_accel_restore(dev); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) drm_fb_helper_set_suspend(&drm->fbcon->helper, state); +#endif if (state != FBINFO_STATE_RUNNING) nouveau_fbcon_accel_save_disable(dev); console_unlock(); diff --git a/drm/nouveau/nouveau_platform.c b/drm/nouveau/nouveau_platform.c index 2dfe58af1..aa3150176 100644 --- a/drm/nouveau/nouveau_platform.c +++ b/drm/nouveau/nouveau_platform.c @@ -20,6 +20,7 @@ * DEALINGS IN THE SOFTWARE. */ #include "nouveau_platform.h" +#include <linux/version.h> static int nouveau_platform_probe(struct platform_device *pdev) { @@ -28,7 +29,13 @@ static int nouveau_platform_probe(struct platform_device *pdev) struct drm_device *drm; int ret; +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) + const struct of_device_id *match; + match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev); + func = match->data; +#else func = of_device_get_match_data(&pdev->dev); +#endif drm = nouveau_platform_device_create(func, pdev, &device); if (IS_ERR(drm)) diff --git a/drm/nouveau/nv50_display.c b/drm/nouveau/nv50_display.c index a43445caa..0a19cc8bc 100644 --- a/drm/nouveau/nv50_display.c +++ b/drm/nouveau/nv50_display.c @@ -1724,7 +1724,11 @@ nv50_dac_create(struct drm_connector *connector, struct dcb_output *dcbe) encoder = to_drm_encoder(nv_encoder); encoder->possible_crtcs = dcbe->heads; encoder->possible_clones = 0; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) drm_encoder_init(connector->dev, encoder, &nv50_dac_func, type, NULL); +#else + drm_encoder_init(connector->dev, encoder, &nv50_dac_func, type); +#endif drm_encoder_helper_add(encoder, &nv50_dac_hfunc); drm_mode_connector_attach_encoder(connector, encoder); @@ -1762,8 +1766,12 @@ nv50_audio_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode) drm_edid_to_eld(&nv_connector->base, nv_connector->edid); memcpy(args.data, nv_connector->base.eld, sizeof(args.data)); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) nvif_mthd(disp->disp, 0, &args, sizeof(args.base) + drm_eld_size(args.data)); +#else + nvif_mthd(disp->disp, 0, &args, sizeof(args.base) + args.data[2] * 4); +#endif } static void @@ -2139,7 +2147,11 @@ nv50_sor_create(struct drm_connector *connector, struct dcb_output *dcbe) encoder = to_drm_encoder(nv_encoder); encoder->possible_crtcs = dcbe->heads; encoder->possible_clones = 0; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) drm_encoder_init(connector->dev, encoder, &nv50_sor_func, type, NULL); +#else + drm_encoder_init(connector->dev, encoder, &nv50_sor_func, type); +#endif drm_encoder_helper_add(encoder, &nv50_sor_hfunc); drm_mode_connector_attach_encoder(connector, encoder); @@ -2319,7 +2331,11 @@ nv50_pior_create(struct drm_connector *connector, struct dcb_output *dcbe) encoder = to_drm_encoder(nv_encoder); encoder->possible_crtcs = dcbe->heads; encoder->possible_clones = 0; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,5,0) drm_encoder_init(connector->dev, encoder, &nv50_pior_func, type, NULL); +#else + drm_encoder_init(connector->dev, encoder, &nv50_pior_func, type); +#endif drm_encoder_helper_add(encoder, &nv50_pior_hfunc); drm_mode_connector_attach_encoder(connector, encoder); |