Loading drivers/gpu/drm/nouveau/Makefile +2 −4 Original line number Diff line number Diff line Loading @@ -192,7 +192,7 @@ nouveau-y += nv04_fence.o nv10_fence.o nv50_fence.o nv84_fence.o nvc0_fence.o # drm/kms nouveau-y += nouveau_bios.o nouveau_fbcon.o nouveau_display.o nouveau-y += nouveau_connector.o nouveau_hdmi.o nouveau_dp.o nouveau-y += nouveau_connector.o nouveau_dp.o nouveau-y += nv04_fbcon.o nv50_fbcon.o nvc0_fbcon.o # drm/kms/nv04:nv50 Loading @@ -201,9 +201,7 @@ nouveau-y += nv04_dac.o nv04_dfp.o nv04_tv.o nv17_tv.o nv17_tv_modes.o nouveau-y += nv04_crtc.o nv04_display.o nv04_cursor.o # drm/kms/nv50- nouveau-y += nv50_display.o nvd0_display.o nouveau-y += nv50_crtc.o nv50_dac.o nv50_sor.o nv50_cursor.o nouveau-y += nv50_evo.o nouveau-y += nvd0_display.o # drm/pm nouveau-y += nouveau_pm.o nouveau_volt.o nouveau_perf.o Loading drivers/gpu/drm/nouveau/nouveau_connector.h +16 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #define __NOUVEAU_CONNECTOR_H__ #include <drm/drm_edid.h> #include "nouveau_crtc.h" struct nouveau_i2c_port; Loading Loading @@ -80,6 +81,21 @@ static inline struct nouveau_connector *nouveau_connector( return container_of(con, struct nouveau_connector, base); } static inline struct nouveau_connector * nouveau_crtc_connector_get(struct nouveau_crtc *nv_crtc) { struct drm_device *dev = nv_crtc->base.dev; struct drm_connector *connector; struct drm_crtc *crtc = to_drm_crtc(nv_crtc); list_for_each_entry(connector, &dev->mode_config.connector_list, head) { if (connector->encoder && connector->encoder->crtc == crtc) return nouveau_connector(connector); } return NULL; } struct drm_connector * nouveau_connector_create(struct drm_device *, int index); Loading drivers/gpu/drm/nouveau/nouveau_crtc.h +0 −3 Original line number Diff line number Diff line Loading @@ -91,7 +91,4 @@ int nv50_crtc_cursor_move(struct drm_crtc *drm_crtc, int x, int y); int nv04_cursor_init(struct nouveau_crtc *); int nv50_cursor_init(struct nouveau_crtc *); struct nouveau_connector * nouveau_crtc_connector_get(struct nouveau_crtc *crtc); #endif /* __NOUVEAU_CRTC_H__ */ drivers/gpu/drm/nouveau/nouveau_display.c +6 −12 Original line number Diff line number Diff line Loading @@ -98,12 +98,12 @@ nouveau_framebuffer_init(struct drm_device *dev, nv_fb->r_dma = NvEvoVRAM_LP; switch (fb->depth) { case 8: nv_fb->r_format = NV50_EVO_CRTC_FB_DEPTH_8; break; case 15: nv_fb->r_format = NV50_EVO_CRTC_FB_DEPTH_15; break; case 16: nv_fb->r_format = NV50_EVO_CRTC_FB_DEPTH_16; break; case 8: nv_fb->r_format = 0x1e00; break; case 15: nv_fb->r_format = 0xe900; break; case 16: nv_fb->r_format = 0xe800; break; case 24: case 32: nv_fb->r_format = NV50_EVO_CRTC_FB_DEPTH_24; break; case 30: nv_fb->r_format = NV50_EVO_CRTC_FB_DEPTH_30; break; case 32: nv_fb->r_format = 0xcf00; break; case 30: nv_fb->r_format = 0xd100; break; default: NV_ERROR(drm, "unknown depth %d\n", fb->depth); return -EINVAL; Loading Loading @@ -365,9 +365,6 @@ nouveau_display_create(struct drm_device *dev) (nouveau_modeset < 0 && pclass == PCI_CLASS_DISPLAY_VGA)) { if (nv_device(drm->device)->card_type < NV_50) ret = nv04_display_create(dev); else if (nv_device(drm->device)->card_type < NV_D0) ret = nv50_display_create(dev); else ret = nvd0_display_create(dev); if (ret) Loading Loading @@ -660,10 +657,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, /* Emit a page flip */ if (nv_device(drm->device)->card_type >= NV_50) { if (nv_device(drm->device)->card_type >= NV_D0) ret = nvd0_display_flip_next(crtc, fb, chan, 0); else ret = nv50_display_flip_next(crtc, fb, chan); if (ret) { mutex_unlock(&chan->cli->mutex); goto fail_unreserve; Loading drivers/gpu/drm/nouveau/nouveau_hdmi.cdeleted 100644 → 0 +0 −123 Original line number Diff line number Diff line /* * Copyright 2011 Red Hat Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: Ben Skeggs */ #include <drm/drmP.h> #include "nouveau_drm.h" #include "nouveau_connector.h" #include "nouveau_encoder.h" #include "nouveau_crtc.h" #include <core/class.h> #include "nv50_display.h" static bool hdmi_sor(struct drm_encoder *encoder) { struct nouveau_drm *drm = nouveau_drm(encoder->dev); if (nv_device(drm->device)->chipset < 0xa3 || nv_device(drm->device)->chipset == 0xaa || nv_device(drm->device)->chipset == 0xac) return false; return true; } static void nouveau_audio_disconnect(struct drm_encoder *encoder) { struct nv50_display *priv = nv50_display(encoder->dev); struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); u32 or = nv_encoder->or; if (hdmi_sor(encoder)) nv_exec(priv->core, NVA3_DISP_SOR_HDA_ELD + or, NULL, 0); } static void nouveau_audio_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode) { struct nv50_display *priv = nv50_display(encoder->dev); struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); struct nouveau_connector *nv_connector; nv_connector = nouveau_encoder_connector_get(nv_encoder); if (!drm_detect_monitor_audio(nv_connector->edid)) { nouveau_audio_disconnect(encoder); return; } if (hdmi_sor(encoder)) { drm_edid_to_eld(&nv_connector->base, nv_connector->edid); nv_exec(priv->core, NVA3_DISP_SOR_HDA_ELD + nv_encoder->or, nv_connector->base.eld, nv_connector->base.eld[2] * 4); } } static void nouveau_hdmi_disconnect(struct drm_encoder *encoder) { struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); struct nouveau_crtc *nv_crtc = nouveau_crtc(nv_encoder->crtc); struct nv50_display *priv = nv50_display(encoder->dev); const u32 moff = (nv_crtc->index << 3) | nv_encoder->or; nouveau_audio_disconnect(encoder); nv_call(priv->core, NV84_DISP_SOR_HDMI_PWR + moff, 0x00000000); } void nouveau_hdmi_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode) { struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); struct nouveau_crtc *nv_crtc = nouveau_crtc(nv_encoder->crtc); struct nv50_display *priv = nv50_display(encoder->dev); const u32 moff = (nv_crtc->index << 3) | nv_encoder->or; struct nouveau_connector *nv_connector; u32 max_ac_packet, rekey; nv_connector = nouveau_encoder_connector_get(nv_encoder); if (!mode || !nv_connector || !nv_connector->edid || !drm_detect_hdmi_monitor(nv_connector->edid)) { nouveau_hdmi_disconnect(encoder); return; } /* value matches nvidia binary driver, and tegra constant */ rekey = 56; max_ac_packet = mode->htotal - mode->hdisplay; max_ac_packet -= rekey; max_ac_packet -= 18; /* constant from tegra */ max_ac_packet /= 32; nv_call(priv->core, NV84_DISP_SOR_HDMI_PWR + moff, NV84_DISP_SOR_HDMI_PWR_STATE_ON | (max_ac_packet << 16) | rekey); nouveau_audio_mode_set(encoder, mode); } Loading
drivers/gpu/drm/nouveau/Makefile +2 −4 Original line number Diff line number Diff line Loading @@ -192,7 +192,7 @@ nouveau-y += nv04_fence.o nv10_fence.o nv50_fence.o nv84_fence.o nvc0_fence.o # drm/kms nouveau-y += nouveau_bios.o nouveau_fbcon.o nouveau_display.o nouveau-y += nouveau_connector.o nouveau_hdmi.o nouveau_dp.o nouveau-y += nouveau_connector.o nouveau_dp.o nouveau-y += nv04_fbcon.o nv50_fbcon.o nvc0_fbcon.o # drm/kms/nv04:nv50 Loading @@ -201,9 +201,7 @@ nouveau-y += nv04_dac.o nv04_dfp.o nv04_tv.o nv17_tv.o nv17_tv_modes.o nouveau-y += nv04_crtc.o nv04_display.o nv04_cursor.o # drm/kms/nv50- nouveau-y += nv50_display.o nvd0_display.o nouveau-y += nv50_crtc.o nv50_dac.o nv50_sor.o nv50_cursor.o nouveau-y += nv50_evo.o nouveau-y += nvd0_display.o # drm/pm nouveau-y += nouveau_pm.o nouveau_volt.o nouveau_perf.o Loading
drivers/gpu/drm/nouveau/nouveau_connector.h +16 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #define __NOUVEAU_CONNECTOR_H__ #include <drm/drm_edid.h> #include "nouveau_crtc.h" struct nouveau_i2c_port; Loading Loading @@ -80,6 +81,21 @@ static inline struct nouveau_connector *nouveau_connector( return container_of(con, struct nouveau_connector, base); } static inline struct nouveau_connector * nouveau_crtc_connector_get(struct nouveau_crtc *nv_crtc) { struct drm_device *dev = nv_crtc->base.dev; struct drm_connector *connector; struct drm_crtc *crtc = to_drm_crtc(nv_crtc); list_for_each_entry(connector, &dev->mode_config.connector_list, head) { if (connector->encoder && connector->encoder->crtc == crtc) return nouveau_connector(connector); } return NULL; } struct drm_connector * nouveau_connector_create(struct drm_device *, int index); Loading
drivers/gpu/drm/nouveau/nouveau_crtc.h +0 −3 Original line number Diff line number Diff line Loading @@ -91,7 +91,4 @@ int nv50_crtc_cursor_move(struct drm_crtc *drm_crtc, int x, int y); int nv04_cursor_init(struct nouveau_crtc *); int nv50_cursor_init(struct nouveau_crtc *); struct nouveau_connector * nouveau_crtc_connector_get(struct nouveau_crtc *crtc); #endif /* __NOUVEAU_CRTC_H__ */
drivers/gpu/drm/nouveau/nouveau_display.c +6 −12 Original line number Diff line number Diff line Loading @@ -98,12 +98,12 @@ nouveau_framebuffer_init(struct drm_device *dev, nv_fb->r_dma = NvEvoVRAM_LP; switch (fb->depth) { case 8: nv_fb->r_format = NV50_EVO_CRTC_FB_DEPTH_8; break; case 15: nv_fb->r_format = NV50_EVO_CRTC_FB_DEPTH_15; break; case 16: nv_fb->r_format = NV50_EVO_CRTC_FB_DEPTH_16; break; case 8: nv_fb->r_format = 0x1e00; break; case 15: nv_fb->r_format = 0xe900; break; case 16: nv_fb->r_format = 0xe800; break; case 24: case 32: nv_fb->r_format = NV50_EVO_CRTC_FB_DEPTH_24; break; case 30: nv_fb->r_format = NV50_EVO_CRTC_FB_DEPTH_30; break; case 32: nv_fb->r_format = 0xcf00; break; case 30: nv_fb->r_format = 0xd100; break; default: NV_ERROR(drm, "unknown depth %d\n", fb->depth); return -EINVAL; Loading Loading @@ -365,9 +365,6 @@ nouveau_display_create(struct drm_device *dev) (nouveau_modeset < 0 && pclass == PCI_CLASS_DISPLAY_VGA)) { if (nv_device(drm->device)->card_type < NV_50) ret = nv04_display_create(dev); else if (nv_device(drm->device)->card_type < NV_D0) ret = nv50_display_create(dev); else ret = nvd0_display_create(dev); if (ret) Loading Loading @@ -660,10 +657,7 @@ nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb, /* Emit a page flip */ if (nv_device(drm->device)->card_type >= NV_50) { if (nv_device(drm->device)->card_type >= NV_D0) ret = nvd0_display_flip_next(crtc, fb, chan, 0); else ret = nv50_display_flip_next(crtc, fb, chan); if (ret) { mutex_unlock(&chan->cli->mutex); goto fail_unreserve; Loading
drivers/gpu/drm/nouveau/nouveau_hdmi.cdeleted 100644 → 0 +0 −123 Original line number Diff line number Diff line /* * Copyright 2011 Red Hat Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: Ben Skeggs */ #include <drm/drmP.h> #include "nouveau_drm.h" #include "nouveau_connector.h" #include "nouveau_encoder.h" #include "nouveau_crtc.h" #include <core/class.h> #include "nv50_display.h" static bool hdmi_sor(struct drm_encoder *encoder) { struct nouveau_drm *drm = nouveau_drm(encoder->dev); if (nv_device(drm->device)->chipset < 0xa3 || nv_device(drm->device)->chipset == 0xaa || nv_device(drm->device)->chipset == 0xac) return false; return true; } static void nouveau_audio_disconnect(struct drm_encoder *encoder) { struct nv50_display *priv = nv50_display(encoder->dev); struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); u32 or = nv_encoder->or; if (hdmi_sor(encoder)) nv_exec(priv->core, NVA3_DISP_SOR_HDA_ELD + or, NULL, 0); } static void nouveau_audio_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode) { struct nv50_display *priv = nv50_display(encoder->dev); struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); struct nouveau_connector *nv_connector; nv_connector = nouveau_encoder_connector_get(nv_encoder); if (!drm_detect_monitor_audio(nv_connector->edid)) { nouveau_audio_disconnect(encoder); return; } if (hdmi_sor(encoder)) { drm_edid_to_eld(&nv_connector->base, nv_connector->edid); nv_exec(priv->core, NVA3_DISP_SOR_HDA_ELD + nv_encoder->or, nv_connector->base.eld, nv_connector->base.eld[2] * 4); } } static void nouveau_hdmi_disconnect(struct drm_encoder *encoder) { struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); struct nouveau_crtc *nv_crtc = nouveau_crtc(nv_encoder->crtc); struct nv50_display *priv = nv50_display(encoder->dev); const u32 moff = (nv_crtc->index << 3) | nv_encoder->or; nouveau_audio_disconnect(encoder); nv_call(priv->core, NV84_DISP_SOR_HDMI_PWR + moff, 0x00000000); } void nouveau_hdmi_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode) { struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); struct nouveau_crtc *nv_crtc = nouveau_crtc(nv_encoder->crtc); struct nv50_display *priv = nv50_display(encoder->dev); const u32 moff = (nv_crtc->index << 3) | nv_encoder->or; struct nouveau_connector *nv_connector; u32 max_ac_packet, rekey; nv_connector = nouveau_encoder_connector_get(nv_encoder); if (!mode || !nv_connector || !nv_connector->edid || !drm_detect_hdmi_monitor(nv_connector->edid)) { nouveau_hdmi_disconnect(encoder); return; } /* value matches nvidia binary driver, and tegra constant */ rekey = 56; max_ac_packet = mode->htotal - mode->hdisplay; max_ac_packet -= rekey; max_ac_packet -= 18; /* constant from tegra */ max_ac_packet /= 32; nv_call(priv->core, NV84_DISP_SOR_HDMI_PWR + moff, NV84_DISP_SOR_HDMI_PWR_STATE_ON | (max_ac_packet << 16) | rekey); nouveau_audio_mode_set(encoder, mode); }