Loading drivers/gpu/drm/nouveau/include/nvif/disp.h 0 → 100644 +12 −0 Original line number Diff line number Diff line #ifndef __NVIF_DISP_H__ #define __NVIF_DISP_H__ #include <nvif/object.h> struct nvif_device; struct nvif_disp { struct nvif_object object; }; int nvif_disp_ctor(struct nvif_device *, s32 oclass, struct nvif_disp *); void nvif_disp_dtor(struct nvif_disp *); #endif drivers/gpu/drm/nouveau/include/nvif/object.h +16 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,22 @@ struct nvif_mclass { ret; \ }) #define nvif_sclass(o,m,u) ({ \ const typeof(m[0]) *_mclass = (m); \ s32 _oclass = (u); \ int _cid; \ if (_oclass) { \ for (_cid = 0; _mclass[_cid].oclass; _cid++) { \ if (_mclass[_cid].oclass == _oclass) \ break; \ } \ _cid = _mclass[_cid].oclass ? _cid : -ENOSYS; \ } else { \ _cid = nvif_mclass((o), _mclass); \ } \ _cid; \ }) /*XXX*/ #include <core/object.h> #define nvxx_object(a) ({ \ Loading drivers/gpu/drm/nouveau/nouveau_connector.c +7 −7 Original line number Diff line number Diff line Loading @@ -151,7 +151,7 @@ nouveau_conn_atomic_set_property(struct drm_connector *connector, /* ... except prior to G80, where the code * doesn't support such things. */ if (disp->disp.oclass < NV50_DISP) if (disp->disp.object.oclass < NV50_DISP) return -EINVAL; break; default: Loading Loading @@ -260,7 +260,7 @@ nouveau_conn_reset(struct drm_connector *connector) asyc->procamp.color_vibrance = 150; asyc->procamp.vibrant_hue = 90; if (nouveau_display(connector->dev)->disp.oclass < NV50_DISP) { if (nouveau_display(connector->dev)->disp.object.oclass < NV50_DISP) { switch (connector->connector_type) { case DRM_MODE_CONNECTOR_LVDS: /* See note in nouveau_conn_atomic_set_property(). */ Loading Loading @@ -314,7 +314,7 @@ nouveau_conn_attach_properties(struct drm_connector *connector) case DRM_MODE_CONNECTOR_TV: break; case DRM_MODE_CONNECTOR_VGA: if (disp->disp.oclass < NV50_DISP) if (disp->disp.object.oclass < NV50_DISP) break; /* Can only scale on DFPs. */ /* Fall-through. */ default: Loading Loading @@ -1321,7 +1321,7 @@ nouveau_connector_create(struct drm_device *dev, int index) } /* HDMI 3D support */ if ((disp->disp.oclass >= G82_DISP) if ((disp->disp.object.oclass >= G82_DISP) && ((type == DRM_MODE_CONNECTOR_DisplayPort) || (type == DRM_MODE_CONNECTOR_eDP) || (type == DRM_MODE_CONNECTOR_HDMIA))) Loading @@ -1343,7 +1343,7 @@ nouveau_connector_create(struct drm_device *dev, int index) case DCB_CONNECTOR_LVDS_SPWG: case DCB_CONNECTOR_eDP: /* see note in nouveau_connector_set_property() */ if (disp->disp.oclass < NV50_DISP) { if (disp->disp.object.oclass < NV50_DISP) { nv_connector->scaling_mode = DRM_MODE_SCALE_FULLSCREEN; break; } Loading @@ -1366,8 +1366,8 @@ nouveau_connector_create(struct drm_device *dev, int index) break; } ret = nvif_notify_init(&disp->disp, nouveau_connector_hotplug, true, NV04_DISP_NTFY_CONN, ret = nvif_notify_init(&disp->disp.object, nouveau_connector_hotplug, true, NV04_DISP_NTFY_CONN, &(struct nvif_notify_conn_req_v0) { .mask = NVIF_NOTIFY_CONN_V0_ANY, .conn = index, Loading drivers/gpu/drm/nouveau/nouveau_display.c +7 −28 Original line number Diff line number Diff line Loading @@ -116,7 +116,7 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos, bool ret = false; do { ret = nvif_mthd(&disp->disp, 0, &args, sizeof(args)); ret = nvif_mthd(&disp->disp.object, 0, &args, sizeof(args)); if (ret != 0) return false; Loading Loading @@ -175,7 +175,7 @@ nouveau_display_vblank_init(struct drm_device *dev) list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); ret = nvif_notify_init(&disp->disp, ret = nvif_notify_init(&disp->disp.object, nouveau_display_vblank_handler, false, NV04_DISP_NTFY_VBLANK, &(struct nvif_notify_head_req_v0) { Loading Loading @@ -454,10 +454,10 @@ nouveau_display_create_properties(struct drm_device *dev) struct nouveau_display *disp = nouveau_display(dev); int gen; if (disp->disp.oclass < NV50_DISP) if (disp->disp.object.oclass < NV50_DISP) gen = 0; else if (disp->disp.oclass < GF110_DISP) if (disp->disp.object.oclass < GF110_DISP) gen = 1; else gen = 2; Loading Loading @@ -533,31 +533,10 @@ nouveau_display_create(struct drm_device *dev) drm_kms_helper_poll_disable(dev); if (nouveau_modeset != 2 && drm->vbios.dcb.entries) { static const u16 oclass[] = { GP102_DISP, GP100_DISP, GM200_DISP, GM107_DISP, GK110_DISP, GK104_DISP, GF110_DISP, GT214_DISP, GT206_DISP, GT200_DISP, G82_DISP, NV50_DISP, NV04_DISP, }; int i; for (i = 0, ret = -ENODEV; ret && i < ARRAY_SIZE(oclass); i++) { ret = nvif_object_init(&drm->client.device.object, 0, oclass[i], NULL, 0, &disp->disp); } ret = nvif_disp_ctor(&drm->client.device, 0, &disp->disp); if (ret == 0) { nouveau_display_create_properties(dev); if (disp->disp.oclass < NV50_DISP) if (disp->disp.object.oclass < NV50_DISP) ret = nv04_display_create(dev); else ret = nv50_display_create(dev); Loading Loading @@ -611,7 +590,7 @@ nouveau_display_destroy(struct drm_device *dev) if (disp->dtor) disp->dtor(dev); nvif_object_fini(&disp->disp); nvif_disp_dtor(&disp->disp); nouveau_drm(dev)->display = NULL; kfree(disp); Loading drivers/gpu/drm/nouveau/nouveau_display.h +2 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ #ifndef __NOUVEAU_DISPLAY_H__ #define __NOUVEAU_DISPLAY_H__ #include "nouveau_drv.h" #include <nvif/disp.h> struct nouveau_framebuffer { struct drm_framebuffer base; Loading Loading @@ -38,7 +39,7 @@ struct nouveau_display { int (*init)(struct drm_device *); void (*fini)(struct drm_device *); struct nvif_object disp; struct nvif_disp disp; struct drm_property *dithering_mode; struct drm_property *dithering_depth; Loading Loading
drivers/gpu/drm/nouveau/include/nvif/disp.h 0 → 100644 +12 −0 Original line number Diff line number Diff line #ifndef __NVIF_DISP_H__ #define __NVIF_DISP_H__ #include <nvif/object.h> struct nvif_device; struct nvif_disp { struct nvif_object object; }; int nvif_disp_ctor(struct nvif_device *, s32 oclass, struct nvif_disp *); void nvif_disp_dtor(struct nvif_disp *); #endif
drivers/gpu/drm/nouveau/include/nvif/object.h +16 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,22 @@ struct nvif_mclass { ret; \ }) #define nvif_sclass(o,m,u) ({ \ const typeof(m[0]) *_mclass = (m); \ s32 _oclass = (u); \ int _cid; \ if (_oclass) { \ for (_cid = 0; _mclass[_cid].oclass; _cid++) { \ if (_mclass[_cid].oclass == _oclass) \ break; \ } \ _cid = _mclass[_cid].oclass ? _cid : -ENOSYS; \ } else { \ _cid = nvif_mclass((o), _mclass); \ } \ _cid; \ }) /*XXX*/ #include <core/object.h> #define nvxx_object(a) ({ \ Loading
drivers/gpu/drm/nouveau/nouveau_connector.c +7 −7 Original line number Diff line number Diff line Loading @@ -151,7 +151,7 @@ nouveau_conn_atomic_set_property(struct drm_connector *connector, /* ... except prior to G80, where the code * doesn't support such things. */ if (disp->disp.oclass < NV50_DISP) if (disp->disp.object.oclass < NV50_DISP) return -EINVAL; break; default: Loading Loading @@ -260,7 +260,7 @@ nouveau_conn_reset(struct drm_connector *connector) asyc->procamp.color_vibrance = 150; asyc->procamp.vibrant_hue = 90; if (nouveau_display(connector->dev)->disp.oclass < NV50_DISP) { if (nouveau_display(connector->dev)->disp.object.oclass < NV50_DISP) { switch (connector->connector_type) { case DRM_MODE_CONNECTOR_LVDS: /* See note in nouveau_conn_atomic_set_property(). */ Loading Loading @@ -314,7 +314,7 @@ nouveau_conn_attach_properties(struct drm_connector *connector) case DRM_MODE_CONNECTOR_TV: break; case DRM_MODE_CONNECTOR_VGA: if (disp->disp.oclass < NV50_DISP) if (disp->disp.object.oclass < NV50_DISP) break; /* Can only scale on DFPs. */ /* Fall-through. */ default: Loading Loading @@ -1321,7 +1321,7 @@ nouveau_connector_create(struct drm_device *dev, int index) } /* HDMI 3D support */ if ((disp->disp.oclass >= G82_DISP) if ((disp->disp.object.oclass >= G82_DISP) && ((type == DRM_MODE_CONNECTOR_DisplayPort) || (type == DRM_MODE_CONNECTOR_eDP) || (type == DRM_MODE_CONNECTOR_HDMIA))) Loading @@ -1343,7 +1343,7 @@ nouveau_connector_create(struct drm_device *dev, int index) case DCB_CONNECTOR_LVDS_SPWG: case DCB_CONNECTOR_eDP: /* see note in nouveau_connector_set_property() */ if (disp->disp.oclass < NV50_DISP) { if (disp->disp.object.oclass < NV50_DISP) { nv_connector->scaling_mode = DRM_MODE_SCALE_FULLSCREEN; break; } Loading @@ -1366,8 +1366,8 @@ nouveau_connector_create(struct drm_device *dev, int index) break; } ret = nvif_notify_init(&disp->disp, nouveau_connector_hotplug, true, NV04_DISP_NTFY_CONN, ret = nvif_notify_init(&disp->disp.object, nouveau_connector_hotplug, true, NV04_DISP_NTFY_CONN, &(struct nvif_notify_conn_req_v0) { .mask = NVIF_NOTIFY_CONN_V0_ANY, .conn = index, Loading
drivers/gpu/drm/nouveau/nouveau_display.c +7 −28 Original line number Diff line number Diff line Loading @@ -116,7 +116,7 @@ nouveau_display_scanoutpos_head(struct drm_crtc *crtc, int *vpos, int *hpos, bool ret = false; do { ret = nvif_mthd(&disp->disp, 0, &args, sizeof(args)); ret = nvif_mthd(&disp->disp.object, 0, &args, sizeof(args)); if (ret != 0) return false; Loading Loading @@ -175,7 +175,7 @@ nouveau_display_vblank_init(struct drm_device *dev) list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); ret = nvif_notify_init(&disp->disp, ret = nvif_notify_init(&disp->disp.object, nouveau_display_vblank_handler, false, NV04_DISP_NTFY_VBLANK, &(struct nvif_notify_head_req_v0) { Loading Loading @@ -454,10 +454,10 @@ nouveau_display_create_properties(struct drm_device *dev) struct nouveau_display *disp = nouveau_display(dev); int gen; if (disp->disp.oclass < NV50_DISP) if (disp->disp.object.oclass < NV50_DISP) gen = 0; else if (disp->disp.oclass < GF110_DISP) if (disp->disp.object.oclass < GF110_DISP) gen = 1; else gen = 2; Loading Loading @@ -533,31 +533,10 @@ nouveau_display_create(struct drm_device *dev) drm_kms_helper_poll_disable(dev); if (nouveau_modeset != 2 && drm->vbios.dcb.entries) { static const u16 oclass[] = { GP102_DISP, GP100_DISP, GM200_DISP, GM107_DISP, GK110_DISP, GK104_DISP, GF110_DISP, GT214_DISP, GT206_DISP, GT200_DISP, G82_DISP, NV50_DISP, NV04_DISP, }; int i; for (i = 0, ret = -ENODEV; ret && i < ARRAY_SIZE(oclass); i++) { ret = nvif_object_init(&drm->client.device.object, 0, oclass[i], NULL, 0, &disp->disp); } ret = nvif_disp_ctor(&drm->client.device, 0, &disp->disp); if (ret == 0) { nouveau_display_create_properties(dev); if (disp->disp.oclass < NV50_DISP) if (disp->disp.object.oclass < NV50_DISP) ret = nv04_display_create(dev); else ret = nv50_display_create(dev); Loading Loading @@ -611,7 +590,7 @@ nouveau_display_destroy(struct drm_device *dev) if (disp->dtor) disp->dtor(dev); nvif_object_fini(&disp->disp); nvif_disp_dtor(&disp->disp); nouveau_drm(dev)->display = NULL; kfree(disp); Loading
drivers/gpu/drm/nouveau/nouveau_display.h +2 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ #ifndef __NOUVEAU_DISPLAY_H__ #define __NOUVEAU_DISPLAY_H__ #include "nouveau_drv.h" #include <nvif/disp.h> struct nouveau_framebuffer { struct drm_framebuffer base; Loading Loading @@ -38,7 +39,7 @@ struct nouveau_display { int (*init)(struct drm_device *); void (*fini)(struct drm_device *); struct nvif_object disp; struct nvif_disp disp; struct drm_property *dithering_mode; struct drm_property *dithering_depth; Loading