summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c')
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c140
1 files changed, 15 insertions, 125 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c
index ecde98dd2454..0af45ccd140c 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/rootnv50.c
@@ -21,11 +21,10 @@
*
* Authors: Ben Skeggs
*/
-#include "rootnv50.h"
-#include "channv50.h"
-#include "dp.h"
+#include "chan.h"
#include "head.h"
#include "ior.h"
+#include "outp.h"
#include <core/client.h>
@@ -33,15 +32,14 @@
#include <nvif/cl5070.h>
#include <nvif/unpack.h>
-static int
+int
nv50_disp_root_mthd_(struct nvkm_object *object, u32 mthd, void *data, u32 size)
{
union {
struct nv50_disp_mthd_v0 v0;
struct nv50_disp_mthd_v1 v1;
} *args = data;
- struct nv50_disp_root *root = nv50_disp_root(object);
- struct nv50_disp *disp = root->disp;
+ struct nvkm_disp *disp = nvkm_udisp(object);
struct nvkm_outp *temp, *outp = NULL;
struct nvkm_head *head;
u16 type, mask = 0;
@@ -69,11 +67,11 @@ nv50_disp_root_mthd_(struct nvkm_object *object, u32 mthd, void *data, u32 size)
} else
return ret;
- if (!(head = nvkm_head_find(&disp->base, hidx)))
+ if (!(head = nvkm_head_find(disp, hidx)))
return -ENXIO;
if (mask) {
- list_for_each_entry(temp, &disp->base.outp, head) {
+ list_for_each_entry(temp, &disp->outps, head) {
if ((temp->info.hasht == type) &&
(temp->info.hashm & mask) == mask) {
outp = temp;
@@ -111,27 +109,6 @@ nv50_disp_root_mthd_(struct nvkm_object *object, u32 mthd, void *data, u32 size)
case NV50_DISP_MTHD_V1_RELEASE:
nvkm_outp_release(outp, NVKM_OUTP_USER);
return 0;
- case NV50_DISP_MTHD_V1_DAC_LOAD: {
- union {
- struct nv50_disp_dac_load_v0 v0;
- } *args = data;
- int ret = -ENOSYS;
- if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
- if (args->v0.data & 0xfff00000)
- return -EINVAL;
- ret = nvkm_outp_acquire(outp, NVKM_OUTP_PRIV, false);
- if (ret)
- return ret;
- ret = outp->ior->func->sense(outp->ior, args->v0.data);
- nvkm_outp_release(outp, NVKM_OUTP_PRIV);
- if (ret < 0)
- return ret;
- args->v0.load = ret;
- return 0;
- } else
- return ret;
- }
- break;
case NV50_DISP_MTHD_V1_SOR_HDA_ELD: {
union {
struct nv50_disp_sor_hda_eld_v0 v0;
@@ -148,18 +125,18 @@ nv50_disp_root_mthd_(struct nvkm_object *object, u32 mthd, void *data, u32 size)
} else
return ret;
- if (!ior->func->hda.hpd)
+ if (!ior->hda)
return -ENODEV;
if (size && args->v0.data[0]) {
if (outp->info.type == DCB_OUTPUT_DP)
- ior->func->dp.audio(ior, hidx, true);
- ior->func->hda.hpd(ior, hidx, true);
- ior->func->hda.eld(ior, hidx, data, size);
+ ior->func->dp->audio(ior, hidx, true);
+ ior->func->hda->hpd(ior, hidx, true);
+ ior->func->hda->eld(ior, hidx, data, size);
} else {
if (outp->info.type == DCB_OUTPUT_DP)
- ior->func->dp.audio(ior, hidx, false);
- ior->func->hda.hpd(ior, hidx, false);
+ ior->func->dp->audio(ior, hidx, false);
+ ior->func->hda->hpd(ior, hidx, false);
}
return 0;
@@ -227,7 +204,6 @@ nv50_disp_root_mthd_(struct nvkm_object *object, u32 mthd, void *data, u32 size)
}
break;
case NV50_DISP_MTHD_V1_SOR_DP_MST_LINK: {
- struct nvkm_dp *dp = nvkm_dp(outp);
union {
struct nv50_disp_sor_dp_mst_link_v0 v0;
} *args = data;
@@ -236,7 +212,7 @@ nv50_disp_root_mthd_(struct nvkm_object *object, u32 mthd, void *data, u32 size)
if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
nvif_ioctl(object, "disp sor dp mst link vers %d state %d\n",
args->v0.version, args->v0.state);
- dp->lt.mst = !!args->v0.state;
+ outp->dp.lt.mst = !!args->v0.state;
return 0;
} else
return ret;
@@ -254,9 +230,9 @@ nv50_disp_root_mthd_(struct nvkm_object *object, u32 mthd, void *data, u32 size)
args->v0.version, args->v0.start_slot,
args->v0.num_slots, args->v0.pbn,
args->v0.aligned_pbn);
- if (!outp->ior->func->dp.vcpi)
+ if (!outp->ior->func->dp->vcpi)
return -ENODEV;
- outp->ior->func->dp.vcpi(outp->ior, hidx,
+ outp->ior->func->dp->vcpi(outp->ior, hidx,
args->v0.start_slot,
args->v0.num_slots,
args->v0.pbn,
@@ -272,89 +248,3 @@ nv50_disp_root_mthd_(struct nvkm_object *object, u32 mthd, void *data, u32 size)
return -EINVAL;
}
-
-static int
-nv50_disp_root_child_new_(const struct nvkm_oclass *oclass,
- void *argv, u32 argc, struct nvkm_object **pobject)
-{
- struct nv50_disp *disp = nv50_disp_root(oclass->parent)->disp;
- const struct nv50_disp_user *user = oclass->priv;
- return user->ctor(oclass, argv, argc, disp, pobject);
-}
-
-static int
-nv50_disp_root_child_get_(struct nvkm_object *object, int index,
- struct nvkm_oclass *sclass)
-{
- struct nv50_disp_root *root = nv50_disp_root(object);
-
- if (root->func->user[index].ctor) {
- sclass->base = root->func->user[index].base;
- sclass->priv = root->func->user + index;
- sclass->ctor = nv50_disp_root_child_new_;
- return 0;
- }
-
- return -EINVAL;
-}
-
-static void *
-nv50_disp_root_dtor_(struct nvkm_object *object)
-{
- struct nv50_disp_root *root = nv50_disp_root(object);
- return root;
-}
-
-static const struct nvkm_object_func
-nv50_disp_root_ = {
- .dtor = nv50_disp_root_dtor_,
- .mthd = nv50_disp_root_mthd_,
- .ntfy = nvkm_disp_ntfy,
- .sclass = nv50_disp_root_child_get_,
-};
-
-int
-nv50_disp_root_new_(const struct nv50_disp_root_func *func,
- struct nvkm_disp *base, const struct nvkm_oclass *oclass,
- void *data, u32 size, struct nvkm_object **pobject)
-{
- struct nv50_disp *disp = nv50_disp(base);
- struct nv50_disp_root *root;
-
- if (!(root = kzalloc(sizeof(*root), GFP_KERNEL)))
- return -ENOMEM;
- *pobject = &root->object;
-
- nvkm_object_ctor(&nv50_disp_root_, oclass, &root->object);
- root->func = func;
- root->disp = disp;
- return 0;
-}
-
-static const struct nv50_disp_root_func
-nv50_disp_root = {
- .user = {
- {{0,0,NV50_DISP_CURSOR }, nv50_disp_curs_new },
- {{0,0,NV50_DISP_OVERLAY }, nv50_disp_oimm_new },
- {{0,0,NV50_DISP_BASE_CHANNEL_DMA }, nv50_disp_base_new },
- {{0,0,NV50_DISP_CORE_CHANNEL_DMA }, nv50_disp_core_new },
- {{0,0,NV50_DISP_OVERLAY_CHANNEL_DMA}, nv50_disp_ovly_new },
- {}
- },
-};
-
-static int
-nv50_disp_root_new(struct nvkm_disp *disp, const struct nvkm_oclass *oclass,
- void *data, u32 size, struct nvkm_object **pobject)
-{
- return nv50_disp_root_new_(&nv50_disp_root, disp, oclass,
- data, size, pobject);
-}
-
-const struct nvkm_disp_oclass
-nv50_disp_root_oclass = {
- .base.oclass = NV50_DISP,
- .base.minver = -1,
- .base.maxver = -1,
- .ctor = nv50_disp_root_new,
-};