For surface layer, create a "parameter" node, with/without "layerpack" node, make a lyer output and connect it to the "parameter" node.
Set "type" in the parameter node to "Struct" -> "Shder Layer".
Tick "Use Own Export Context".
Set "Export" and "Export in Context" to "Always" and "surface" respectively.
Make this parm invisible.
For displacement, create another "layer pack" and "parameter" nodes, feed P and N to the "layer pack" and set the "parameter"'s parms to the same as above except typing "displace" in "Export in Context"