The Realname module for Drupal 7 is very different from previous versions.
Rather than configuring which modules should provide the fields for realname, the module now relies completely on the Token API that is built into Drupal 7 core. We also depend on the Token module that is not in core to be able to view the token UI. As a result, you must have the Token module downloaded and enabled before enabling the Real name module.
By default the realname pattern is [user:name-raw] which is simply the 'Name' field provided by core on user edit pages.
If you migrated your site from Drupal 6 and were using the core 'Profile' module, the profile field tokens are provided and available for selection.
If you are using Fields to build your user's profile, then you can either wait for Field token support to be finalized in Token module (#691078: Field tokens) or you can use the 'Entity Tokens' sub-module of the Entity module, although the latter is not recommended as a long-term solution by the Token maintainers.
Writing code that outputs a user's name
If you have written a Drupal 7 module that output's a user's name anywhere, you should always use either check_plain(format_username($account)) if the name is in plain text, or if your output is fine possibly including a link to the user, then you should use theme('username', array('account' => $account)) same as Drupal 6.
Note, RealName does not provide out-of-the-box support for Profile2 module, but does have an API that makes compatibility with Profile2 module possible through additional code..